packages feed

HaTeX 3.18.0.0 → 3.19.0.0

raw patch · 8 files changed

+273/−5 lines, 8 filesdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base

API changes (from Hackage documentation)

+ Text.LaTeX.Base.Commands: addvspace :: LaTeXC l => Measure -> l
+ Text.LaTeX.Base.Commands: dotfill :: LaTeXC l => l
+ Text.LaTeX.Base.Commands: hrulefill :: LaTeXC l => l
+ Text.LaTeX.Base.Commands: lnbkspc :: LaTeXC l => Measure -> l
+ Text.LaTeX.Base.Commands: lnbkspc_ :: LaTeXC l => Measure -> l
+ Text.LaTeX.Base.Commands: medskip :: LaTeXC l => l
+ Text.LaTeX.Base.Commands: vspace_ :: LaTeXC l => Measure -> l
+ Text.LaTeX.Base.Warnings: instance Data.Semigroup.Semigroup Text.LaTeX.Base.Warnings.TeXCheck
+ Text.LaTeX.Packages.Bigstrut: bigstrut :: LaTeXC l => l
+ Text.LaTeX.Packages.Bigstrut: bigstrutBottom :: LaTeXC l => l
+ Text.LaTeX.Packages.Bigstrut: bigstrutTop :: LaTeXC l => l
+ Text.LaTeX.Packages.Bigstrut: bigstrutp :: PackageName
+ Text.LaTeX.Packages.Lscape: landscape :: LaTeXC l => l -> l
+ Text.LaTeX.Packages.Lscape: lscape :: PackageName
+ Text.LaTeX.Packages.Lscape: pdftex :: LaTeXC l => l
+ Text.LaTeX.Packages.Multirow: BigStruts :: Int -> BigStrutsCount
+ Text.LaTeX.Packages.Multirow: BigStrutsBottom :: Int -> BigStrutsCount
+ Text.LaTeX.Packages.Multirow: BigStrutsTop :: Int -> BigStrutsCount
+ Text.LaTeX.Packages.Multirow: BigStrutsTopBottom :: Int -> BigStrutsCount
+ Text.LaTeX.Packages.Multirow: data BigStrutsCount
+ Text.LaTeX.Packages.Multirow: instance GHC.Show.Show Text.LaTeX.Packages.Multirow.BigStrutsCount
+ Text.LaTeX.Packages.Multirow: instance Text.LaTeX.Base.Render.Render Text.LaTeX.Packages.Multirow.BigStrutsCount
+ Text.LaTeX.Packages.Multirow: multirow :: LaTeXC l => Maybe Pos -> Double -> Maybe BigStrutsCount -> Measure -> Maybe Measure -> l -> l
+ Text.LaTeX.Packages.Multirow: multirowp :: PackageName
- Text.LaTeX.Base.Commands: stretch :: LaTeXC l => Int -> l
+ Text.LaTeX.Base.Commands: stretch :: LaTeXC l => Double -> l

Files

