HaTeX 3.17.3.1 → 3.18.0.0
raw patch · 9 files changed
+116/−11 lines, 9 filesdep +semigroupsPVP ok
version bump matches the API change (PVP)
Dependencies added: semigroups
API changes (from Hackage documentation)
+ Text.LaTeX.Base.Class: squareBraces :: LaTeXC l => l -> l
+ Text.LaTeX.Base.Commands: table :: LaTeXC l => Maybe Pos -> l -> l
+ Text.LaTeX.Base.Writer: instance (GHC.Base.Applicative m, Data.Semigroup.Semigroup a) => Data.Semigroup.Semigroup (Text.LaTeX.Base.Writer.LaTeXT m a)
+ Text.LaTeX.Packages.BibLaTeX: addbibresource :: LaTeXC l => FilePath -> l
+ Text.LaTeX.Packages.BibLaTeX: biblatex :: PackageName
+ Text.LaTeX.Packages.BibLaTeX: cite :: LaTeXC l => l -> l
+ Text.LaTeX.Packages.BibLaTeX: printbibliography :: LaTeXC l => l
- Text.LaTeX.Base.Parser: Expect :: ~String -> Message
+ Text.LaTeX.Base.Parser: Expect :: !String -> Message
- Text.LaTeX.Base.Parser: Message :: ~String -> Message
+ Text.LaTeX.Base.Parser: Message :: !String -> Message
- Text.LaTeX.Base.Parser: SysUnExpect :: ~String -> Message
+ Text.LaTeX.Base.Parser: SysUnExpect :: !String -> Message
- Text.LaTeX.Base.Parser: UnExpect :: ~String -> Message
+ Text.LaTeX.Base.Parser: UnExpect :: !String -> Message
- Text.LaTeX.Base.Render: class Show a => Render a where render = fromString . show
+ Text.LaTeX.Base.Render: class Show a => Render a
- Text.LaTeX.Base.Writer: liftIO :: MonadIO m => forall a. IO a -> m a
+ Text.LaTeX.Base.Writer: liftIO :: MonadIO m => forall a. () => IO a -> m a
Files
- CHANGELOG.md +5/−0
- Examples/biblatex.hs +48/−0
- HaTeX.cabal +4/−1
- Text/LaTeX/Base/Class.hs +4/−1
- Text/LaTeX/Base/Commands.hs +18/−3
- Text/LaTeX/Base/Syntax.hs +0/−4
- Text/LaTeX/Base/Writer.hs +5/−1
- Text/LaTeX/Packages/BibLaTeX.hs +31/−0
- license +1/−1
CHANGELOG.md view
@@ -9,6 +9,11 @@ # Changelog by versions +## From 3.17.3.1 to 3.18.0.0++* New bibtex module (leftaroundabout).+* New function squareBraces (NorfairKing).+ ## From 3.17.1.0 to 3.17.2.0 * Semigroup instance for LaTeX.
+ Examples/biblatex.hs view
@@ -0,0 +1,48 @@++{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-}++import Text.LaTeX+import Text.LaTeX.Packages.BibLaTeX+import Text.LaTeX.Packages.Inputenc+import qualified "bibtex" Text.BibTeX.Entry as BibTeX+import qualified "bibtex" Text.BibTeX.Format as BibTeX+import System.IO (writeFile)+import System.Process (callProcess)++main :: IO ()+main = do+ execLaTeXT bibLaTeXExample >>= renderFile "biblatex.tex"+ writeFile bibFile . unlines $ BibTeX.entry <$> exampleBibliography+ mapM_ (`callProcess`["biblatex"]) ["pdflatex", "biber", "pdflatex"]++bibFile = "biblatex-example.bib"++bibLaTeXExample :: Monad m => LaTeXT_ m+bibLaTeXExample = thePreamble >> document theBody++thePreamble :: Monad m => LaTeXT_ m+thePreamble = do+ documentclass [] article+ usepackage [utf8] inputenc+ usepackage ["backend=biber"] biblatex+ addbibresource bibFile+ author "Justus Sageműller"+ title "BibLaTeX example using HaTeX"++theBody :: Monad m => LaTeXT_ m+theBody = do+ "Bib"<>latex<>cite "bibLaTeX-manual"+ " is a package for creating references to literature listed in a Bib"<>tex<>" file"+ " (extension "<>verb".bib"<>")."+ printbibliography++exampleBibliography :: [BibTeX.T]+exampleBibliography =+ [ BibTeX.Cons+ "manual"+ "bibLaTeX-manual"+ [ ("author", "P Lehman and P Kime and A Boruvka and J Wright")+ , ("title", "The biblatex Package. Programmable Bibliographies and Citations.")+ , ("URL", "http://mirrors.ctan.org/macros/latex/contrib/biblatex/doc/biblatex.pdf") ]+ ]
HaTeX.cabal view
@@ -1,5 +1,5 @@ Name: HaTeX -Version: 3.17.3.1 +Version: 3.18.0.0 Author: Daniel Díaz Category: LaTeX Build-type: Simple @@ -74,6 +74,8 @@ , wl-pprint-extras >= 3.5 if impl(ghc < 7.6) build-depends: ghc-prim + if impl(ghc < 8.0) + build-depends: semigroups Exposed-modules: Text.LaTeX -- Base (Core of the library) @@ -95,6 +97,7 @@ Text.LaTeX.Packages.AMSThm Text.LaTeX.Packages.Babel Text.LaTeX.Packages.Beamer + Text.LaTeX.Packages.BibLaTeX Text.LaTeX.Packages.Color Text.LaTeX.Packages.Fancyhdr Text.LaTeX.Packages.Fontenc
Text/LaTeX/Base/Class.hs view
@@ -1,4 +1,3 @@- {-# LANGUAGE CPP #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-} @@ -27,6 +26,7 @@ , comm3 , commS , braces+ , squareBraces ) where import Text.LaTeX.Base.Syntax@@ -111,3 +111,6 @@ -- braces :: LaTeXC l => l -> l braces = liftL TeXBraces++squareBraces :: LaTeXC l => l -> l+squareBraces = liftL $ \l -> TeXRaw "[" <> l <> TeXRaw "]"
Text/LaTeX/Base/Commands.hs view
@@ -169,6 +169,7 @@ , description , minipage , figure+ , table -- ** Page numbering , pagenumbering , arabic@@ -391,13 +392,27 @@ minipage Nothing = liftL2 $ \ts -> TeXEnv "minipage" [ FixArg ts ] minipage (Just p) = liftL2 $ \ts -> TeXEnv "minipage" [ OptArg $ rendertex p , FixArg ts ] --- | Figure environment.+-- | Figure environment. Use this for floating "Text.LaTeX.Packages.Graphicx"+-- content out of the text block and giving it a 'caption'. The figure can be+-- referred to with 'ref' from elsewhere in the document. figure :: LaTeXC l =>- Maybe Pos -- ^ Optional position- -> l -- ^ Figure content+ Maybe Pos -- ^ Optional position.+ -> l -- ^ Figure content (should usually contain+ -- 'Text.LaTeX.Packages.Graphicx.includegraphics',+ -- 'caption' and 'label'). -> l figure Nothing = liftL $ TeXEnv "figure" [] figure (Just p) = liftL $ TeXEnv "figure" [ OptArg $ TeXRaw $ render p ]++-- | Table environment. Use this for floating a 'tabular' out of the text block and+-- giving it a 'caption'. The table can be referred to with 'ref'.+table :: LaTeXC l =>+ Maybe Pos -- ^ Optional position.+ -> l -- ^ Table content (assemble with 'tabular'/'matrixTabular',+ -- 'caption' and 'label').+ -> l+table Nothing = liftL $ TeXEnv "table" []+table (Just p) = liftL $ TeXEnv "table" [ OptArg $ TeXRaw $ render p ] -- | Abstract section. abstract :: LaTeXC l => l -> l
Text/LaTeX/Base/Syntax.hs view
@@ -29,9 +29,7 @@ import Data.Text (Text,pack) import qualified Data.Text import Data.Monoid-#if MIN_VERSION_base(4,9,0) import qualified Data.Semigroup as Semigroup-#endif import Data.String import Control.Applicative import Control.Monad (replicateM)@@ -117,10 +115,8 @@ (<>) = mappend #endif -#if MIN_VERSION_base(4,9,0) instance Semigroup.Semigroup LaTeX where (<>) = mappend-#endif -- | Method 'fromString' escapes LaTeX reserved characters using 'protectString'. instance IsString LaTeX where
Text/LaTeX/Base/Writer.hs view
@@ -60,8 +60,9 @@ import Data.String #if !MIN_VERSION_base(4,8,0) import Data.Monoid-import Control.Applicative #endif+import Control.Applicative+import qualified Data.Semigroup as Semigroup -- transformers import Control.Monad.Trans.Writer import Control.Monad.IO.Class@@ -219,3 +220,6 @@ instance (Monad m, Monoid a) => Monoid (LaTeXT m a) where mempty = return mempty mappend = liftM2 mappend++instance (Applicative m, Semigroup.Semigroup a) => Semigroup.Semigroup (LaTeXT m a) where+ (<>) = liftA2 (Semigroup.<>)
+ Text/LaTeX/Packages/BibLaTeX.hs view
@@ -0,0 +1,31 @@+{-# LANGUAGE OverloadedStrings #-}++-- | <https://ctan.org/tex-archive/macros/latex/contrib/biblatex BibLaTeX>+-- is a reference-citation package using @.bib@ files (BibTeX) but no extra style-files.+--+module Text.LaTeX.Packages.BibLaTeX+ ( biblatex+ , addbibresource+ , cite+ , printbibliography+ ) where++import Text.LaTeX.Base.Syntax+import Text.LaTeX.Base.Class+import Text.LaTeX.Base.Render+import Text.LaTeX.Base.Types+import Text.LaTeX.Base.Commands (cite)++-- | BibLaTeX package. Use it to import it like this:+--+-- > usepackage [] biblatex+biblatex :: PackageName+biblatex = "biblatex"++-- | Use a bibliography file as resource for reference information.+addbibresource :: LaTeXC l => FilePath -> l+addbibresource fp = fromLaTeX $ TeXComm "addbibresource" [FixArg $ TeXRaw $ fromString fp]++printbibliography :: LaTeXC l => l+printbibliography = comm0 "printbibliography"+
license view
@@ -1,4 +1,4 @@-Copyright (c)2013, Daniel Díaz+Copyright (c)2018, Daniel Díaz All rights reserved.