HaTeX 3.16.0.0 → 3.16.1.0
raw patch · 6 files changed
+97/−14 lines, 6 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Text.LaTeX.Packages.AMSMath: bar :: LaTeXC l => l -> l
+ Text.LaTeX.Packages.AMSMath: dddot :: LaTeXC l => l -> l
+ Text.LaTeX.Packages.AMSMath: ddot :: LaTeXC l => l -> l
+ Text.LaTeX.Packages.AMSMath: dot :: LaTeXC l => l -> l
+ Text.LaTeX.Packages.AMSMath: hat :: LaTeXC l => l -> l
+ Text.LaTeX.Packages.AMSMath: imath :: LaTeXC l => l
+ Text.LaTeX.Packages.AMSMath: jmath :: LaTeXC l => l
+ Text.LaTeX.Packages.AMSMath: operatorname :: LaTeXC l => l -> l
+ Text.LaTeX.Packages.AMSMath: overline :: LaTeXC l => l -> l
+ Text.LaTeX.Packages.AMSMath: tilde :: LaTeXC l => l -> l
+ Text.LaTeX.Packages.AMSMath: vec :: LaTeXC l => l -> l
+ Text.LaTeX.Packages.AMSMath: widehat :: LaTeXC l => l -> l
+ Text.LaTeX.Packages.AMSMath: widetilde :: LaTeXC l => l -> l
Files
- CHANGELOG.md +12/−0
- HaTeX.cabal +1/−1
- Text/LaTeX/Base/Parser.hs +4/−2
- Text/LaTeX/Base/Pretty.hs +3/−3
- Text/LaTeX/Packages/AMSMath.hs +74/−8
- test/Main.hs +3/−0
CHANGELOG.md view
@@ -9,6 +9,18 @@ # Changelog by versions +## From 3.16.0.0 to 3.16.1.0++* Pretty-printer: Use softline instead of line after commands.+* Compatibility with GHC-7.10.+* Added accent commands to AMSMath (dmcclean).+* Missing Num and Floating class methods now have a default implementation,+ using the new `operatorname` function (dmcclean).+* Added `imath` and `jmath` to AMSMath (dmcclean).+* Support for parsec-3.1.9 (snoyberg).++Thanks to Douglas McClean (dmcclean@GitHub) for the AMSMath additions.+ ## From 3.15.0.0 to 3.16.0.0 * New package implemented: relsize.
HaTeX.cabal view
@@ -1,5 +1,5 @@ Name: HaTeX -Version: 3.16.0.0 +Version: 3.16.1.0 Author: Daniel Díaz Category: LaTeX Build-type: Simple
Text/LaTeX/Base/Parser.hs view
@@ -88,10 +88,12 @@ text :: Parser LaTeX text = do mbC <- peekChar+ let nottext :: [Char]+ nottext = "$%\\{]}" case mbC of Nothing -> fail "text: Empty input."- Just c | c `elem` "$%\\{]}" -> fail "not text"- | otherwise -> TeXRaw <$> takeTill (`elem` "$%\\{]}")+ Just c | c `elem` nottext -> fail "not text"+ | otherwise -> TeXRaw <$> takeTill (`elem` nottext) ------------------------------------------------------------------------ -- Text without stopping on ']'
Text/LaTeX/Base/Pretty.hs view
@@ -13,7 +13,7 @@ import Text.LaTeX.Base.Render import Text.PrettyPrint.Free ( Doc, text, char- , backslash, line, hardline+ , backslash, line, softline, hardline , braces, brackets , indent, align, vsep , list, encloseSep@@ -27,8 +27,8 @@ -- the function from the "Text.PrettyPrint.Free" module. docLaTeX :: LaTeX -> Doc () docLaTeX (TeXRaw t) = text $ unpack t-docLaTeX (TeXComm n as) = backslash <> text n <> align (mconcat (fmap docTeXArg as)) <> line-docLaTeX (TeXCommS n) = backslash <> text n <> line+docLaTeX (TeXComm n as) = backslash <> text n <> align (mconcat (fmap docTeXArg as)) <> softline+docLaTeX (TeXCommS n) = backslash <> text n <> softline docLaTeX (TeXEnv n as b) = let a = FixArg $ fromString n in mconcat
Text/LaTeX/Packages/AMSMath.hs view
@@ -38,6 +38,8 @@ , texp , tlog , ln , tsqrt+ -- ** Custom function symbols+ , operatorname -- ** Sum/Integral symbols , tsum , sumFromTo , prod , prodFromTo@@ -64,6 +66,10 @@ , vee , wedge , oplus , ominus , otimes , oslash , odot+ -- *** Accents+ , hat, tilde, bar, vec, widehat, widetilde+ , dot, ddot, dddot+ , overline -- ** Greek alphabet -- | Functions of greek alphabet symbols.@@ -91,6 +97,7 @@ , forall , exists , dagger, ddagger , infty+ , imath, jmath -- * Fonts , mathdefault , mathbf@@ -137,7 +144,7 @@ ----------- LaTeX instances --- | Careful! Method 'signum' is undefined. Don't use it!+-- | The 'signum' method uses a custom 'operatorname' and will not be automatically translated by babel. -- This instance is defined in the "Text.LaTeX.Packages.AMSMath" module. instance Num LaTeX where (+) = between "+"@@ -146,8 +153,7 @@ negate = (TeXEmpty -) fromInteger = rendertex abs = autoBrackets "|" "|"- -- Non-defined methods- signum _ = error "Cannot use \"signum\" Num method with a LaTeX value."+ signum = (operatorname "sgn" <>) -- | Division uses the LaTeX 'frac' command. -- This instance is defined in the "Text.LaTeX.Packages.AMSMath" module.@@ -155,7 +161,7 @@ (/) = frac fromRational = rendertex . (fromRational :: Rational -> Double) --- | Undefined methods: 'asinh', 'atanh' and 'acosh'.+-- | The 'asinh', 'atanh' and 'acosh' methods use custom 'operatorname's and will not be automatically translated by babel. -- This instance is defined in the "Text.LaTeX.Packages.AMSMath" module. instance Floating LaTeX where pi = pi_@@ -173,10 +179,9 @@ sinh = (tsinh <>) tanh = (ttanh <>) cosh = (tcosh <>)- -- Non-defined methods- asinh = error "Function 'asinh' is not defined in AMSMath!"- atanh = error "Function 'atabh' is not defined in AMSMath!"- acosh = error "Function 'acosh' is not defined in AMSMath!"+ asinh = (operatorname "arsinh" <>)+ atanh = (operatorname "artanh" <>)+ acosh = (operatorname "arcosh" <>) ----------- LaTeXT instances @@ -396,6 +401,12 @@ tsqrt Nothing = liftL $ \x -> TeXComm "sqrt" [FixArg x] tsqrt (Just n) = liftL2 (\m x -> TeXComm "sqrt" [OptArg m, FixArg x]) n +---- Custom Function Symbols+-- | Defines a new function symbol.+-- Note that function symbols defined in this way will not be automatically translated by babel.+operatorname :: LaTeXC l => l -> l+operatorname = comm1 "operatorname"+ ---- Sum/Integral symbols -- | Sigma sumation symbol. Use 'sumFromTo' instead if you want to@@ -586,6 +597,53 @@ odot :: LaTeXC l => l -> l -> l odot = between $ comm0 "odot" +--- Accemts+{-+ , hat, tilde, bar, vec, widehat, widetilde+ , dot, ddot, dddot+ , overline, underline+ -}++-- | Add a hat accent above a symbol. +hat :: LaTeXC l => l -> l+hat = comm1 "hat"++-- | Add a tilde accent above a symbol.+tilde :: LaTeXC l => l -> l+tilde = comm1 "tilde"++-- | Add a bar accent above a symbol.+bar :: LaTeXC l => l -> l+bar = comm1 "bar"++-- | Add a vector arrow accent above a symbol.+vec :: LaTeXC l => l -> l+vec = comm1 "vec"++-- | Add a wide hat accent above a symbol.+widehat :: LaTeXC l => l -> l+widehat = comm1 "widehat"++-- | Add a wide tilde accent above a symbol.+widetilde :: LaTeXC l => l -> l+widetilde = comm1 "widetilde"++-- | Add a dot accent above a symbol, as used to denote a derivative.+dot :: LaTeXC l => l -> l+dot = comm1 "dot"++-- | Add a dot accent above a symbol, as used to denote a second derivative.+ddot :: LaTeXC l => l -> l+ddot = comm1 "ddot"++-- | Add a triple dot accent above a symbol, as used to denote a third derivative.+dddot :: LaTeXC l => l -> l+dddot = comm1 "dddot"++-- | Add a wide line accent above a symbol.+overline :: LaTeXC l => l -> l+overline = comm1 "overline"+ ---- Greek alphabet -- | /α/ symbol.@@ -789,6 +847,14 @@ -- | Infinity symbol. infty :: LaTeXC l => l infty = comm0 "infty"++-- | Dotless letter i. Strictly speaking this is not a part of the AMSMath package, but it is defined here for convenience.+imath :: LaTeXC l => l+imath = comm0 "imath"++-- | Dotless letter j. Strictly speaking this is not a part of the AMSMath package, but it is defined here for convenience.+jmath :: LaTeXC l => l+jmath = comm0 "jmath" ------------------------------------- ------------ Math Fonts -------------
test/Main.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} import Text.LaTeX import Text.LaTeX.Base.Parser@@ -5,8 +6,10 @@ import Test.Tasty import qualified Test.Tasty.QuickCheck as QC +#if !MIN_VERSION_parsec(3,1,9) instance Eq ParseError where _ == _ = undefined+#endif main :: IO () main = defaultMain $ testGroup "HaTeX"