HaTeX 3.14.0.0 → 3.15.0.0
raw patch · 10 files changed
+234/−40 lines, 10 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Text.LaTeX.Base.Types: Separator :: LaTeX -> TableSpec
+ Text.LaTeX.Packages.AMSFonts: complexes :: LaTeXC l => l
+ Text.LaTeX.Packages.AMSFonts: integers :: LaTeXC l => l
+ Text.LaTeX.Packages.AMSFonts: naturals :: LaTeXC l => l
+ Text.LaTeX.Packages.AMSFonts: rationals :: LaTeXC l => l
+ Text.LaTeX.Packages.AMSFonts: reals :: LaTeXC l => l
+ Text.LaTeX.Packages.AMSMath: implies :: LaTeXC l => l
+ Text.LaTeX.Packages.AMSMath: qquad :: LaTeXC l => l
+ Text.LaTeX.Packages.AMSMath: quad :: LaTeXC l => l
+ Text.LaTeX.Packages.AMSSymb: amssymb :: ClassName
+ Text.LaTeX.Packages.AMSSymb: checkmark :: LaTeXC l => l
+ Text.LaTeX.Packages.Beamer: Dynamic :: CoverOption
+ Text.LaTeX.Packages.Beamer: HighlyDynamic :: CoverOption
+ Text.LaTeX.Packages.Beamer: Invisible :: CoverOption
+ Text.LaTeX.Packages.Beamer: Opaqueness :: [OverlaySpec] -> Float -> Opaqueness
+ Text.LaTeX.Packages.Beamer: Transparent :: (Maybe Float) -> CoverOption
+ Text.LaTeX.Packages.Beamer: beamercolor :: LaTeXC l => [OverlaySpec] -> l
+ Text.LaTeX.Packages.Beamer: data CoverOption
+ Text.LaTeX.Packages.Beamer: data Opaqueness
+ Text.LaTeX.Packages.Beamer: instance Render CoverOption
+ Text.LaTeX.Packages.Beamer: instance Show CoverOption
+ Text.LaTeX.Packages.Beamer: instance Show Opaqueness
+ Text.LaTeX.Packages.Beamer: invisible :: LaTeXC l => [OverlaySpec] -> l -> l
+ Text.LaTeX.Packages.Beamer: onslide :: LaTeXC l => [OverlaySpec] -> l -> l
+ Text.LaTeX.Packages.Beamer: overprint :: LaTeXC l => l -> l
+ Text.LaTeX.Packages.Beamer: setbeamercovered :: LaTeXC l => [CoverOption] -> l
+ Text.LaTeX.Packages.Beamer: visible :: LaTeXC l => [OverlaySpec] -> l -> l
- Text.LaTeX.Base.Commands: framebox :: LaTeXC l => Maybe Measure -> Maybe Pos -> l -> l
+ Text.LaTeX.Base.Commands: framebox :: LaTeXC l => Maybe Measure -> Maybe HPos -> l -> l
- Text.LaTeX.Base.Commands: makebox :: LaTeXC l => Maybe Measure -> Maybe Pos -> l -> l
+ Text.LaTeX.Base.Commands: makebox :: LaTeXC l => Maybe Measure -> Maybe HPos -> l -> l
- Text.LaTeX.Packages.AMSMath: mp :: LaTeXC l => l -> l -> l
+ Text.LaTeX.Packages.AMSMath: mp :: LaTeXC l => l
- Text.LaTeX.Packages.AMSMath: pm :: LaTeXC l => l -> l -> l
+ Text.LaTeX.Packages.AMSMath: pm :: LaTeXC l => l
Files
- CHANGELOG.md +10/−0
- HaTeX.cabal +4/−3
- README.md +21/−11
- Text/LaTeX/Base/Commands.hs +2/−2
- Text/LaTeX/Base/Render.hs +3/−1
- Text/LaTeX/Base/Types.hs +2/−0
- Text/LaTeX/Packages/AMSFonts.hs +20/−2
- Text/LaTeX/Packages/AMSMath.hs +46/−17
- Text/LaTeX/Packages/AMSSymb.hs +25/−0
- Text/LaTeX/Packages/Beamer.hs +101/−4
CHANGELOG.md view
@@ -9,6 +9,16 @@ # Changelog by versions +## From 3.14.0.0 to 3.15.0.0++* New package implemented: AMSSymb.+* Package beamer further developed.+* Bug fix: [#35](https://github.com/Daniel-Diaz/HaTeX/issues/35).+* Added common numeric sets to AMSSymb.+* Breaking change: AMSMath functions 'pm' and 'mp' changed their+ type from `LaTeXC l => l -> l -> l` to `LaTeXC l => l`.+* Additions to the AMSMath module.+ ## From 3.13.1.0 to 3.14.0.0 * Fixed link in cabal file.
HaTeX.cabal view
@@ -1,13 +1,13 @@ Name: HaTeX -Version: 3.14.0.0 +Version: 3.15.0.0 Author: Daniel Díaz -Category: Text, LaTeX +Category: LaTeX Build-type: Simple License: BSD3 License-file: license Maintainer: Daniel Díaz (dhelta `dot` diaz `at` gmail `dot` com) Bug-reports: https://github.com/Daniel-Diaz/HaTeX/issues -homepage: http://daniel-diaz.github.io/projects/hatex +homepage: http://wrongurl.net/haskell/HaTeX Synopsis: The Haskell LaTeX library. Description: This library implements the LaTeX syntax and provides some useful abstractions. . @@ -88,6 +88,7 @@ -- Packages Text.LaTeX.Packages.AMSFonts Text.LaTeX.Packages.AMSMath + Text.LaTeX.Packages.AMSSymb Text.LaTeX.Packages.AMSThm Text.LaTeX.Packages.Babel Text.LaTeX.Packages.Beamer
README.md view
@@ -1,8 +1,9 @@ # The HaTeX library -HaTeX is a Haskell library that implements the *LaTeX syntax*.+HaTeX is a Haskell library that implements the *LaTeX syntax*, plus some abstractions over it. -Check a list of examples of usage in the [Examples](https://github.com/Daniel-Diaz/HaTeX/tree/master/Examples) directory.+Check a list of usage examples in the [Examples](https://github.com/Daniel-Diaz/HaTeX/tree/master/Examples) directory+of the repository in GitHub. A good starting point may be [simple.hs](https://github.com/Daniel-Diaz/HaTeX/blob/master/Examples/simple.hs). Run any example script executing the ``main`` function. @@ -13,7 +14,7 @@ $ cabal update $ cabal install HaTeX -This will install the latest official release (recommended).+This will download and install the latest official release (recommended). If you want to try a newer version, use _git_ to clone the code contained in this repository. @@ -23,14 +24,11 @@ However, note that the API may be unstable and is subject to any kind of change. In the other hand, this package follows the [_Package Versioning Policy_](http://www.haskell.org/haskellwiki/Package_versioning_policy),-so it is unlikely to suffer from API breakages if you follow it too when importing the library.+so it is unlikely to suffer from API breakages if you follow it too when importing the library (assuming+you are using the version in Hackage). See the [Hackage page of HaTeX](http://hackage.haskell.org/package/HaTeX) to browse older versions. -## Travis automatic build--[](https://travis-ci.org/Daniel-Diaz/HaTeX)- ## HaTeX User's Guide The HaTeX User's Guide lives [here](https://github.com/Daniel-Diaz/hatex-guide)... and is also done in Haskell!@@ -41,9 +39,11 @@ To be sure that you are reading the last version, go to the github repository of the guide and follow instructions to build it. It is fairly easy. +Please note that the user's guide needs to be updated (contributions are more than welcome!).+ ## Community and Contributions -There are many ways to get involved in the HaTeX project.+There are many ways to get involved in the HaTeX project. Use the most comfortable way for you. * Fork the [GitHub repository](https://github.com/Daniel-Diaz/HaTeX). * Report bugs or make suggestions opening a ticket in the [Issue Tracker](https://github.com/Daniel-Diaz/HaTeX/issues).@@ -61,6 +61,16 @@ ## Related projects * [TeX-my-math](https://github.com/leftaroundabout/Symbolic-math-HaTeX): Experimental library to ease the production-of mathematical expressions using HaTeX.-* [haskintex](http://daniel-diaz.github.io/projects/haskintex): Tool to use Haskell and in particular the HaTeX library+of mathematical expressions using HaTeX (_no longer maintained?_).+* [haskintex](http://daniel-diaz.github.io/projects/haskintex): Tool to use Haskell (and, additionaly, the HaTeX library) within a LaTeX file.++## Travis automatic build++Every time code changes in the GitHub repository, an automatic build checks that the library compiles with several+versions of GHC (7.4, 7.6, and 7.8) and that all tests pass. This label indicates the result of the last automatic+build.++[](https://travis-ci.org/Daniel-Diaz/HaTeX)++Currently, automatic builds are only running under Linux. We hope Travis will support other systems in the future.
Text/LaTeX/Base/Commands.hs view
@@ -944,7 +944,7 @@ , FixArg $ TeXRaw $ render w , FixArg t ] -makebox :: LaTeXC l => Maybe Measure -> Maybe Pos -> l -> l+makebox :: LaTeXC l => Maybe Measure -> Maybe HPos -> l -> l makebox Nothing Nothing = liftL $ \t -> TeXComm "makebox" [ FixArg t ] makebox (Just w) Nothing = liftL $ \t -> TeXComm "makebox" [ OptArg $ TeXRaw $ render w , FixArg t ]@@ -954,7 +954,7 @@ , OptArg $ TeXRaw $ render p , FixArg t ] -framebox :: LaTeXC l => Maybe Measure -> Maybe Pos -> l -> l+framebox :: LaTeXC l => Maybe Measure -> Maybe HPos -> l -> l framebox Nothing Nothing = liftL $ \t -> TeXComm "framebox" [ FixArg t ] framebox (Just w) Nothing = liftL $ \t -> TeXComm "framebox" [ OptArg $ TeXRaw $ render w , FixArg t ]
Text/LaTeX/Base/Render.hs view
@@ -140,13 +140,15 @@ render TeXEmpty = mempty instance Render TeXArg where- render (OptArg l) = "[" <> render l <> "]" render (FixArg l) = "{" <> render l <> "}"+ render (OptArg l) = "[" <> render l <> "]" render (MOptArg []) = mempty render (MOptArg ls) = "[" <> renderCommas ls <> "]" render (SymArg l) = "<" <> render l <> ">"+ render (MSymArg []) = mempty render (MSymArg ls) = "<" <> renderCommas ls <> ">" render (ParArg l) = "(" <> render l <> ")"+ render (MParArg []) = mempty render (MParArg ls) = "(" <> renderCommas ls <> ")" -- Other instances
Text/LaTeX/Base/Types.hs view
@@ -68,6 +68,7 @@ | ParColumnBot LaTeX -- ^ Paragraph column with text vertically aligned at the bottom. Requires 'array' package. | VerticalLine -- ^ Vertical line between two columns. | DVerticalLine -- ^ Double vertical line between two columns.+ | Separator LaTeX -- ^ Column separator. Requires 'array' package. deriving Show instance Render TableSpec where@@ -79,3 +80,4 @@ render (ParColumnBot l) = "b" <> render (FixArg l) render VerticalLine = "|" render DVerticalLine = "||"+ render (Separator l) = "@" <> render (FixArg l)
Text/LaTeX/Packages/AMSFonts.hs view
@@ -5,9 +5,10 @@ amsfonts -- * Fonts , mathbb+ -- * Number sets+ , naturals, integers, rationals, reals, complexes ) where -import Text.LaTeX.Base.Syntax import Text.LaTeX.Base.Class import Text.LaTeX.Base.Types @@ -31,4 +32,21 @@ -- -- /Note the use of overloaded strings./ mathbb :: LaTeXC l => l -> l-mathbb = liftL $ \l -> TeXComm "mathbb" [FixArg l]+mathbb = comm1 "mathbb"++-- | Number sets++naturals :: LaTeXC l => l+naturals = mathbb "N"++integers :: LaTeXC l => l+integers = mathbb "Z"++rationals :: LaTeXC l => l+rationals = mathbb "Q"++reals :: LaTeXC l => l+reals = mathbb "R"++complexes :: LaTeXC l => l+complexes = mathbb "C"
Text/LaTeX/Packages/AMSMath.hs view
@@ -44,7 +44,6 @@ , integral , integralFromTo -- ** Operator symbols -- *** Arithmetic- , pm , mp , cdot , times , div_ , frac , (*:) , star@@ -87,7 +86,8 @@ , phiu , chi , psi , psiu , omega , omegau -- ** Other symbols- , to , mapsto+ , pm , mp+ , to , mapsto, implies , forall , exists , dagger, ddagger , infty@@ -103,6 +103,8 @@ , pmatrix , bmatrix , b2matrix , vmatrix , v2matrix+ -- * Math spacing+ , quad, qquad ) where import Text.LaTeX.Base@@ -442,14 +444,6 @@ \l1 l2 -> (l1 <> commS "not") `op` l2 --- | Plus-or-minus operator (±).-pm :: LaTeXC l => l -> l -> l-pm = between $ comm0 "pm"---- | Minus-or-plus operator (∓).-mp :: LaTeXC l => l -> l -> l-mp = between $ comm0 "mp"- -- | Centered-dot operator (⋅). cdot :: LaTeXC l => l -> l -> l cdot = between $ comm0 "cdot"@@ -756,6 +750,14 @@ ---- Other symbols +-- | Plus-or-minus symbol (±).+pm :: LaTeXC l => l+pm = comm0 "pm"++-- | Minus-or-plus symbol (∓).+mp :: LaTeXC l => l+mp = comm0 "mp"+ -- | A right-arrow, →. to :: LaTeXC l => l to = comm0 "to"@@ -764,6 +766,10 @@ mapsto :: LaTeXC l => l mapsto = comm0 "mapsto" +-- | An implication arrow, =⇒.+implies :: LaTeXC l => l+implies = comm0 "implies"+ -- | /For all/ symbol, ∀. forall :: LaTeXC l => l forall = comm0 "forall"@@ -789,32 +795,32 @@ -- | Default math symbol font. mathdefault :: LaTeXC l => l -> l-mathdefault = liftL $ \l -> TeXComm "mathdefault" [FixArg l]+mathdefault = comm1 "mathdefault" -- | Bold face. mathbf :: LaTeXC l => l -> l-mathbf = liftL $ \l -> TeXComm "mathbf" [FixArg l]+mathbf = comm1 "mathbf" -- | Roman, i.e. not-italic math. mathrm :: LaTeXC l => l -> l-mathrm = liftL $ \l -> TeXComm "mathrm" [FixArg l]+mathrm = comm1 "mathrm" -- | Calligraphic math symbols. mathcal :: LaTeXC l => l -> l-mathcal = liftL $ \l -> TeXComm "mathcal" [FixArg l]+mathcal = comm1 "mathcal" -- | Sans-serif math. mathsf :: LaTeXC l => l -> l-mathsf = liftL $ \l -> TeXComm "mathsf" [FixArg l]+mathsf = comm1 "mathsf" -- | Typewriter font. mathtt :: LaTeXC l => l -> l-mathtt = liftL $ \l -> TeXComm "mathtt" [FixArg l]+mathtt = comm1 "mathtt" -- | Italic math. Uses the same glyphs as 'mathdefault', but with spacings -- intended for multi-character symbols rather than juxtaposition of single-character symbols. mathit :: LaTeXC l => l -> l-mathit = liftL $ \l -> TeXComm "mathit" [FixArg l]+mathit = comm1 "mathit" ------------------------------------- ------------- Matrices --------------@@ -902,3 +908,26 @@ -- | Instance defined in "Text.LaTeX.Packages.AMSMath". instance Texy a => Texy [a] where texy = autoSquareBrackets . mconcat . intersperse "," . fmap texy++-------------------------------------+----------- Math Spacing-------------++-- | \quad space equal to the current font size (= 18 mu)+quad :: LaTeXC l => l+quad = comm0 "quad"++-- | \qquad twice of \quad (= 36 mu) +qquad :: LaTeXC l => l+qquad = comm0 "qquad"++{-+ The following commands are pending. Someone needs to find suitable+ names for them.++ \, 3/18 of \quad (= 3 mu)+ \: 4/18 of \quad (= 4 mu)+ \; 5/18 of \quad (= 5 mu)+ \! -3/18 of \quad (= -3 mu)+ \ (space after backslash!) equivalent of space in normal text++-}
+ Text/LaTeX/Packages/AMSSymb.hs view
@@ -0,0 +1,25 @@++-- | Module for the package @amssymb@.+module Text.LaTeX.Packages.AMSSymb+ ( -- * AMSSymb package+ amssymb+ -- * Fonts+ , checkmark+ ) where++import Text.LaTeX.Base.Class+import Text.LaTeX.Base.Types++-- | AMSSymb package.+-- Example:+--+-- > usepackage [] amssymb+amssymb :: ClassName+amssymb = "amssymb"++--++-- | /✔/ symbol.+checkmark :: LaTeXC l => l+checkmark = comm0 "checkmark"+
Text/LaTeX/Packages/Beamer.hs view
@@ -37,6 +37,15 @@ , beameritem , uncover , only+ , onslide+ , visible+ , invisible+ , beamercolor+ , overprint+ -- ** Transparency Effects+ , CoverOption (..)+ , Opaqueness (..)+ , setbeamercovered -- ** Themes , usetheme , Theme (..)@@ -79,16 +88,50 @@ beameritem :: LaTeXC l => [OverlaySpec] -> l beameritem os = fromLaTeX $ TeXComm "item" [ MSymArg $ fmap (TeXRaw . render) os ] --- | With 'uncover', show a piece of text only in the slides you want.+-- | With 'uncover', show a piece of text only in the slides you+-- want. On other slides, the text still occupies space and it is still+-- typeset, but it is not shown or only shown as if transparent. uncover :: LaTeXC l => [OverlaySpec] -> l -> l uncover os = liftL $ \l -> TeXComm "uncover" [ MSymArg $ fmap (TeXRaw . render) os , FixArg l ] --- TODO: What is the difference between 'uncover' and 'only'??---- | Similar to 'uncover'.+-- | With 'only' the text is inserted only into the specified+-- slides. For other slides, the text is simply thrown away (it occupies+-- no space). only :: LaTeXC l => [OverlaySpec] -> l -> l only os = liftL $ \l -> TeXComm "only" [ MSymArg $ fmap (TeXRaw . render) os , FixArg l ] +-- | The behavior of the 'onslide' command depends on whether the+-- optional argument 'text' is given or not. If a 'text' argument is+-- present, 'onslide' (without a ⟨modifier⟩) is mapped to 'uncover'.+onslide :: LaTeXC l => [OverlaySpec] -> l -> l+onslide os = liftL $ \l -> TeXComm "onslide" [ MSymArg $ fmap (TeXRaw . render) os , FixArg l ]++-- | The 'visible' command does almost the same as 'uncover'. The only+-- difference is that if the text is not shown, it is never shown in a+-- transparent way, but rather it is not shown at all. Thus for this+-- command the transparency settings have no effect.+visible :: LaTeXC l => [OverlaySpec] -> l -> l+visible os = liftL $ \l -> TeXComm "visible" [ MSymArg $ fmap (TeXRaw . render) os , FixArg l ]++-- | The 'invisible' is the opposite of 'visible'.+invisible :: LaTeXC l => [OverlaySpec] -> l -> l+invisible os = liftL $ \l -> TeXComm "invisible" [ MSymArg $ fmap (TeXRaw . render) os , FixArg l ]++-- | 'beamercolor' works like 'color', but allows you to specify the slides where+-- the text will be bold.+beamercolor :: LaTeXC l => [OverlaySpec] -> l+beamercolor os = fromLaTeX $ TeXComm "color" [ MSymArg $ fmap (TeXRaw . render) os ]++-- | Inside the 'overprint' environment, use 'onslide' commands to+-- specify different things that should be shown for this environment on+-- different slides. Everything within the environment will be placed in+-- a rectangular area of the specified width. The height and depth of+-- the area are chosen large enough to acoommodate the largest contents+-- of this area.+overprint :: LaTeXC l => l -> l+overprint = liftL $ TeXEnv "overprint" []++ -- | Specifications for beamer functions. data OverlaySpec = OneSlide Int@@ -109,6 +152,60 @@ -> l -- ^ Content of the block -> l -- ^ Result block = liftL2 $ \tit -> TeXEnv "block" [ FixArg tit ]+++-- Transparency Effects --++-- | Options for covering text+data CoverOption =+ Invisible -- ^ Causes covered text to completely disappear+ | Transparent (Maybe Float) -- ^ Causes covered text to be typset in a transparent way+ | Dynamic -- ^ Makes all covered text quite+ -- transparent, but in a dynamic way. The+ -- longer it will take till the text is+ -- uncovered, the stronger the+ -- transparency.+ | HighlyDynamic -- ^ Has the same effect as dynamic, but+ -- the effect is stronger.+ -- | StillCovered [Opaqueness] -- ^ Specifies how to render covered items+ -- -- that have not yet been uncovered.+ -- | AgainCovered [Opaqueness] -- ^ Specifies how to render covered items+ -- -- that have once more been covered, that+ -- -- is, that had been shown before but are+ -- -- now covered again.+ deriving Show++instance Render CoverOption where+ render Invisible = "invisible"+ render (Transparent Nothing) = "transparent"+ render (Transparent (Just op)) = "transparent=" <> render op+ render Dynamic = "dynamic"+ render HighlyDynamic = "highlydynamic"+ -- FIXME+ -- render (StillCovered op) = "still covered=" <> render op+ -- render (AgainCovered op) = "again covered=" <> render op++-- | Percentage of opaqueness for the specified overlays. In+-- 'Opaqueness overlaySpecification percentageOfOpaqueness' the+-- 'overlaySpecification' specifies on which slides covered text should+-- have which 'percentageOfOpaqueness'. Unlike other overlay+-- specifications, this 'overlaySpecification' is a relative overlay+-- specification.+data Opaqueness =+ Opaqueness [OverlaySpec] Float+ deriving Show++-- FIXME+-- instance Render Opaqueness where+-- render (Opaqueness os op) =+-- TeXComm "opaqueness" [ MSymArg $ fmap (TeXRaw . render) os, FixArg $ TeXRaw $ render op]++-- | The command 'setbeamercovered' allows you to specify in a quite+-- general way how a covered item should be rendered.+setbeamercovered :: LaTeXC l => [CoverOption] -> l+setbeamercovered co =+ fromLaTeX $ TeXComm "setbeamercovered" [ FixArg $ TeXRaw $ renderCommas co ]+ -- THEMES --