CHANGELOG.md view
@@ -9,10 +9,20 @@  # Changelog by versions +## From 3.18.0.0 to 3.19.0.0++* Fix build with GHC 8.4.1 (#113) (leftaroundabout).+* Added Multirow, Bigstrut, and Lscape modules (#107, #111) (romildo).+* More spacing and line breaking commands (#108, #110) (romildo).+ ## From 3.17.3.1 to 3.18.0.0 +* _Warning:_ Using 3.18.0.0 is not recommended, since it fails to build with GHC 8.4.1.+  Please, upgrade to 3.19.0.0.+ * New bibtex module (leftaroundabout).-* New function squareBraces (NorfairKing).+* New function 'squareBraces' (NorfairKing).+* New function 'table' (leftaroundabout).  ## From 3.17.1.0 to 3.17.2.0 
+ Examples/multirow.hs view
@@ -0,0 +1,49 @@+{-# LANGUAGE OverloadedStrings #-}++import Text.LaTeX+import Text.LaTeX.Packages.Bigstrut+import Text.LaTeX.Packages.Multirow++main :: IO ()+main = execLaTeXT example >>= renderFile "multirow.tex"++example :: Monad m => LaTeXT_ m+example = do+  documentclass [] article+  usepackage [] multirowp+  usepackage [] bigstrutp+  document exampleBody++minitab :: Monad m => TableSpec -> LaTeXT_ m -> LaTeXT_ m+minitab tableSpec text =+  tabular Nothing [tableSpec] text++exampleBody :: Monad m => LaTeXT_ m+exampleBody = do+  "An example with both multirow and bigstrut"+  par+  tabular Nothing [VerticalLine, CenterColumn, VerticalLine, CenterColumn, VerticalLine] $ do+    hline+    multirow Nothing 4 Nothing (In 1) Nothing "Common g text" &+      "Column g2a" <> lnbk+    mempty & "Column g2b" <> lnbk+    mempty & "Column g2c" <> lnbk+    mempty & "Column g2d" <> lnbk+    hline+    multirow Nothing 3 (Just (BigStruts 6)) (CustomMeasure "*") Nothing "Common g text" &+      ("Column g2a" <> bigstrut) <> lnbk <> cline 2 2+    mempty & ("Column g2b" <> bigstrut) <> lnbk <> cline 2 2+    mempty & ("Column g2c" <> bigstrut) <> lnbk+    hline+    multirow Nothing 4 (Just (BigStruts 8)) (In 1) Nothing "Common g text, but a bit longer." &+      ("Column g2a" <> bigstrut) <> lnbk <> cline 2 2+    mempty & ("Column g2b" <> bigstrut) <> lnbk <> cline 2 2+    mempty & ("Column g2c" <> bigstrut) <> lnbk <> cline 2 2+    mempty & ("Column g2d" <> bigstrut) <> lnbk+    hline+    multirow Nothing 4 Nothing (CustomMeasure "*") Nothing (minitab CenterColumn ("Common " <> lnbk <> "g text")) &+      "Column g2a" <> lnbk+    mempty & "Column g2b" <> lnbk+    mempty & "Column g2c" <> lnbk+    mempty & "Column g2d" <> lnbk+    hline
HaTeX.cabal view
@@ -1,5 +1,5 @@ Name: HaTeX
-Version: 3.18.0.0
+Version: 3.19.0.0
 Author: Daniel Díaz
 Category: LaTeX
 Build-type: Simple
@@ -98,6 +98,7 @@         Text.LaTeX.Packages.Babel
         Text.LaTeX.Packages.Beamer
         Text.LaTeX.Packages.BibLaTeX
+        Text.LaTeX.Packages.Bigstrut
         Text.LaTeX.Packages.Color
         Text.LaTeX.Packages.Fancyhdr
         Text.LaTeX.Packages.Fontenc
@@ -105,8 +106,10 @@         Text.LaTeX.Packages.Graphicx
         Text.LaTeX.Packages.Hyperref
         Text.LaTeX.Packages.LongTable
+        Text.LaTeX.Packages.Lscape
         Text.LaTeX.Packages.LTableX
         Text.LaTeX.Packages.Inputenc
+        Text.LaTeX.Packages.Multirow
         Text.LaTeX.Packages.QRCode
         Text.LaTeX.Packages.Relsize
         Text.LaTeX.Packages.TabularX
Text/LaTeX/Base/Commands.hs view
@@ -103,6 +103,8 @@  , newline  , lnbk  , lnbk_+ , lnbkspc+ , lnbkspc_  , newpage  , cleardoublepage  , clearpage@@ -113,10 +115,15 @@  , hspace  , hspace_  , vspace+ , vspace_+ , addvspace  , hfill  , vfill+ , dotfill+ , hrulefill  , stretch  , smallskip+ , medskip  , bigskip  , baselineskip  , indent@@ -267,6 +274,15 @@ (%:) :: LaTeXC l => l -> Text -> l (%:) l = (l <>) . comment +-- I am not sure this is a worth addition to the namespace. If added, maybe+-- it should be with a different name? Although any name that is slightly+-- longer will make 'eol' not cheaper to type than just @comment ""@, which+-- is already really cheap.++-- | Append a blank comment.+-- eol :: LaTeXC l => l+-- eol = comment ""+ -- | Generate the title. It normally contains the 'title' name -- of your document, the 'author'(s) and 'date'. maketitle :: LaTeXC l => l@@ -307,7 +323,7 @@ par :: LaTeXC l => l par = comm0 "par" --- | Start a new line.+-- | Start a new line. It can be used only in paragraph mode. newline :: LaTeXC l => l newline = comm0 "newline" @@ -635,13 +651,34 @@ markright :: LaTeXC l => l -> l markright = liftL $ \l -> TeXComm "markright" [FixArg l] --- | Start a new line. In a 'tabular', it starts a new row, so use 'newline' instead.+-- | Start a new line. The exactly meaning depends on the context+-- where it is used. In normal running text when it forces a line+-- break it is essentially a shorthand for '\\newline' (does not end+-- horizontal mode or end the paragraph, it just inserts some glue and+-- penalties at that point into the horizontal material so that when+-- the paragraph does end a line break will occur at that point with+-- the short line padded with white space). In alignment environments+-- (like 'tabular'), it starts a new row, so use 'newline' instead to+-- start a new line. lnbk  :: LaTeXC l => l lnbk = fromLaTeX $ TeXLineBreak Nothing False +-- | Like 'lnbk', 'lnbk_' introduces a line break, but preventing a+-- page break. lnbk_ :: LaTeXC l => l lnbk_ = fromLaTeX $ TeXLineBreak Nothing True +-- | Like 'lnbk', introduces a line break. But it has an argument that+-- specifies how much extra vertical space is to be inserted before+-- the next line. This can be a negative amount.+lnbkspc :: LaTeXC l => Measure -> l+lnbkspc extraSpace = fromLaTeX $ TeXLineBreak (Just extraSpace) False++-- | Like 'lnbkspc', 'lnbkspc_' introduces a line break with an extra+-- vertical space, but preventing a page break.+lnbkspc_ :: LaTeXC l => Measure -> l+lnbkspc_ extraSpace = fromLaTeX $ TeXLineBreak (Just extraSpace) True+ hyp :: LaTeXC l => l hyp = fromLaTeX $ TeXCommS "-" @@ -654,9 +691,17 @@ newpage :: LaTeXC l => l newpage = comm0 "newpage" +-- | Request to break the current line at the point of the command+-- stretching the line so that it extends to the right margin. The+-- number must be a number from 0 to 4. The higher the number, the+-- more insistent the request is (0 means it will be easily ignored+-- and 4 means do it anyway). When this line break option is used,+-- LaTeX will try to produce the best line breaks possible. linebreak :: LaTeXC l => l -> l linebreak = liftL $ \l -> TeXComm "linebreak" [OptArg l] +-- | Like 'linebreak', but prevents a like break instead of requesting+-- one. nolinebreak :: LaTeXC l => l -> l nolinebreak = liftL $ \l -> TeXComm "nolinebreak" [OptArg l] @@ -740,12 +785,23 @@ hspace_ :: LaTeXC l => Measure -> l hspace_ m = fromLaTeX $ TeXComm "hspace*" [FixArg $ rendertex m] -stretch :: LaTeXC l => Int -> l+stretch :: LaTeXC l => Double -> l stretch n = fromLaTeX $ TeXComm "stretch" [FixArg $ rendertex n] +-- | Add vertical white space, except at the end of a page. vspace :: LaTeXC l => Measure -> l vspace m = fromLaTeX $ TeXComm "vspace" [FixArg $ rendertex m] +-- | Add vertical white space, even at the end of a page.+vspace_ :: LaTeXC l => Measure -> l+vspace_ m = fromLaTeX $ TeXComm "vspace*" [FixArg $ rendertex m]++-- | Add extra vertical white space. In a sequence of 'addvspace' the+-- length of the final white space is given by the maximum of the+-- individual lengths.+addvspace :: LaTeXC l => Measure -> l+addvspace m = fromLaTeX $ TeXComm "addvspace" [FixArg $ rendertex m]+ -- | Fill out all available horizontal space. hfill :: LaTeXC l => l hfill = comm0 "hfill"@@ -754,6 +810,14 @@ vfill :: LaTeXC l => l vfill = comm0 "vfill" +-- | Fill out all available horizontal space with dots.+dotfill :: LaTeXC l => l+dotfill = comm0 "dotfill"++-- | Fill out all available horizontal space with a line.+hrulefill :: LaTeXC l => l+hrulefill = comm0 "hrulefill"+ protect :: LaTeXC l => l -> l protect l = commS "protect" <> l @@ -880,6 +944,9 @@  smallskip :: LaTeXC l => l smallskip = comm0 "smallskip"++medskip :: LaTeXC l => l+medskip = comm0 "medskip"  bigskip :: LaTeXC l => l bigskip = comm0 "bigskip"
Text/LaTeX/Base/Warnings.hs view
@@ -27,6 +27,7 @@ #if !MIN_VERSION_base(4,8,0) import Data.Monoid #endif+import qualified Data.Semigroup as SG  -- | List of possible warnings. data Warning =@@ -47,6 +48,8 @@ checkFromFunction :: (LaTeX -> [Warning]) -> TeXCheck checkFromFunction = TC +instance SG.Semigroup TeXCheck where+ (<>) = mappend instance Monoid TeXCheck where  mempty = TC $ const []  mappend (TC tc1) (TC tc2) = TC $ uncurry mappend . (tc1 &&& tc2)
+ Text/LaTeX/Packages/Bigstrut.hs view
@@ -0,0 +1,37 @@+{-# LANGUAGE OverloadedStrings #-}++-- | An extension to the standard LaTeX tabular environment that+-- creates struts which (slightly) stretch the table row in which they+-- sit.++module Text.LaTeX.Packages.Bigstrut+ ( bigstrutp+ , bigstrut+ , bigstrutTop+ , bigstrutBottom+ ) where++import Text.LaTeX.Base.Syntax (LaTeX(TeXComm), TeXArg(OptArg))+import Text.LaTeX.Base.Class (LaTeXC, fromLaTeX)+import Text.LaTeX.Base.Types (PackageName)++-- | bigstrut package. Use it to import it like this:+--+-- > usepackage [] bigstrut+bigstrutp :: PackageName+bigstrutp = "bigstrut"++-- | 'bigstrutTop', 'bigstrutBottom' and 'bigstrut' produce a strut (a+-- rule with width 0) which is 'bigstrutjot' (2pt by default) higher,+-- lower, or both than the standard array/tabular strut. Use them in+-- table entries that are adjacent to 'hlines' to leave an extra bit+-- of space++bigstrut :: LaTeXC l => l+bigstrut = fromLaTeX $ TeXComm "bigstrut" []++bigstrutTop :: LaTeXC l => l+bigstrutTop = fromLaTeX $ TeXComm "bigstrut" [OptArg "t"]++bigstrutBottom :: LaTeXC l => l+bigstrutBottom = fromLaTeX $ TeXComm "bigstrut" [OptArg "b"]
+ Text/LaTeX/Packages/Lscape.hs view
@@ -0,0 +1,37 @@+{-# LANGUAGE OverloadedStrings #-}++module Text.LaTeX.Packages.Lscape+ ( -- * lscape package+   lscape+   -- * lscape commands+ , landscape+   -- * Package Options+ , pdftex+ ) where++import Text.LaTeX.Base.Syntax (LaTeX(TeXEnv))+import Text.LaTeX.Base.Class (LaTeXC, liftL)+import Text.LaTeX.Base.Types (PackageName)++-- | lscape package. Use it to import it like this:+--+-- > usepackage [] lscape+lscape :: PackageName+lscape = "lscape"++-- | This package option makes 'lscape' rotate the PDF paper – not+-- just the text on the page – when given the 'pdftex' option.+-- (Naturally, this works only with pdfLaTeX.) The result is that the+-- text is viewable online without the reader having to rotate his/her+-- head 90 degrees. The document still prints normally.+pdftex :: LaTeXC l => l+pdftex = "pdftex"++-- | All text within the 'landscape' environment is rotated through 90+-- degrees. The environment may span several pages. It works well+-- with, and was originally created for, use with 'longtable' to+-- produce long wide tables.+landscape :: LaTeXC l =>+             l           -- ^ Text to be rotated+          -> l           -- ^ Resulting rotated text.+landscape = liftL $ TeXEnv "landscape" []
+ Text/LaTeX/Packages/Multirow.hs view
@@ -0,0 +1,62 @@+{-# LANGUAGE OverloadedStrings #-}++-- | An extension to the standard LaTeX tabular environment which+-- provides a construction for table cells that span more than one row+-- of the table.++module Text.LaTeX.Packages.Multirow+ ( multirowp+ , BigStrutsCount(..)+ , multirow+ ) where++import Data.Monoid ((<>))+import Data.Maybe (catMaybes)+import Text.LaTeX.Base.Syntax (LaTeX(TeXComm), TeXArg(FixArg, OptArg))+import Text.LaTeX.Base.Class (LaTeXC, liftL)+import Text.LaTeX.Base.Types (PackageName, Pos, Measure)+import Text.LaTeX.Base.Render (Render, render, rendertex)++-- | multirow package. Use it to import it like this:+--+-- > usepackage [] multirow+multirowp :: PackageName+multirowp = "multirow"++-- | Type of bigstruts count. It is mainly used if you’ve used the+-- bigstrut package. It is the total number of uses of bigstruts+-- within rows being spanned in a multirow.+data BigStrutsCount+  = BigStruts Int          -- ^ Normal bigstruts+  | BigStrutsTop Int       -- ^ Bigstruts in the top row+  | BigStrutsBottom Int    -- ^ Bigstruts in the bottom row+  | BigStrutsTopBottom Int -- ^ Bigstruts in the top and bottom rows+  deriving (Show)++instance Render BigStrutsCount where+  render (BigStruts n)          = render n+  render (BigStrutsTop n)       = "t" <> render n+  render (BigStrutsBottom n)    = "b" <> render n+  render (BigStrutsTopBottom n) = "tb" <> render n++-- | 'multirow' sets a piece of text in a tabular or similar+-- environment, spanning multiple rows.++multirow :: LaTeXC l =>+            Maybe Pos            -- ^ Optional vertical positioning of the text in the multirow block+         -> Double               -- ^ Number of rows to span+         -> Maybe BigStrutsCount -- ^ Optinal total number of uses of bigstrut within the rows being spanned+         -> Measure              -- ^ Width to which the text is to be set+         -> Maybe Measure        -- ^ Optinal length used to raise or lower the text+         -> l                    -- ^ Actual text of the construct+         -> l+multirow mVPos nrows mBigstruts width mVMove text =+  liftL (\l ->+           TeXComm "multirow" $ catMaybes  [ fmap (OptArg . rendertex) mVPos+                                           , Just (FixArg . rendertex $ nrows)+                                           , fmap (OptArg . rendertex) mBigstruts+                                           , Just (FixArg . rendertex $ width)+                                           , fmap (OptArg . rendertex) mVMove+                                           , Just (FixArg l)+                                           ]+        ) text