packages feed

HaTeX 3.1.0 → 3.2

raw patch · 35 files changed

+2576/−1847 lines, 35 filesdep +parsecdep +transformersdep −mtl

Dependencies added: parsec, transformers

Dependencies removed: mtl

Files

Examples/fibs.hs view
@@ -1,34 +1,34 @@-{-# LANGUAGE OverloadedStrings #-}--import Text.LaTeX.Base.Monad--main :: IO ()-main = execLaTeXT example >>= renderFile "Fibs.tex"--example :: Monad m => LaTeXT_ m-example = do- documentclass [] article- document exampleBody--exampleBody :: Monad m => LaTeXT_ m-exampleBody = do- "This is an example of how "- hatex3- " works, printing a table of "- "the thirteen first elements of the "- "Fibonacci sequence."- bigskip- center $ underline $ textbf "Fibonacci table"- center $ tabular Nothing [RightColumn,VerticalLine,LeftColumn] $ do-   textbf "Fibonacci number" & textbf "Value"-   lnbk-   hline-   foldr (\n l -> do fromString (show n) & fromString (show $ fib n)-                     lnbk-                     l ) (return ()) [0..12]--fibs :: [Int]-fibs = 1 : 1 : zipWith (+) fibs (tail fibs)--fib :: Int -> Int-fib = (fibs!!)+{-# LANGUAGE OverloadedStrings #-}
+
+import Text.LaTeX.Base.Monad
+
+main :: IO ()
+main = execLaTeXT example >>= renderFile "Fibs.tex"
+
+example :: Monad m => LaTeXT_ m
+example = do
+ documentclass [] article
+ document exampleBody
+
+exampleBody :: Monad m => LaTeXT_ m
+exampleBody = do
+ "This is an example of how "
+ hatex3
+ " works, printing a table of "
+ "the thirteen first elements of the "
+ "Fibonacci sequence."
+ bigskip
+ center $ underline $ textbf "Fibonacci table"
+ center $ tabular Nothing [RightColumn,VerticalLine,LeftColumn] $ do
+   textbf "Fibonacci number" & textbf "Value"
+   lnbk
+   hline
+   foldr (\n l -> do fromString (show n) & fromString (show $ fib n)
+                     lnbk
+                     l ) (return ()) [0..12]
+
+fibs :: [Int]
+fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
+
+fib :: Int -> Int
+fib = (fibs!!)
HaTeX.cabal view
@@ -1,5 +1,5 @@ Name: HaTeX
-Version: 3.1.0+Version: 3.2
 Author: Daniel Díaz
 Category: Text
 Build-type: Simple
@@ -7,55 +7,64 @@ License-file: license
 Maintainer: Daniel Díaz (danieldiaz <at> dhelta <dot> net)
 Stability: Experimental
-Homepage: http://dhelta.net/hprojects/HaTeX+Homepage: http://dhelta.net/hprojects/HaTeX
 Bug-reports: danieldiaz <at> dhelta <dot> net
 Synopsis: LaTeX code writer.
 Description: HaTeX consists in a set of combinators which allow you to build LaTeX code,
              following the LaTeX syntax in a type-safe manner.
              .
              This allows you to build programs which generates LaTeX code automatically
-             for any purpose you can figure out.+             for any purpose you can figure out.
 Cabal-version: >= 1.6
-Tested-with: GHC == 6.12.3 , GHC == 7.0.3-Extra-source-files:-  ReleaseNotes-  -- Examples-  Examples/fibs.hs--Library+Tested-with: GHC == 6.12.3 , GHC == 7.0.3
+Extra-source-files:
+  ReleaseNotes
+  ReadMe
+  -- Examples
+  Examples/fibs.hs
+
+Source-repository head
+  type: git
+  location: git://github.com/Daniel-Diaz/HaTeX.git
+
+Library
   Build-depends: base ==4.*
                , bytestring
-               , mtl ==2.*
-               , text+               , transformers ==0.2.*
+               , text
+               , parsec >=3.1.2 && <3.2
   GHC-Options: -fno-warn-unrecognised-pragmas
   Exposed-modules:
-    Text.LaTeX+    Text.LaTeX
       Text.LaTeX.Monad
-      Text.LaTeX.Base-        Text.LaTeX.Base.Monad-        Text.LaTeX.Base.Commands-          Text.LaTeX.Base.Commands.Monad-        Text.LaTeX.Base.Parser-        Text.LaTeX.Base.Render-        Text.LaTeX.Base.Syntax-        Text.LaTeX.Base.Types-        Text.LaTeX.Base.Writer-        Text.LaTeX.Base.Warnings-      Text.LaTeX.Packages-        Text.LaTeX.Packages.Monad-        Text.LaTeX.Packages.AMSFonts-          Text.LaTeX.Packages.AMSFonts.Monad-        Text.LaTeX.Packages.AMSMath-          Text.LaTeX.Packages.AMSMath.Monad-        Text.LaTeX.Packages.AMSThm-          Text.LaTeX.Packages.AMSThm.Monad-        Text.LaTeX.Packages.Beamer-          Text.LaTeX.Packages.Beamer.Monad-        Text.LaTeX.Packages.Hyperref-          Text.LaTeX.Packages.Hyperref.Monad-        Text.LaTeX.Packages.Inputenc-          Text.LaTeX.Packages.Inputenc.Monad-        Text.LaTeX.Packages.Color+      Text.LaTeX.Base
+        Text.LaTeX.Base.Monad
+        Text.LaTeX.Base.Commands
+          Text.LaTeX.Base.Commands.Monad
+        Text.LaTeX.Base.Render
+        Text.LaTeX.Base.Parser
+        Text.LaTeX.Base.Syntax
+        Text.LaTeX.Base.Types
+        Text.LaTeX.Base.Writer
+        Text.LaTeX.Base.Warnings
+      Text.LaTeX.Packages
+        Text.LaTeX.Packages.Monad
+        Text.LaTeX.Packages.AMSFonts
+          Text.LaTeX.Packages.AMSFonts.Monad
+        Text.LaTeX.Packages.AMSMath
+          Text.LaTeX.Packages.AMSMath.Monad
+        Text.LaTeX.Packages.AMSThm
+          Text.LaTeX.Packages.AMSThm.Monad
+        Text.LaTeX.Packages.Beamer
+          Text.LaTeX.Packages.Beamer.Monad
+        Text.LaTeX.Packages.Hyperref
+          Text.LaTeX.Packages.Hyperref.Monad
+        Text.LaTeX.Packages.Inputenc
+          Text.LaTeX.Packages.Inputenc.Monad
+        Text.LaTeX.Packages.Color
           Text.LaTeX.Packages.Color.Monad
-  Extensions: GeneralizedNewtypeDeriving-            , OverloadedStrings+        Text.LaTeX.Packages.Graphicx
+          Text.LaTeX.Packages.Graphicx.Monad
+  Extensions: GeneralizedNewtypeDeriving
+            , OverloadedStrings
+            , CPP
+ ReadMe view
@@ -0,0 +1,10 @@+== HaTeX ReadMe ==
+
+HaTeX is the LaTeX syntax implementation done in Haskell.
+
+-- ToDo list
+
+* Add more examples.
+* More testing on the parser.
+* Add more documentation.
+* A more complete AMSMath module.
ReleaseNotes view
@@ -1,39 +1,62 @@ HaTeX Release Notes
 -- From version 3.0.0
-->>> 3.1.0--Highlights:--+ Added warnings (See Text.LaTeX.Base.Warnings).-+ Added an "Examples" directory.-+ Num instance for LaTeX and LaTeXT.-+ New package implemented "AMSThm" (See Text.LaTeX.Packages.AMSThm).--Changes by modules:--** Base modules-* Text.LaTeX.Base.Syntax:--- Added Eq instance to LaTeX and TeXArg.-* Text.LaTeX.Base.Writer:--- Added MonadTrans instance to LaTeXT.--- New functions: execLaTeXTWarn, liftFun, liftOp.-* Text.LaTeX.Base.Types:--- Added Eq instance to Label.-* Text.LaTeX.Base:--- Added Num instance to LaTeX.-* Text.LaTeX.Base.Monad:--- Added Num instance to LaTeXT.-* Text.LaTeX.Base.Commands:--- New function: between.--** Package modules:-* Text.LaTeX.Packages.AMSMath--- New symbols: (=:) , (/=:) , forall-              , dagger, ddagger, in_ , ni-              , (<:) , (<=:)-              , (>:) , (>=:) 
+>>> 3.2
+
+Highlights:
+
++ Parser implemented (New dependency on parsec).
++ Greek alphabet added to AMSMath.
++ New LaTeX package: graphicx.
++ Function 'documentclass' changed.
+
+Other changes:
+
+- Dependency changed from mtl to transformers.
+- New commands: par, textwidth and linewidth.
+- New environment: minipage.
+- Compatibility with GHC 7.4 (with CPP extension).
+- Function 'lift' is now re-exported in Text.LaTeX.Base.Writer module.
+- New function 'renderChars' in the Render module.
+- ReadMe edited, now with ToDo list.
+
+>>> 3.1.1
+
+- Dependency relaxed from 'mtl == 2.*' to 'transformers == 0.2.*'.
+
+>>> 3.1.0
+
+Highlights:
+
++ Added warnings (See Text.LaTeX.Base.Warnings).
++ Added an "Examples" directory.
++ Num instance for LaTeX and LaTeXT.
++ New package implemented "AMSThm" (See Text.LaTeX.Packages.AMSThm).
+
+Changes by modules:
+
+** Base modules
+* Text.LaTeX.Base.Syntax:
+-- Added Eq instance to LaTeX and TeXArg.
+* Text.LaTeX.Base.Writer:
+-- Added MonadTrans instance to LaTeXT.
+-- New functions: execLaTeXTWarn, liftFun, liftOp.
+* Text.LaTeX.Base.Types:
+-- Added Eq instance to Label.
+* Text.LaTeX.Base:
+-- Added Num instance to LaTeX.
+* Text.LaTeX.Base.Monad:
+-- Added Num instance to LaTeXT.
+* Text.LaTeX.Base.Commands:
+-- New function: between.
+
+** Package modules:
+* Text.LaTeX.Packages.AMSMath
+-- New symbols: (=:) , (/=:) , forall
+              , dagger, ddagger, in_ , ni
+              , (<:) , (<=:)
+              , (>:) , (>=:)
+
 >>> 3.0.0
 
-* First release of the third version of HaTeX.+* First release of the third version of HaTeX.
Text/LaTeX.hs view
@@ -1,8 +1,8 @@---- | This module is a re-export of the main modules.---   Importing this will you give access to almost all---   functionality of the library. It is recommended---   to import the @Base@ module and, then, import only+
+-- | This module is a re-export of the main modules.
+--   Importing this will you give access to almost all
+--   functionality of the library. However, it is recommended
+--   to import the @Base@ module and, then, import only
 --   packages you actually need.
 module Text.LaTeX
  ( module Text.LaTeX.Base
@@ -10,4 +10,4 @@    ) where
 
 import Text.LaTeX.Base
-import Text.LaTeX.Packages+import Text.LaTeX.Packages
Text/LaTeX/Base.hs view
@@ -1,43 +1,43 @@--{- |-This module exports those minimal things you need-to work with HaTeX. Those things are:--* The 'LaTeX' datatype.--* The '<>' operator, to append 'LaTeX' values.--* The "Text.LaTeX.Base.Render" module, to render a 'LaTeX' value into 'Text'.--* The "Text.LaTeX.Base.Types" module, which contains several types used by-  other modules.--* The "Text.LaTeX.Base.Commands" module, which exports the LaTeX standard commands-  and environments.--Here is also defined a 'Num' instance for 'LaTeX'.+
+{- |
+This module exports those minimal things you need
+to work with HaTeX. Those things are:
+
+* The 'LaTeX' datatype.
+
+* The '<>' operator, to append 'LaTeX' values.
+
+* The "Text.LaTeX.Base.Render" module, to render a 'LaTeX' value into 'Text'.
+
+* The "Text.LaTeX.Base.Types" module, which contains several types used by
+  other modules.
+
+* The "Text.LaTeX.Base.Commands" module, which exports the LaTeX standard commands
+  and environments.
+
+Here is also defined a 'Num' instance for 'LaTeX'.
 -}
 module Text.LaTeX.Base
  ( LaTeX , (<>)
- , module Text.LaTeX.Base.Render+ , module Text.LaTeX.Base.Render
  , module Text.LaTeX.Base.Types
  , module Text.LaTeX.Base.Commands
    ) where
 
 import Text.LaTeX.Base.Syntax (LaTeX (..),(<>))
-import Text.LaTeX.Base.Render+import Text.LaTeX.Base.Render
 import Text.LaTeX.Base.Types
-import Text.LaTeX.Base.Commands---- Num instance for LaTeX---- | Methods 'abs' and 'signum' are undefined. Don't use them!-instance Num LaTeX where- (+) = TeXOp "+"- (-) = TeXOp "-"- (*) = (<>)- negate = (TeXEmpty -)- fromInteger = TeXRaw . fromString . show- -- Non-defined methods- abs _    = "Cannot use \"abs\" Num method with a LaTeX value."- signum _ = "Cannot use \"signum\" Num method with a LaTeX value."+import Text.LaTeX.Base.Commands
+
+-- Num instance for LaTeX
+
+-- | Methods 'abs' and 'signum' are undefined. Don't use them!
+instance Num LaTeX where
+ (+) = TeXOp "+"
+ (-) = TeXOp "-"
+ (*) = (<>)
+ negate = (TeXEmpty -)
+ fromInteger = TeXRaw . fromString . show
+ -- Non-defined methods
+ abs _    = "Cannot use \"abs\" Num method with a LaTeX value."
+ signum _ = "Cannot use \"signum\" Num method with a LaTeX value."
Text/LaTeX/Base/Commands.hs view
@@ -1,737 +1,810 @@-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_HATEX MakeMonadic #-}---- | LaTeX standard commands and environments.-module Text.LaTeX.Base.Commands- ( -- * Basic functions-   raw , between-   -- * Preamble commands- , title- , author- , date- , institute- , thanks- , documentclass- , usepackage- , linespread-   -- ** Classes-   -- *** Document classes- , article- , proc- , report- , minimal- , book- , slides-   -- *** Class options- , draft- , titlepage- , notitlepage- , onecolumn- , twocolumn- , oneside- , twoside- , landscape- , openright- , openany- , fleqn- , leqno-   -- ** Paper sizes- , a0paper- , a1paper- , a2paper- , a3paper- , a4paper- , a5paper- , a6paper- , b0paper- , b1paper- , b2paper- , b3paper- , b4paper- , b5paper- , b6paper- , letterpaper- , executivepaper- , legalpaper-   -- ** Page styles- , pagestyle- , thispagestyle- , plain- , headings- , empty- , myheadings- , markboth- , markright-   -- * Body commands- , document- , maketitle-   -- ** Document structure- , tableofcontents- , abstract- , appendix-   -- *** Sections- , part- , chapter- , section- , subsection- , subsubsection- , paragraph- , subparagraph-   -- ** Logos & symbols- , today- , tex- , latex- , laTeX2- , laTeXe- , ldots- , vdots- , ddots- -- *** HaTeX specific- , hatex- , hatex3- , hatex_meta- , hatex_version- -- ** Document layout- , newline- , lnbk- , lnbk_- , newpage- , cleardoublepage- , clearpage- , linebreak- , nolinebreak- , pagebreak- , nopagebreak- , hspace- , hspace_- , vspace- , stretch- , smallskip- , bigskip- , indent- , noindent-   -- ** Formatting text- , verbatim-   -- *** Fonts- , textbf- , textit- , texttt- , textrm- , textsf- , textmd- , textup- , textsl- , textsc- , textnormal- , underline- , emph-   -- *** Sizes- , tiny- , scriptsize- , footnotesize- , small- , normalsize- , large- , large2- , large3- , huge- , huge2-   -- ** Environments- , equation- , equation_- , enumerate- , itemize- , item- , flushleft- , flushright- , center- , quote- , verse- , cite- , description-   -- ** Page numbering- , pagenumbering- , arabic- , roman- , roman_- , alph- , alph_-   -- ** Boxes- , mbox- , fbox- , parbox- , framebox- , makebox- , raisebox- , rule-   -- * Cross references- , label- , ref- , pageref-   -- ** Tables- , tabular- , (&)- , hline- , cline- -- ** Others- , footnote- , protect- , hyphenation- , hyp- , qts-   ) where--import Data.String-import Data.Maybe (catMaybes)-import Text.LaTeX.Base.Syntax-import Text.LaTeX.Base.Render-import Text.LaTeX.Base.Types---- | Insert a raw piece of 'Text'.--- This functions doesn't care about @LaTeX@ reserved characters,--- it insert the text just as it is received.-raw :: Text -> LaTeX-raw = TeXRaw---- | Calling 'between' @c l1 l2@ puts @c@ between @l1@ and @l2@ and---   appends them.-between :: LaTeX -> LaTeX -> LaTeX -> LaTeX-between c l1 l2 = l1 <> c <> l2---- | Generate the title. It normally contains the 'title' name--- of your document, the 'author'(s) and 'date'.-maketitle :: LaTeX-maketitle = TeXComm "maketitle" []---- | Set the title of your document.-title :: LaTeX -> LaTeX-title t = TeXComm "title" [FixArg t]---- | Set a date for your document.-date :: LaTeX -> LaTeX-date t = TeXComm "date" [FixArg t]---- | Set the author(s) of the document.-author :: LaTeX -> LaTeX-author t = TeXComm "author" [FixArg t]---- | Set either an institute or an organization--- for the document.-institute :: Maybe LaTeX -> LaTeX -> LaTeX-institute  Nothing l = TeXComm "institute" [FixArg l]-institute (Just s) l = TeXComm "institute" [OptArg s,FixArg l]--thanks :: LaTeX -> LaTeX-thanks x = TeXComm "thanks" [FixArg x]---- | Import a package. First argument is a list of options for--- the package named in the second argument.-usepackage :: [LaTeX] -> String -> LaTeX-usepackage lopt str = TeXComm "usepackage" [MOptArg lopt ,FixArg $ fromString str]---- | The @LaTeX@ logo.-latex :: LaTeX-latex = TeXComm "LaTeX" []---- | Start a new line.-newline :: LaTeX-newline = TeXComm "newline" []--part :: LaTeX -> LaTeX-part p = TeXComm "part" [FixArg p]--chapter :: LaTeX -> LaTeX-chapter c = TeXComm "chapter" [FixArg c]---- | Start a new section with a given title.-section :: LaTeX -> LaTeX-section s = TeXComm "section" [FixArg s]--subsection :: LaTeX -> LaTeX-subsection sub = TeXComm "subsection" [FixArg sub]--subsubsection :: LaTeX -> LaTeX-subsubsection sub = TeXComm "subsubsection" [FixArg sub]--paragraph :: LaTeX -> LaTeX-paragraph p = TeXComm "paragraph" [FixArg p]--subparagraph :: LaTeX -> LaTeX-subparagraph p = TeXComm "subparagraph" [FixArg p]---- | Create the table of contents, automatically generated--- from your 'section's, 'subsection's, and other related stuff.-tableofcontents :: LaTeX-tableofcontents = TeXComm "tableofcontents" []--appendix :: LaTeX-appendix = TeXComm "appendix" []--item :: Maybe LaTeX -> LaTeX-item Nothing    = TeXCommS "item "-item (Just opt) = TeXComm "item" [OptArg opt]--equation :: LaTeX -> LaTeX-equation = TeXEnv "equation" []--equation_ :: LaTeX -> LaTeX-equation_ = TeXEnv "equation*" []--enumerate :: LaTeX -> LaTeX-enumerate = TeXEnv "enumerate" []--itemize :: LaTeX -> LaTeX-itemize = TeXEnv "itemize" []--description :: LaTeX -> LaTeX-description = TeXEnv "description" []--flushleft :: LaTeX -> LaTeX-flushleft = TeXEnv "flushleft" []--flushright :: LaTeX -> LaTeX-flushright = TeXEnv "flushright" []--center :: LaTeX -> LaTeX-center = TeXEnv "center" []--quote :: LaTeX -> LaTeX-quote = TeXEnv "quote" []--verse :: LaTeX -> LaTeX-verse = TeXEnv "verse" []--abstract :: LaTeX -> LaTeX-abstract = TeXEnv "abstract" []--cite :: LaTeX -> LaTeX-cite l = TeXComm "cite" [FixArg l]--documentclass :: [LaTeX] -> LaTeX -> LaTeX-documentclass ls l = TeXComm "documentclass" [MOptArg ls , FixArg l]--article :: LaTeX-article = "article"--proc:: LaTeX-proc = "proc"--minimal:: LaTeX-minimal = "minimal"--report:: LaTeX-report = "report"--book:: LaTeX-book = "book"--slides:: LaTeX-slides = "slides"--a0paper:: LaTeX-a0paper = "a0paper"--a1paper:: LaTeX-a1paper = "a1paper"--a2paper:: LaTeX-a2paper = "a2paper"--a3paper:: LaTeX-a3paper = "a3paper"--a4paper:: LaTeX-a4paper = "a4paper"--a5paper:: LaTeX-a5paper = "a5paper"--a6paper:: LaTeX-a6paper = "a6paper"--b0paper:: LaTeX-b0paper = "b0paper"--b1paper:: LaTeX-b1paper = "b1paper"--b2paper:: LaTeX-b2paper = "b2paper"--b3paper:: LaTeX-b3paper = "b3paper"--b4paper:: LaTeX-b4paper = "b4paper"--b5paper:: LaTeX-b5paper = "b5paper"--b6paper:: LaTeX-b6paper = "b6paper"--letterpaper:: LaTeX-letterpaper = "letterpaper"--executivepaper:: LaTeX-executivepaper = "executivepaper"--legalpaper:: LaTeX-legalpaper = "legalpaper"--draft :: LaTeX-draft = "draft"---- | Typesets displayed formulae left-aligned instead of centred.-fleqn:: LaTeX-fleqn = "fleqn"---- | Places the numbering of formulae on the left hand side instead of the right.-leqno:: LaTeX-leqno = "leqno"--titlepage:: LaTeX-titlepage = "titlepage"--notitlepage:: LaTeX-notitlepage = "notitlepage"--onecolumn:: LaTeX-onecolumn = "onecolumn"--twocolumn:: LaTeX-twocolumn = "twocolumn"--oneside :: LaTeX-oneside = "oneside"--twoside:: LaTeX-twoside = "twoside"---- | Changes the layout of the document to print in landscape mode-landscape:: LaTeX-landscape = "landscape"---- | Makes chapters begin either only on right hand pages-openright:: LaTeX-openright = "openright"---- | Makes chapters begin on the next page available.-openany:: LaTeX-openany = "openany"--document :: LaTeX -> LaTeX-document = TeXEnv "document" []--pagenumbering :: LaTeX -> LaTeX-pagenumbering l = TeXComm "pagenumbering" [FixArg l]---- | Arabic numerals.-arabic :: LaTeX-arabic = "arabic"---- | Lowercase roman numerals.-roman :: LaTeX-roman = "roman"---- | Uppercase roman numerals.-roman_ :: LaTeX-roman_ = "Roman"---- | Lowercase letters.-alph :: LaTeX-alph = "alph"---- | Uppercase letters.-alph_ :: LaTeX-alph_ = "Alph"--pagestyle :: LaTeX -> LaTeX-pagestyle l = TeXComm "pagestyle" [FixArg l]--thispagestyle :: LaTeX -> LaTeX-thispagestyle l  = TeXComm "thispagestyle" [FixArg l]--plain :: LaTeX-plain = "plain"--headings :: LaTeX-headings = "headings"--empty :: LaTeX-empty = "empty"--myheadings :: LaTeX-myheadings = "myheadings"---- | Used in conjunction with 'myheadings' for setting both the left and the right heading.-markboth :: LaTeX -> LaTeX -> LaTeX-markboth l1 l2 = TeXComm "markboth" [FixArg l1,FixArg l2]---- | Used in conjunction with 'myheadings' for setting the right heading.-markright :: LaTeX -> LaTeX-markright l = TeXComm "markright" [FixArg l]---- | Start a new line. In a 'tabular', it starts a new row, so use 'newline' instead.-lnbk  :: LaTeX-lnbk = TeXNewLine False--lnbk_ :: LaTeX-lnbk_ = TeXNewLine True--hyp :: LaTeX-hyp = TeXCommS "-"--cleardoublepage :: LaTeX-cleardoublepage = TeXComm "cleardoublepage" []--clearpage :: LaTeX-clearpage = TeXComm "clearpage" []--newpage :: LaTeX-newpage = TeXComm "newpage" []--linebreak :: LaTeX -> LaTeX-linebreak l = TeXComm "linebreak" [OptArg l]--nolinebreak :: LaTeX -> LaTeX-nolinebreak l = TeXComm "nolinebreak" [OptArg l]--nopagebreak :: LaTeX -> LaTeX-nopagebreak l = TeXComm "nopagebreak" [OptArg l]--pagebreak :: LaTeX -> LaTeX-pagebreak l = TeXComm "pagebreak" [OptArg l]--hyphenation :: LaTeX -> LaTeX-hyphenation l = TeXComm "hyphenation" [FixArg l]--mbox :: LaTeX -> LaTeX-mbox l = TeXComm "mbox" [FixArg l]--fbox :: LaTeX -> LaTeX-fbox l = TeXComm "fbox" [FixArg l]--today :: LaTeX-today = TeXComm "today" []--tex :: LaTeX-tex = TeXComm "TeX" []--laTeX2 :: LaTeX-laTeX2 = TeXComm "LaTeX" []--laTeXe :: LaTeX-laTeXe = TeXComm "LaTeXe" []---- | Horizontal dots.-ldots :: LaTeX-ldots = TeXComm "ldots" []---- | Vertical dots.-vdots :: LaTeX-vdots = TeXComm "vdots" []---- | Diagonal dots.-ddots :: LaTeX-ddots = TeXComm "ddots" []---- | Quotation marks.-qts :: LaTeX -> LaTeX-qts l = raw "``" <> l <> raw "''"--footnote :: LaTeX -> LaTeX-footnote l = TeXComm "footnote" [FixArg l]--linespread :: Float -> LaTeX-linespread f = TeXComm "linespread" [FixArg $ TeXRaw $ render f]--indent :: LaTeX-indent = TeXComm "indent" []--noindent :: LaTeX-noindent = TeXComm "noindent" []--hspace :: Measure -> LaTeX-hspace m = TeXComm "hspace" [FixArg $ TeXRaw $ render m]--hspace_ :: Measure -> LaTeX-hspace_ m = TeXComm "hspace*" [FixArg $ TeXRaw $ render m]--stretch :: Int -> LaTeX-stretch n = TeXComm "stretch" [FixArg $ TeXRaw $ render n]--vspace :: Measure -> LaTeX-vspace m = TeXComm "vspace" [FixArg $ TeXRaw $ render m]--protect :: LaTeX -> LaTeX-protect l = TeXCommS "protect" <> l--verbatim :: LaTeX -> LaTeX-verbatim = TeXEnv "verbatim" []--underline :: LaTeX -> LaTeX-underline l = TeXComm "underline" [FixArg l]--emph :: LaTeX -> LaTeX-emph l = TeXComm "emph" [FixArg l]--textrm :: LaTeX -> LaTeX-textrm l = TeXComm "textrm" [FixArg l]--textsf :: LaTeX -> LaTeX-textsf l = TeXComm "textsf" [FixArg l]--texttt :: LaTeX -> LaTeX-texttt l = TeXComm "texttt" [FixArg l]--textmd :: LaTeX -> LaTeX-textmd l = TeXComm "textmd" [FixArg l]--textbf :: LaTeX -> LaTeX-textbf l = TeXComm "textbf" [FixArg l]--textup :: LaTeX -> LaTeX-textup l = TeXComm "textup" [FixArg l]--textit :: LaTeX -> LaTeX-textit l = TeXComm "textit" [FixArg l]--textsl :: LaTeX -> LaTeX-textsl l = TeXComm "textsl" [FixArg l]--textsc :: LaTeX -> LaTeX-textsc l = TeXComm "textsc" [FixArg l]--textnormal :: LaTeX -> LaTeX-textnormal l = TeXComm "textnormal" [FixArg l]--tiny :: LaTeX -> LaTeX-tiny l = TeXComm "tiny" [FixArg l]--scriptsize :: LaTeX -> LaTeX-scriptsize l = TeXComm "scriptsize" [FixArg l]		--footnotesize :: LaTeX -> LaTeX-footnotesize l = TeXComm "footnotesize" [FixArg l]--small :: LaTeX -> LaTeX-small l = TeXComm "small" [FixArg l]--normalsize :: LaTeX -> LaTeX-normalsize l = TeXComm "normalsize" [FixArg l]--large :: LaTeX -> LaTeX-large l = TeXComm "large" [FixArg l]--large2 :: LaTeX -> LaTeX-large2 l = TeXComm "Large" [FixArg l]--large3 :: LaTeX -> LaTeX-large3 l = TeXComm "LARGE" [FixArg l]--huge :: LaTeX -> LaTeX-huge l = TeXComm "huge" [FixArg l]--huge2 :: LaTeX -> LaTeX-huge2 l = TeXComm "Huge" [FixArg l]--smallskip :: LaTeX-smallskip = TeXComm "smallskip" []--bigskip :: LaTeX-bigskip = TeXComm "bigskip" []---- | The 'tabular' environment can be used to typeset tables with optional horizontal and vertical lines.-tabular :: Maybe Pos   -- ^ This optional parameter can be used to specify the vertical position of the table.-                       -- Defaulted to 'Center'.-        -> [TableSpec] -- ^ Table specification of columns and vertical lines.-        -> LaTeX       -- ^ Table content. See '&', 'lnbk', 'hline' and 'cline'.-        -> LaTeX       -- ^ Resulting table syntax.-tabular Nothing ts  = TeXEnv "tabular" [ FixArg $ TeXRaw $ renderAppend ts ]-tabular (Just p) ts = TeXEnv "tabular" [ OptArg $ TeXRaw $ render p , FixArg $ TeXRaw $ renderAppend ts ]---- | Column separator.-(&) :: LaTeX -> LaTeX -> LaTeX-(&) = TeXOp "&"---- | Horizontal line.-hline :: LaTeX-hline = TeXCommS "hline "---- | @cline i j@ writes a partial horizontal line beginning in column i and ending in column j.-cline :: Int -> Int -> LaTeX-cline i j = TeXComm "cline" [ FixArg $ TeXRaw $ render i <> "-" <> render j ]--parbox :: Maybe Pos -> Measure -> LaTeX -> LaTeX-parbox Nothing w t  = TeXComm "parbox" [ FixArg $ TeXRaw $ render w-                                       , FixArg t]-parbox (Just p) w t = TeXComm "parbox" [ OptArg $ TeXRaw $ render p-                                       , FixArg $ TeXRaw $ render w-                                       , FixArg t]--makebox :: Maybe Measure -> Maybe Pos -> LaTeX -> LaTeX-makebox Nothing Nothing t  = TeXComm "makebox" [ FixArg t]-makebox Nothing (Just p) t  = TeXComm "makebox" [ OptArg $ TeXRaw $ render p, FixArg t]-makebox (Just w) Nothing t  = TeXComm "makebox" [ OptArg $ TeXRaw $ render w, FixArg t]-makebox (Just w) (Just p) t = TeXComm "makebox" [ OptArg $ TeXRaw $ render w-                                                , OptArg $ TeXRaw $ render p-                                                , FixArg t]	--framebox :: Maybe Measure -> Maybe Pos -> LaTeX -> LaTeX-framebox Nothing Nothing t  = TeXComm "framebox" [ FixArg t]-framebox Nothing (Just p) t  = TeXComm "framebox" [ OptArg $ TeXRaw $ render p, FixArg t]-framebox (Just w) Nothing t  = TeXComm "framebox" [ OptArg $ TeXRaw $ render w, FixArg t]-framebox (Just w) (Just p) t = TeXComm "framebox" [ OptArg $ TeXRaw $ render w-                                                  , OptArg $ TeXRaw $ render p-                                                  , FixArg t]--raisebox ::  Measure -> Maybe Measure -> Maybe Measure -> LaTeX -> LaTeX-raisebox l ma mb t = TeXComm "raisebox" $-    [ FixArg $ TeXRaw $ render l ]- ++   fmap (OptArg . TeXRaw . render) (catMaybes [ma,mb])- ++ [ FixArg t ]---- | Produce a simple black box.-rule :: Maybe Measure -- ^ Optional lifting.-     -> Measure       -- ^ Width.-     -> Measure       -- ^ Height.-     -> LaTeX-rule Nothing w h  = TeXComm "rule" [ FixArg $ TeXRaw $ render w-                                   , FixArg $ TeXRaw $ render h ]-rule (Just l) w h = TeXComm "rule" [ OptArg $ TeXRaw $ render l-                                   , FixArg $ TeXRaw $ render w-                                   , FixArg $ TeXRaw $ render h ]---- HaTeX specific symbols---- | Print the HaTeX logo.-hatex :: LaTeX-hatex = "H"-     <> hspace (Ex $ negate 0.3)-     <> textsc "a"-     <> hspace (Ex $ negate 0.3)-     <> tex---- | Print the HaTeX 3 logo.-hatex3 :: LaTeX-hatex3 = hatex <> emph (textbf "3")---- | Print the HaTeX-meta logo.-hatex_meta :: LaTeX-hatex_meta = hatex <> emph (textsc "-meta")---- | Print the HaTeX logo, beside the complete version number.-hatex_version :: LaTeX-hatex_version = hatex3-             <> hspace (Ex $ negate 0.3)-             <> emph ".1.0"--label :: Label -> LaTeX-label l = TeXComm "label" [FixArg $ TeXRaw $ render l]--ref :: Label -> LaTeX-ref l = TeXComm "ref" [FixArg $ TeXRaw $ render l]--pageref :: Label -> LaTeX-pageref l = TeXComm "pageref" [FixArg $ TeXRaw $ render l]+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_HATEX MakeMonadic #-}
+
+-- | LaTeX standard commands and environments.
+module Text.LaTeX.Base.Commands
+ ( -- * Basic functions
+   raw , between
+   -- * Preamble commands
+ , title
+ , author
+ , date
+ , institute
+ , thanks
+ , documentclass
+ , usepackage
+ , linespread
+   -- ** Classes
+   -- *** Document classes
+ , article
+ , proc
+ , report
+ , minimal
+ , book
+ , slides
+   -- *** Class options
+ , ClassOption (..)
+ , customopt
+ , draft
+ , titlepage
+ , notitlepage
+ , onecolumn
+ , twocolumn
+ , oneside
+ , twoside
+ , landscape
+ , openright
+ , openany
+ , fleqn
+ , leqno
+   -- ** Paper sizes
+ , PaperType (..)
+ , a0paper
+ , a1paper
+ , a2paper
+ , a3paper
+ , a4paper
+ , a5paper
+ , a6paper
+ , b0paper
+ , b1paper
+ , b2paper
+ , b3paper
+ , b4paper
+ , b5paper
+ , b6paper
+ , letterpaper
+ , executivepaper
+ , legalpaper
+   -- ** Page styles
+ , pagestyle
+ , thispagestyle
+ , plain
+ , headings
+ , empty
+ , myheadings
+ , markboth
+ , markright
+   -- * Body commands
+ , document
+ , maketitle
+   -- ** Document structure
+ , tableofcontents
+ , abstract
+ , appendix
+   -- *** Sections
+ , part
+ , chapter
+ , section
+ , subsection
+ , subsubsection
+ , paragraph
+ , subparagraph
+   -- ** Logos & symbols
+ , today
+ , tex
+ , latex
+ , laTeX2
+ , laTeXe
+ , ldots
+ , vdots
+ , ddots
+ -- *** HaTeX specific
+ , hatex
+ , hatex3
+ , hatex_meta
+ , hatex_version
+ -- ** Document layout
+ , par
+ , newline
+ , lnbk
+ , lnbk_
+ , newpage
+ , cleardoublepage
+ , clearpage
+ , linebreak
+ , nolinebreak
+ , pagebreak
+ , nopagebreak
+ , hspace
+ , hspace_
+ , vspace
+ , stretch
+ , smallskip
+ , bigskip
+ , indent
+ , noindent
+   -- *** Document measures
+ , textwidth
+ , linewidth
+   -- ** Formatting text
+ , verbatim
+   -- *** Fonts
+ , textbf
+ , textit
+ , texttt
+ , textrm
+ , textsf
+ , textmd
+ , textup
+ , textsl
+ , textsc
+ , textnormal
+ , underline
+ , emph
+   -- *** Sizes
+ , tiny
+ , scriptsize
+ , footnotesize
+ , small
+ , normalsize
+ , large
+ , large2
+ , large3
+ , huge
+ , huge2
+   -- ** Environments
+ , equation
+ , equation_
+ , enumerate
+ , itemize
+ , item
+ , flushleft
+ , flushright
+ , center
+ , quote
+ , verse
+ , cite
+ , description
+ , minipage
+   -- ** Page numbering
+ , pagenumbering
+ , arabic
+ , roman
+ , roman_
+ , alph
+ , alph_
+   -- ** Boxes
+ , mbox
+ , fbox
+ , parbox
+ , framebox
+ , makebox
+ , raisebox
+ , rule
+   -- * Cross references
+ , label
+ , ref
+ , pageref
+   -- ** Tables
+ , tabular
+ , (&)
+ , hline
+ , cline
+ -- ** Others
+ , footnote
+ , protect
+ , hyphenation
+ , hyp
+ , qts
+   ) where
+
+import Data.String
+import Data.Maybe (catMaybes)
+import Data.Text (toLower)
+import Text.LaTeX.Base.Syntax
+import Text.LaTeX.Base.Render
+import Text.LaTeX.Base.Types
+
+-- | Insert a raw piece of 'Text'.
+-- This functions doesn't care about @LaTeX@ reserved characters,
+-- it insert the text just as it is received.
+raw :: Text -> LaTeX
+raw = TeXRaw
+
+-- | Calling 'between' @c l1 l2@ puts @c@ between @l1@ and @l2@ and
+--   appends them.
+between :: LaTeX -> LaTeX -> LaTeX -> LaTeX
+between c l1 l2 = l1 <> c <> l2
+
+-- | Generate the title. It normally contains the 'title' name
+-- of your document, the 'author'(s) and 'date'.
+maketitle :: LaTeX
+maketitle = TeXComm "maketitle" []
+
+-- | Set the title of your document.
+title :: LaTeX -> LaTeX
+title t = TeXComm "title" [FixArg t]
+
+-- | Set a date for your document.
+date :: LaTeX -> LaTeX
+date t = TeXComm "date" [FixArg t]
+
+-- | Set the author(s) of the document.
+author :: LaTeX -> LaTeX
+author t = TeXComm "author" [FixArg t]
+
+-- | Set either an institute or an organization
+-- for the document.
+institute :: Maybe LaTeX -> LaTeX -> LaTeX
+institute  Nothing l = TeXComm "institute" [FixArg l]
+institute (Just s) l = TeXComm "institute" [OptArg s,FixArg l]
+
+thanks :: LaTeX -> LaTeX
+thanks x = TeXComm "thanks" [FixArg x]
+
+-- | Import a package. First argument is a list of options for
+-- the package named in the second argument.
+usepackage :: [LaTeX] -> PackageName -> LaTeX
+usepackage lopt str = TeXComm "usepackage" [MOptArg lopt ,FixArg $ fromString str]
+
+-- | The @LaTeX@ logo.
+latex :: LaTeX
+latex = TeXComm "LaTeX" []
+
+-- | Start a new paragraph
+par :: LaTeX
+par = TeXComm "par" []
+
+-- | Start a new line.
+newline :: LaTeX
+newline = TeXComm "newline" []
+
+part :: LaTeX -> LaTeX
+part p = TeXComm "part" [FixArg p]
+
+chapter :: LaTeX -> LaTeX
+chapter c = TeXComm "chapter" [FixArg c]
+
+-- | Start a new section with a given title.
+section :: LaTeX -> LaTeX
+section s = TeXComm "section" [FixArg s]
+
+subsection :: LaTeX -> LaTeX
+subsection sub = TeXComm "subsection" [FixArg sub]
+
+subsubsection :: LaTeX -> LaTeX
+subsubsection sub = TeXComm "subsubsection" [FixArg sub]
+
+paragraph :: LaTeX -> LaTeX
+paragraph p = TeXComm "paragraph" [FixArg p]
+
+subparagraph :: LaTeX -> LaTeX
+subparagraph p = TeXComm "subparagraph" [FixArg p]
+
+-- | Create the table of contents, automatically generated
+-- from your 'section's, 'subsection's, and other related stuff.
+tableofcontents :: LaTeX
+tableofcontents = TeXComm "tableofcontents" []
+
+appendix :: LaTeX
+appendix = TeXComm "appendix" []
+
+item :: Maybe LaTeX -> LaTeX
+item Nothing    = TeXCommS "item "
+item (Just opt) = TeXComm "item" [OptArg opt]
+
+equation :: LaTeX -> LaTeX
+equation = TeXEnv "equation" []
+
+equation_ :: LaTeX -> LaTeX
+equation_ = TeXEnv "equation*" []
+
+enumerate :: LaTeX -> LaTeX
+enumerate = TeXEnv "enumerate" []
+
+itemize :: LaTeX -> LaTeX
+itemize = TeXEnv "itemize" []
+
+description :: LaTeX -> LaTeX
+description = TeXEnv "description" []
+
+flushleft :: LaTeX -> LaTeX
+flushleft = TeXEnv "flushleft" []
+
+flushright :: LaTeX -> LaTeX
+flushright = TeXEnv "flushright" []
+
+center :: LaTeX -> LaTeX
+center = TeXEnv "center" []
+
+quote :: LaTeX -> LaTeX
+quote = TeXEnv "quote" []
+
+verse :: LaTeX -> LaTeX
+verse = TeXEnv "verse" []
+
+-- | Minipage environments.
+minipage :: Maybe Pos           -- ^ Optional position
+         -> LaTeX               -- ^ Width
+         -> LaTeX               -- ^ Minipage content
+         -> LaTeX
+minipage Nothing  ts = TeXEnv "minipage" [ FixArg ts ]
+minipage (Just p) ts = TeXEnv "minipage" [ OptArg $ TeXRaw $ render p
+                                         , FixArg ts ]
+
+abstract :: LaTeX -> LaTeX
+abstract = TeXEnv "abstract" []
+
+cite :: LaTeX -> LaTeX
+cite l = TeXComm "cite" [FixArg l]
+
+-- Document class
+
+-- | A class option to be passed to the 'documentclass' function.
+data ClassOption =
+   Draft
+ | TitlePage
+ | NoTitlePage
+ | OneColumn
+ | TwoColumn
+ | OneSide
+ | TwoSide
+ | Landscape
+ | OpenRight
+ | OpenAny
+ | Fleqn
+ | Leqno
+ | FontSize Measure
+ | Paper PaperType
+ | CustomOption String
+   deriving Show
+
+instance Render ClassOption where
+ render (FontSize m) = render m
+ render (Paper pt) = toLower (render pt) <> "paper"
+ render (CustomOption str) = fromString str
+ render co = toLower $ fromString $ show co
+
+customopt :: String -> ClassOption
+customopt = CustomOption
+
+instance IsString ClassOption where
+ fromString = customopt
+
+-- | LaTeX available paper types.
+data PaperType =
+   A0 | A1 | A2 | A3 | A4 | A5 | A6
+ | B0 | B1 | B2 | B3 | B4 | B5 | B6
+ | Letter | Executive | Legal
+   deriving Show
+
+instance Render PaperType where
+
+-- | Set the document class. Needed in all documents.
+documentclass :: [ClassOption] -- ^ Class options
+              -> ClassName     -- ^ Class name
+              -> LaTeX 
+documentclass opts cn = TeXComm "documentclass" [MOptArg $ fmap rendertex opts , FixArg $ fromString cn]
+
+article :: ClassName
+article = "article"
+
+proc :: ClassName
+proc = "proc"
+
+minimal :: ClassName
+minimal = "minimal"
+
+report :: ClassName
+report = "report"
+
+book :: ClassName
+book = "book"
+
+slides :: ClassName
+slides = "slides"
+
+a0paper :: ClassOption
+a0paper = Paper A0
+
+a1paper :: ClassOption
+a1paper = Paper A1
+
+a2paper :: ClassOption
+a2paper = Paper A2
+
+a3paper :: ClassOption
+a3paper = Paper A3
+
+a4paper :: ClassOption
+a4paper = Paper A4
+
+a5paper :: ClassOption
+a5paper = Paper A5
+
+a6paper :: ClassOption
+a6paper = Paper A6
+
+b0paper :: ClassOption
+b0paper = Paper B0
+
+b1paper :: ClassOption
+b1paper = Paper B1
+
+b2paper :: ClassOption
+b2paper = Paper B2
+
+b3paper :: ClassOption
+b3paper = Paper B3
+
+b4paper :: ClassOption
+b4paper = Paper B4
+
+b5paper :: ClassOption
+b5paper = Paper B5
+
+b6paper :: ClassOption
+b6paper = Paper B6
+
+letterpaper :: ClassOption
+letterpaper = Paper Letter
+
+executivepaper :: ClassOption
+executivepaper = Paper Executive
+
+legalpaper :: ClassOption
+legalpaper = Paper Legal
+
+draft :: ClassOption
+draft = Draft
+
+-- | Typesets displayed formulae left-aligned instead of centred.
+fleqn :: ClassOption
+fleqn = Fleqn
+
+-- | Places the numbering of formulae on the left hand side instead of the right.
+leqno :: ClassOption
+leqno = Leqno
+
+titlepage :: ClassOption
+titlepage = TitlePage
+
+notitlepage :: ClassOption
+notitlepage = NoTitlePage
+
+onecolumn :: ClassOption
+onecolumn = OneColumn
+
+twocolumn :: ClassOption
+twocolumn = TwoColumn
+
+oneside :: ClassOption
+oneside = OneSide
+
+twoside :: ClassOption
+twoside = TwoSide
+
+-- | Changes the layout of the document to print in landscape mode
+landscape :: ClassOption
+landscape = Landscape
+
+-- | Makes chapters begin either only on right hand pages
+openright :: ClassOption
+openright = OpenRight
+
+-- | Makes chapters begin on the next page available.
+openany :: ClassOption
+openany = OpenAny
+
+document :: LaTeX -> LaTeX
+document = TeXEnv "document" []
+
+pagenumbering :: LaTeX -> LaTeX
+pagenumbering l = TeXComm "pagenumbering" [FixArg l]
+
+-- | Arabic numerals.
+arabic :: LaTeX
+arabic = "arabic"
+
+-- | Lowercase roman numerals.
+roman :: LaTeX
+roman = "roman"
+
+-- | Uppercase roman numerals.
+roman_ :: LaTeX
+roman_ = "Roman"
+
+-- | Lowercase letters.
+alph :: LaTeX
+alph = "alph"
+
+-- | Uppercase letters.
+alph_ :: LaTeX
+alph_ = "Alph"
+
+pagestyle :: LaTeX -> LaTeX
+pagestyle l = TeXComm "pagestyle" [FixArg l]
+
+thispagestyle :: LaTeX -> LaTeX
+thispagestyle l  = TeXComm "thispagestyle" [FixArg l]
+
+plain :: LaTeX
+plain = "plain"
+
+headings :: LaTeX
+headings = "headings"
+
+empty :: LaTeX
+empty = "empty"
+
+myheadings :: LaTeX
+myheadings = "myheadings"
+
+-- | Used in conjunction with 'myheadings' for setting both the left and the right heading.
+markboth :: LaTeX -> LaTeX -> LaTeX
+markboth l1 l2 = TeXComm "markboth" [FixArg l1,FixArg l2]
+
+-- | Used in conjunction with 'myheadings' for setting the right heading.
+markright :: LaTeX -> LaTeX
+markright l = TeXComm "markright" [FixArg l]
+
+-- | Start a new line. In a 'tabular', it starts a new row, so use 'newline' instead.
+lnbk  :: LaTeX
+lnbk = TeXNewLine False
+
+lnbk_ :: LaTeX
+lnbk_ = TeXNewLine True
+
+hyp :: LaTeX
+hyp = TeXCommS "-"
+
+cleardoublepage :: LaTeX
+cleardoublepage = TeXComm "cleardoublepage" []
+
+clearpage :: LaTeX
+clearpage = TeXComm "clearpage" []
+
+newpage :: LaTeX
+newpage = TeXComm "newpage" []
+
+linebreak :: LaTeX -> LaTeX
+linebreak l = TeXComm "linebreak" [OptArg l]
+
+nolinebreak :: LaTeX -> LaTeX
+nolinebreak l = TeXComm "nolinebreak" [OptArg l]
+
+nopagebreak :: LaTeX -> LaTeX
+nopagebreak l = TeXComm "nopagebreak" [OptArg l]
+
+pagebreak :: LaTeX -> LaTeX
+pagebreak l = TeXComm "pagebreak" [OptArg l]
+
+hyphenation :: LaTeX -> LaTeX
+hyphenation l = TeXComm "hyphenation" [FixArg l]
+
+mbox :: LaTeX -> LaTeX
+mbox l = TeXComm "mbox" [FixArg l]
+
+fbox :: LaTeX -> LaTeX
+fbox l = TeXComm "fbox" [FixArg l]
+
+today :: LaTeX
+today = TeXComm "today" []
+
+tex :: LaTeX
+tex = TeXComm "TeX" []
+
+laTeX2 :: LaTeX
+laTeX2 = TeXComm "LaTeX" []
+
+laTeXe :: LaTeX
+laTeXe = TeXComm "LaTeXe" []
+
+-- | Horizontal dots.
+ldots :: LaTeX
+ldots = TeXComm "ldots" []
+
+-- | Vertical dots.
+vdots :: LaTeX
+vdots = TeXComm "vdots" []
+
+-- | Diagonal dots.
+ddots :: LaTeX
+ddots = TeXComm "ddots" []
+
+-- | Quotation marks.
+qts :: LaTeX -> LaTeX
+qts l = raw "``" <> l <> raw "''"
+
+footnote :: LaTeX -> LaTeX
+footnote l = TeXComm "footnote" [FixArg l]
+
+linespread :: Float -> LaTeX
+linespread f = TeXComm "linespread" [FixArg $ TeXRaw $ render f]
+
+indent :: LaTeX
+indent = TeXComm "indent" []
+
+noindent :: LaTeX
+noindent = TeXComm "noindent" []
+
+hspace :: Measure -> LaTeX
+hspace m = TeXComm "hspace" [FixArg $ TeXRaw $ render m]
+
+hspace_ :: Measure -> LaTeX
+hspace_ m = TeXComm "hspace*" [FixArg $ TeXRaw $ render m]
+
+stretch :: Int -> LaTeX
+stretch n = TeXComm "stretch" [FixArg $ TeXRaw $ render n]
+
+vspace :: Measure -> LaTeX
+vspace m = TeXComm "vspace" [FixArg $ TeXRaw $ render m]
+
+protect :: LaTeX -> LaTeX
+protect l = TeXCommS "protect" <> l
+
+textwidth :: LaTeX
+textwidth = TeXComm "textwidth" []
+
+linewidth :: LaTeX
+linewidth = TeXComm "linewidth" []
+
+verbatim :: LaTeX -> LaTeX
+verbatim = TeXEnv "verbatim" []
+
+underline :: LaTeX -> LaTeX
+underline l = TeXComm "underline" [FixArg l]
+
+emph :: LaTeX -> LaTeX
+emph l = TeXComm "emph" [FixArg l]
+
+textrm :: LaTeX -> LaTeX
+textrm l = TeXComm "textrm" [FixArg l]
+
+textsf :: LaTeX -> LaTeX
+textsf l = TeXComm "textsf" [FixArg l]
+
+texttt :: LaTeX -> LaTeX
+texttt l = TeXComm "texttt" [FixArg l]
+
+textmd :: LaTeX -> LaTeX
+textmd l = TeXComm "textmd" [FixArg l]
+
+textbf :: LaTeX -> LaTeX
+textbf l = TeXComm "textbf" [FixArg l]
+
+textup :: LaTeX -> LaTeX
+textup l = TeXComm "textup" [FixArg l]
+
+textit :: LaTeX -> LaTeX
+textit l = TeXComm "textit" [FixArg l]
+
+textsl :: LaTeX -> LaTeX
+textsl l = TeXComm "textsl" [FixArg l]
+
+textsc :: LaTeX -> LaTeX
+textsc l = TeXComm "textsc" [FixArg l]
+
+textnormal :: LaTeX -> LaTeX
+textnormal l = TeXComm "textnormal" [FixArg l]
+
+tiny :: LaTeX -> LaTeX
+tiny l = TeXComm "tiny" [FixArg l]
+
+scriptsize :: LaTeX -> LaTeX
+scriptsize l = TeXComm "scriptsize" [FixArg l]		
+
+footnotesize :: LaTeX -> LaTeX
+footnotesize l = TeXComm "footnotesize" [FixArg l]
+
+small :: LaTeX -> LaTeX
+small l = TeXComm "small" [FixArg l]
+
+normalsize :: LaTeX -> LaTeX
+normalsize l = TeXComm "normalsize" [FixArg l]
+
+large :: LaTeX -> LaTeX
+large l = TeXComm "large" [FixArg l]
+
+large2 :: LaTeX -> LaTeX
+large2 l = TeXComm "Large" [FixArg l]
+
+large3 :: LaTeX -> LaTeX
+large3 l = TeXComm "LARGE" [FixArg l]
+
+huge :: LaTeX -> LaTeX
+huge l = TeXComm "huge" [FixArg l]
+
+huge2 :: LaTeX -> LaTeX
+huge2 l = TeXComm "Huge" [FixArg l]
+
+smallskip :: LaTeX
+smallskip = TeXComm "smallskip" []
+
+bigskip :: LaTeX
+bigskip = TeXComm "bigskip" []
+
+-- | The 'tabular' environment can be used to typeset tables with optional horizontal and vertical lines.
+tabular :: Maybe Pos   -- ^ This optional parameter can be used to specify the vertical position of the table.
+                       -- Defaulted to 'Center'.
+        -> [TableSpec] -- ^ Table specification of columns and vertical lines.
+        -> LaTeX       -- ^ Table content. See '&', 'lnbk', 'hline' and 'cline'.
+        -> LaTeX       -- ^ Resulting table syntax.
+tabular Nothing ts  = TeXEnv "tabular" [ FixArg $ TeXRaw $ renderAppend ts ]
+tabular (Just p) ts = TeXEnv "tabular" [ OptArg $ TeXRaw $ render p , FixArg $ TeXRaw $ renderAppend ts ]
+
+-- | Column separator.
+(&) :: LaTeX -> LaTeX -> LaTeX
+(&) = TeXOp "&"
+
+-- | Horizontal line.
+hline :: LaTeX
+hline = TeXCommS "hline "
+
+-- | @cline i j@ writes a partial horizontal line beginning in column @i@ and ending in column @j@.
+cline :: Int -> Int -> LaTeX
+cline i j = TeXComm "cline" [ FixArg $ TeXRaw $ render i <> "-" <> render j ]
+
+parbox :: Maybe Pos -> Measure -> LaTeX -> LaTeX
+parbox Nothing w t  = TeXComm "parbox" [ FixArg $ TeXRaw $ render w
+                                       , FixArg t]
+parbox (Just p) w t = TeXComm "parbox" [ OptArg $ TeXRaw $ render p
+                                       , FixArg $ TeXRaw $ render w
+                                       , FixArg t]
+
+makebox :: Maybe Measure -> Maybe Pos -> LaTeX -> LaTeX
+makebox Nothing Nothing t  = TeXComm "makebox" [ FixArg t]
+makebox Nothing (Just p) t  = TeXComm "makebox" [ OptArg $ TeXRaw $ render p, FixArg t]
+makebox (Just w) Nothing t  = TeXComm "makebox" [ OptArg $ TeXRaw $ render w, FixArg t]
+makebox (Just w) (Just p) t = TeXComm "makebox" [ OptArg $ TeXRaw $ render w
+                                                , OptArg $ TeXRaw $ render p
+                                                , FixArg t]	
+
+framebox :: Maybe Measure -> Maybe Pos -> LaTeX -> LaTeX
+framebox Nothing Nothing t  = TeXComm "framebox" [ FixArg t]
+framebox Nothing (Just p) t  = TeXComm "framebox" [ OptArg $ TeXRaw $ render p, FixArg t]
+framebox (Just w) Nothing t  = TeXComm "framebox" [ OptArg $ TeXRaw $ render w, FixArg t]
+framebox (Just w) (Just p) t = TeXComm "framebox" [ OptArg $ TeXRaw $ render w
+                                                  , OptArg $ TeXRaw $ render p
+                                                  , FixArg t]
+
+raisebox ::  Measure -> Maybe Measure -> Maybe Measure -> LaTeX -> LaTeX
+raisebox l ma mb t = TeXComm "raisebox" $
+    [ FixArg $ TeXRaw $ render l ]
+ ++   fmap (OptArg . TeXRaw . render) (catMaybes [ma,mb])
+ ++ [ FixArg t ]
+
+-- | Produce a simple black box.
+rule :: Maybe Measure -- ^ Optional lifting.
+     -> Measure       -- ^ Width.
+     -> Measure       -- ^ Height.
+     -> LaTeX
+rule Nothing w h  = TeXComm "rule" [ FixArg $ TeXRaw $ render w
+                                   , FixArg $ TeXRaw $ render h ]
+rule (Just l) w h = TeXComm "rule" [ OptArg $ TeXRaw $ render l
+                                   , FixArg $ TeXRaw $ render w
+                                   , FixArg $ TeXRaw $ render h ]
+
+-- HaTeX specific symbols
+
+-- | Print the HaTeX logo.
+hatex :: LaTeX
+hatex = "H"
+     <> hspace (Ex $ negate 0.3)
+     <> textsc "a"
+     <> hspace (Ex $ negate 0.3)
+     <> tex
+
+-- | Print the HaTeX 3 logo.
+hatex3 :: LaTeX
+hatex3 = hatex <> emph (textbf "3")
+
+-- | Print the HaTeX-meta logo.
+hatex_meta :: LaTeX
+hatex_meta = hatex <> emph (textsc "-meta")
+
+-- | Print the HaTeX logo, beside the complete version number.
+hatex_version :: LaTeX
+hatex_version = hatex3
+             <> hspace (Ex $ negate 0.3)
+             <> emph ".2"
+
+label :: Label -> LaTeX
+label l = TeXComm "label" [FixArg $ TeXRaw $ render l]
+
+ref :: Label -> LaTeX
+ref l = TeXComm "ref" [FixArg $ TeXRaw $ render l]
+
+pageref :: Label -> LaTeX
+pageref l = TeXComm "pageref" [FixArg $ TeXRaw $ render l]
Text/LaTeX/Base/Commands/Monad.hs view
@@ -4,7 +4,7 @@ -- 
 -- /For contributors: This module was automatically generated by HaTeX-meta./
 -- /So, please, don't make any change here directly, because/
--- /this is intended to be generated from/
+-- /this is intended to be generated automatically from/
 -- "Text.LaTeX.Base.Commands" /module via HaTeX-meta,/
 -- /and therefore, changes must to be done in these places./
 
@@ -29,6 +29,8 @@  , book
  , slides
    -- *** Class options
+ , ClassOption (..)
+ , customopt
  , draft
  , titlepage
  , notitlepage
@@ -42,6 +44,7 @@  , fleqn
  , leqno
    -- ** Paper sizes
+ , PaperType (..)
  , a0paper
  , a1paper
  , a2paper
@@ -98,6 +101,7 @@  , hatex_meta
  , hatex_version
  -- ** Document layout
+ , par
  , newline
  , lnbk
  , lnbk_
@@ -116,6 +120,9 @@  , bigskip
  , indent
  , noindent
+   -- *** Document measures
+ , textwidth
+ , linewidth
    -- ** Formatting text
  , verbatim
    -- *** Fonts
@@ -155,6 +162,7 @@  , verse
  , cite
  , description
+ , minipage
    -- ** Page numbering
  , pagenumbering
  , arabic
@@ -191,7 +199,7 @@ import Text.LaTeX.Base.Render
 import Text.LaTeX.Base.Types
 import qualified Text.LaTeX.Base.Commands as App
-import Text.LaTeX.Base.Commands()
+import Text.LaTeX.Base.Commands(ClassOption,PaperType)
 
 {-|
 Insert a raw piece of 'Text'.
@@ -262,7 +270,7 @@ Import a package. First argument is a list of options for
  the package named in the second argument.
 -}
-usepackage ::   (Monad m) => [LaTeXT_ m] -> String -> LaTeXT_ m
+usepackage ::   (Monad m) => [LaTeXT_ m] -> PackageName -> LaTeXT_ m
 usepackage a1 a2
   = do a1 <- mapM extractLaTeX_ a1
        textell ( App.usepackage a1 a2)
@@ -272,6 +280,11 @@ latex ::   (Monad m) => LaTeXT_ m
 latex = do textell ( App.latex)
 
+-- | Start a new paragraph
+
+par ::   (Monad m) => LaTeXT_ m
+par = do textell ( App.par)
+
 -- | Start a new line.
 
 newline ::   (Monad m) => LaTeXT_ m
@@ -399,7 +412,15 @@   = do a1 <- extractLaTeX_ a1
        textell ( App.verse a1)
 
+-- | Minipage environments.
 
+minipage ::   (Monad m) => Maybe Pos -> LaTeXT_ m -> LaTeXT_ m -> LaTeXT_ m
+minipage a1 a2 a3
+  = do a2 <- extractLaTeX_ a2
+       a3 <- extractLaTeX_ a3
+       textell ( App.minipage a1 a2 a3)
+
+
 abstract ::   (Monad m) => LaTeXT_ m -> LaTeXT_ m
 abstract a1
   = do a1 <- extractLaTeX_ a1
@@ -412,156 +433,158 @@        textell ( App.cite a1)
 
 
-documentclass ::   (Monad m) => [LaTeXT_ m] -> LaTeXT_ m -> LaTeXT_ m
-documentclass a1 a2
-  = do a1 <- mapM extractLaTeX_ a1
-       a2 <- extractLaTeX_ a2
-       textell ( App.documentclass a1 a2)
+customopt :: String -> ClassOption
+customopt = App.customopt
 
+-- | Set the document class. Needed in all documents.
 
-article ::   (Monad m) => LaTeXT_ m
-article = do textell ( App.article)
+documentclass ::   (Monad m) => [ClassOption] -> ClassName -> LaTeXT_ m
+documentclass a1 a2 = do textell ( App.documentclass a1 a2)
 
 
-proc ::   (Monad m) => LaTeXT_ m
-proc = do textell ( App.proc)
+article :: ClassName
+article = App.article
 
 
-minimal ::   (Monad m) => LaTeXT_ m
-minimal = do textell ( App.minimal)
+proc :: ClassName
+proc = App.proc
 
 
-report ::   (Monad m) => LaTeXT_ m
-report = do textell ( App.report)
+minimal :: ClassName
+minimal = App.minimal
 
 
-book ::   (Monad m) => LaTeXT_ m
-book = do textell ( App.book)
+report :: ClassName
+report = App.report
 
 
-slides ::   (Monad m) => LaTeXT_ m
-slides = do textell ( App.slides)
+book :: ClassName
+book = App.book
 
 
-a0paper ::   (Monad m) => LaTeXT_ m
-a0paper = do textell ( App.a0paper)
+slides :: ClassName
+slides = App.slides
 
 
-a1paper ::   (Monad m) => LaTeXT_ m
-a1paper = do textell ( App.a1paper)
+a0paper :: ClassOption
+a0paper = App.a0paper
 
 
-a2paper ::   (Monad m) => LaTeXT_ m
-a2paper = do textell ( App.a2paper)
+a1paper :: ClassOption
+a1paper = App.a1paper
 
 
-a3paper ::   (Monad m) => LaTeXT_ m
-a3paper = do textell ( App.a3paper)
+a2paper :: ClassOption
+a2paper = App.a2paper
 
 
-a4paper ::   (Monad m) => LaTeXT_ m
-a4paper = do textell ( App.a4paper)
+a3paper :: ClassOption
+a3paper = App.a3paper
 
 
-a5paper ::   (Monad m) => LaTeXT_ m
-a5paper = do textell ( App.a5paper)
+a4paper :: ClassOption
+a4paper = App.a4paper
 
 
-a6paper ::   (Monad m) => LaTeXT_ m
-a6paper = do textell ( App.a6paper)
+a5paper :: ClassOption
+a5paper = App.a5paper
 
 
-b0paper ::   (Monad m) => LaTeXT_ m
-b0paper = do textell ( App.b0paper)
+a6paper :: ClassOption
+a6paper = App.a6paper
 
 
-b1paper ::   (Monad m) => LaTeXT_ m
-b1paper = do textell ( App.b1paper)
+b0paper :: ClassOption
+b0paper = App.b0paper
 
 
-b2paper ::   (Monad m) => LaTeXT_ m
-b2paper = do textell ( App.b2paper)
+b1paper :: ClassOption
+b1paper = App.b1paper
 
 
-b3paper ::   (Monad m) => LaTeXT_ m
-b3paper = do textell ( App.b3paper)
+b2paper :: ClassOption
+b2paper = App.b2paper
 
 
-b4paper ::   (Monad m) => LaTeXT_ m
-b4paper = do textell ( App.b4paper)
+b3paper :: ClassOption
+b3paper = App.b3paper
 
 
-b5paper ::   (Monad m) => LaTeXT_ m
-b5paper = do textell ( App.b5paper)
+b4paper :: ClassOption
+b4paper = App.b4paper
 
 
-b6paper ::   (Monad m) => LaTeXT_ m
-b6paper = do textell ( App.b6paper)
+b5paper :: ClassOption
+b5paper = App.b5paper
 
 
-letterpaper ::   (Monad m) => LaTeXT_ m
-letterpaper = do textell ( App.letterpaper)
+b6paper :: ClassOption
+b6paper = App.b6paper
 
 
-executivepaper ::   (Monad m) => LaTeXT_ m
-executivepaper = do textell ( App.executivepaper)
+letterpaper :: ClassOption
+letterpaper = App.letterpaper
 
 
-legalpaper ::   (Monad m) => LaTeXT_ m
-legalpaper = do textell ( App.legalpaper)
+executivepaper :: ClassOption
+executivepaper = App.executivepaper
 
 
-draft ::   (Monad m) => LaTeXT_ m
-draft = do textell ( App.draft)
+legalpaper :: ClassOption
+legalpaper = App.legalpaper
 
+
+draft :: ClassOption
+draft = App.draft
+
 -- | Typesets displayed formulae left-aligned instead of centred.
 
-fleqn ::   (Monad m) => LaTeXT_ m
-fleqn = do textell ( App.fleqn)
+fleqn :: ClassOption
+fleqn = App.fleqn
 
 -- | Places the numbering of formulae on the left hand side instead of the right.
 
-leqno ::   (Monad m) => LaTeXT_ m
-leqno = do textell ( App.leqno)
+leqno :: ClassOption
+leqno = App.leqno
 
 
-titlepage ::   (Monad m) => LaTeXT_ m
-titlepage = do textell ( App.titlepage)
+titlepage :: ClassOption
+titlepage = App.titlepage
 
 
-notitlepage ::   (Monad m) => LaTeXT_ m
-notitlepage = do textell ( App.notitlepage)
+notitlepage :: ClassOption
+notitlepage = App.notitlepage
 
 
-onecolumn ::   (Monad m) => LaTeXT_ m
-onecolumn = do textell ( App.onecolumn)
+onecolumn :: ClassOption
+onecolumn = App.onecolumn
 
 
-twocolumn ::   (Monad m) => LaTeXT_ m
-twocolumn = do textell ( App.twocolumn)
+twocolumn :: ClassOption
+twocolumn = App.twocolumn
 
 
-oneside ::   (Monad m) => LaTeXT_ m
-oneside = do textell ( App.oneside)
+oneside :: ClassOption
+oneside = App.oneside
 
 
-twoside ::   (Monad m) => LaTeXT_ m
-twoside = do textell ( App.twoside)
+twoside :: ClassOption
+twoside = App.twoside
 
 -- | Changes the layout of the document to print in landscape mode
 
-landscape ::   (Monad m) => LaTeXT_ m
-landscape = do textell ( App.landscape)
+landscape :: ClassOption
+landscape = App.landscape
 
 -- | Makes chapters begin either only on right hand pages
 
-openright ::   (Monad m) => LaTeXT_ m
-openright = do textell ( App.openright)
+openright :: ClassOption
+openright = App.openright
 
 -- | Makes chapters begin on the next page available.
 
-openany ::   (Monad m) => LaTeXT_ m
-openany = do textell ( App.openany)
+openany :: ClassOption
+openany = App.openany
 
 
 document ::   (Monad m) => LaTeXT_ m -> LaTeXT_ m
@@ -789,6 +812,14 @@        textell ( App.protect a1)
 
 
+textwidth ::   (Monad m) => LaTeXT_ m
+textwidth = do textell ( App.textwidth)
+
+
+linewidth ::   (Monad m) => LaTeXT_ m
+linewidth = do textell ( App.linewidth)
+
+
 verbatim ::   (Monad m) => LaTeXT_ m -> LaTeXT_ m
 verbatim a1
   = do a1 <- extractLaTeX_ a1
@@ -953,7 +984,7 @@ hline ::   (Monad m) => LaTeXT_ m
 hline = do textell ( App.hline)
 
--- | @cline i j@ writes a partial horizontal line beginning in column i and ending in column j.
+-- | @cline i j@ writes a partial horizontal line beginning in column @i@ and ending in column @j@.
 
 cline ::   (Monad m) => Int -> Int -> LaTeXT_ m
 cline a1 a2 = do textell ( App.cline a1 a2)
Text/LaTeX/Base/Monad.hs view
@@ -1,67 +1,67 @@--{- |-This module exports those minimal things you need-to work with HaTeX. Those things are:--* The 'LaTeX' datatype.--* The '<>' operator, to append 'LaTeX' values.--* The "Text.LaTeX.Base.Render" module, to render a 'LaTeX' value into 'Text'.--* The "Text.LaTeX.Base.Types" module, which contains several types used by-  other modules.--* The "Text.LaTeX.Base.Writer" module, needed to run the 'LaTeXT' monad, and-  obtain a result of type 'LaTeX'.--* The "Text.LaTeX.Base.Commands.Monad" module, which exports the LaTeX standard commands-  and environments.--Here is also defined a 'Num' instance for 'LaTeXT'.+
+{- |
+This module exports those minimal things you need
+to work with HaTeX. Those things are:
+
+* The 'LaTeX' datatype.
+
+* The '<>' operator, to append 'LaTeX' values.
+
+* The "Text.LaTeX.Base.Render" module, to render a 'LaTeX' value into 'Text'.
+
+* The "Text.LaTeX.Base.Types" module, which contains several types used by
+  other modules.
+
+* The "Text.LaTeX.Base.Writer" module, needed to run the 'LaTeXT' monad, and
+  obtain a result of type 'LaTeX'.
+
+* The "Text.LaTeX.Base.Commands.Monad" module, which exports the LaTeX standard commands
+  and environments.
+
+Here is also defined a 'Num' instance for 'LaTeXT'.
 -}
 module Text.LaTeX.Base.Monad
  ( LaTeX , (<>)
- , module Text.LaTeX.Base.Render- , module Text.LaTeX.Base.Types+ , module Text.LaTeX.Base.Render
+ , module Text.LaTeX.Base.Types
  , module Text.LaTeX.Base.Writer
  , module Text.LaTeX.Base.Commands.Monad
    ) where
 
 import Text.LaTeX.Base.Syntax (LaTeX,(<>))
-import Text.LaTeX.Base.Render-import Text.LaTeX.Base.Types+import Text.LaTeX.Base.Render
+import Text.LaTeX.Base.Types
 import Text.LaTeX.Base.Writer
-import Text.LaTeX.Base.Commands.Monad--- Import LaTeX Num instance-import Text.LaTeX.Base ()--- Import 'lift' function-import Control.Monad.Trans (lift)---- Num instance for LaTeXT---- Sadly, we need 'Show' and 'Eq' instances for LaTeXT in order--- to do its 'Num' instance.---- | Don't use it! This instance only exists in order to---   define a 'Num' instance to 'LaTeXT'.-instance Show (LaTeXT m a) where- show _   = error "Cannot use \"show\" Show method with a LaTeXT value."---- | Don't use it! This instance only exists in order to---   define a 'Num' instance to 'LaTeXT'.-instance Eq (LaTeXT m a) where- _ == _ = error "Cannot use \"(==)\" Eq method with a LaTeXT value."---- | Be careful when using 'fromInteger' over a 'LaTeXT' value,---   the returned value of the computation is bottom (i.e. 'undefined').---   Methods 'abs' and 'signum' are undefined. Don't use them!-instance Monad m => Num (LaTeXT m a) where- (+) = liftOp (+)- (-) = liftOp (-)- (*) = (>>)- negate = liftFun negate- fromInteger = fromString . show- -- Non-defined methods- abs _    = "Cannot use \"abs\" Num method with a LaTeXT value."- signum _ = "Cannot use \"signum\" Num method with a LaTeXT value."+import Text.LaTeX.Base.Commands.Monad
+-- Import LaTeX Num instance
+import Text.LaTeX.Base ()
+-- Import 'lift' function
+import Control.Monad.Trans.Class (lift)
+
+-- Num instance for LaTeXT
+
+-- Sadly, we need 'Show' and 'Eq' instances for LaTeXT in order
+-- to do its 'Num' instance.
+
+-- | Don't use it! This instance only exists in order to
+--   define a 'Num' instance to 'LaTeXT'.
+instance Show (LaTeXT m a) where
+ show _   = error "Cannot use \"show\" Show method with a LaTeXT value."
+
+-- | Don't use it! This instance only exists in order to
+--   define a 'Num' instance to 'LaTeXT'.
+instance Eq (LaTeXT m a) where
+ _ == _ = error "Cannot use \"(==)\" Eq method with a LaTeXT value."
+
+-- | Be careful when using 'fromInteger' over a 'LaTeXT' value,
+--   the returned value of the computation is bottom (i.e. 'undefined').
+--   Methods 'abs' and 'signum' are undefined. Don't use them!
+instance Monad m => Num (LaTeXT m a) where
+ (+) = liftOp (+)
+ (-) = liftOp (-)
+ (*) = (>>)
+ negate = liftFun negate
+ fromInteger = fromString . show
+ -- Non-defined methods
+ abs _    = "Cannot use \"abs\" Num method with a LaTeXT value."
+ signum _ = "Cannot use \"signum\" Num method with a LaTeXT value."
Text/LaTeX/Base/Parser.hs view
@@ -1,6 +1,105 @@---- | Parser is not yet implemented.
+
+-- | This is the 'LaTeX' parser module.
 module Text.LaTeX.Base.Parser
- (
+ ( parseLaTeX
+ , ParseError (..)
    ) where
 
+import Text.LaTeX.Base.Syntax
+--
+import Text.Parsec
+import Text.Parsec.Text
+--
+import Control.Applicative hiding ((<|>),many)
+import Data.Monoid
+import Data.String
+import Data.Text
+
+p_Comm :: Parser LaTeX
+p_Comm = do
+  char '\\'
+  str <- many1 alphaNum
+  args <- try   (string "{}" >> return [])
+            <|> (many1 p_Arg)
+  return $ TeXComm str args
+
+p_CommS :: Parser LaTeX
+p_CommS = do
+  char '\\'
+  TeXCommS <$> many1 alphaNum
+
+p_Env :: Parser LaTeX
+p_Env = do
+  string "\\begin{"
+  str <- many1 alphaNum
+  char '}'
+  args <- many p_Arg
+  ls <- manyTill p_TeXU $ try $ string $ "\\end{" ++ str ++ "}"
+  return $ TeXEnv str args $ mconcat ls
+
+p_Math :: Parser LaTeX
+p_Math = do
+  char '$'
+  TeXMath . mconcat <$> manyTill p_TeXU (char '$')
+
+p_NewLine :: Parser LaTeX
+p_NewLine = do
+ string "\\\\"
+ fmap TeXNewLine $ (char '*' >> return True) <|> return False
+
+p_RawG :: [Char] -> Parser LaTeX
+p_RawG xs = TeXRaw . fromString <$> manyTill anyChar (lookAhead $ (oneOf xs >> return mempty) <|> p_TeXURaw)
+
+p_Raw :: Parser LaTeX
+p_Raw = p_RawG []
+
+p_RawNC :: Parser LaTeX
+p_RawNC = p_RawG ","
+
+p_TeXU :: Parser LaTeX
+p_TeXU = choice $ try <$> [p_NewLine , p_Math , p_Env , p_Comm , p_CommS , p_Raw]
+
+p_TeXURaw :: Parser LaTeX
+p_TeXURaw = choice $ try <$> [p_NewLine , p_Math , p_Env , p_Comm , p_CommS]
+
+p_TeX :: Parser LaTeX
+p_TeX = mconcat <$> many p_TeXU
+
+p_TeXUNC :: Parser LaTeX
+p_TeXUNC = choice $ try <$> [p_NewLine , p_Math , p_Env , p_Comm , p_CommS , p_RawNC]
+
+p_TeXNC :: Parser LaTeX
+p_TeXNC = mconcat <$> many p_TeXUNC
+
+p_SimpleArg :: (Char,Char) -> (LaTeX -> TeXArg) -> Parser TeXArg
+p_SimpleArg (c1,c2) f = do
+  char c1
+  fmap (f . mconcat) $ manyTill (p_TeXURaw <|> p_RawG [c2]) $ char c2
+
+p_MultiArg :: (Char,Char) -> ([LaTeX] -> TeXArg) -> Parser TeXArg
+p_MultiArg (c1,c2) f = do
+  char c1
+  fmap f $ sepBy1 (mconcat <$> manyTill p_TeXUNC (char c2)) $ char ','
+
+p_Opt :: Parser TeXArg
+p_Opt = p_SimpleArg ('[',']') OptArg
+
+p_MOpt :: Parser TeXArg
+p_MOpt = p_MultiArg ('[',']') MOptArg
+
+p_Fix :: Parser TeXArg
+p_Fix = p_SimpleArg ('{','}') FixArg
+
+p_Sym :: Parser TeXArg
+p_Sym = p_SimpleArg ('<','>') SymArg
+
+p_MSym :: Parser TeXArg
+p_MSym = p_MultiArg ('<','>') MSymArg
+
+p_Arg :: Parser TeXArg
+p_Arg = choice $ try <$> [ p_MOpt , p_MSym , p_Opt , p_Fix , p_Sym ]
+
+-- | Parse a LaTeX expression written in 'Text', to a 'LaTeX' AST.
+--   It returns a 'ParseError' in case of parsing error.
+parseLaTeX :: Text -> Either ParseError LaTeX
+parseLaTeX = parse (p_TeX >>= \l -> eof >> return l) "LaTeX input"
Text/LaTeX/Base/Render.hs view
@@ -8,10 +8,11 @@    -- * Render class
  , Render (..)
  , renderAppend
+ , renderChars
  , renderCommas
  , renderFile
- , rendertex-   -- * Reading files+ , rendertex
+   -- * Reading files
  , readFileTex
    ) where
 
@@ -23,40 +24,45 @@ import Data.Text.Encoding
 import Data.List (intersperse)
 import qualified Data.ByteString as B
---- | Class of values that can be transformed to 'Text'.--- You mainly will use this to obtain the 'Text' output+
+-- | Class of values that can be transformed to 'Text'.
+-- You mainly will use this to obtain the 'Text' output
 -- of a 'LaTeX' value.
 class Show a => Render a where
  render :: a -> Text
  --
  render = fromString . show
-+
 -- | Render every element of a list and append results.
 renderAppend :: Render a => [a] -> Text
 renderAppend = mconcat . fmap render
---- | Render every element of a list and append results,+
+-- | Render every element of a list and append results,
+--   separated the given 'Char'.
+renderChars :: Render a => Char -> [a] -> Text
+renderChars c = mconcat . intersperse (fromString [c]) . fmap render
+
+-- | Render every element of a list and append results,
 --   separated by commas.
 renderCommas :: Render a => [a] -> Text
-renderCommas = mconcat . intersperse "," . fmap render
---- | Use this function to render a 'LaTeX' (or another---   one in the 'Render' class) value directly+renderCommas = renderChars ','
+
+-- | Use this function to render a 'LaTeX' (or another
+--   one in the 'Render' class) value directly
 --   in a file.
 renderFile :: Render a => FilePath -> a -> IO ()
 renderFile f = B.writeFile f . encodeUtf8 . render
---- | If you are going to insert the content of a file--- in your 'LaTeX' data, use this function to ensure--- your encoding is correct.-readFileTex :: FilePath -> IO Text-readFileTex = fmap decodeUtf8 . B.readFile---- | If you can transform a value to 'Text', you can---   insert that 'Text' in your 'LaTeX' code.---   That is what this function does.---+
+-- | If you are going to insert the content of a file
+-- in your 'LaTeX' data, use this function to ensure
+-- your encoding is correct.
+readFileTex :: FilePath -> IO Text
+readFileTex = fmap decodeUtf8 . B.readFile
+
+-- | If you can transform a value to 'Text', you can
+--   insert that 'Text' in your 'LaTeX' code.
+--   That is what this function does.
+--
 -- /Warning: /'rendertex'/ does not escape LaTeX reserver characters./
 rendertex :: Render a => a -> LaTeX
 rendertex = TeXRaw . render
@@ -79,10 +85,10 @@   <> render c
   <> "\\end{"
   <> fromString name
-  <> "}"+  <> "}"
  render (TeXMath l) = "$" <> render l <> "$"
  render (TeXNewLine b) = " \\\\" <> ( if b then "*" else mempty ) <> " "
- render (TeXOp sym l1 l2) = render l1 <> fromString sym <> render l2+ render (TeXOp sym l1 l2) = render l1 <> fromString sym <> render l2
  render (TeXBraces l) = "{" <> render l <> "}"
  render (TeXSeq l1 l2) = render l1 <> render l2
  render TeXEmpty = mempty
Text/LaTeX/Base/Syntax.hs view
@@ -1,13 +1,17 @@ 
--- | LaTeX syntax description in the definition of the 'LaTeX' datatype.---   If you want to add new commands or environments not defined in---   the library, import this module and use 'LaTeX' data constructors. 
+{-# LANGUAGE CPP #-}
+
+-- | LaTeX syntax description in the definition of the 'LaTeX' datatype.
+--   If you want to add new commands or environments not defined in
+--   the library, import this module and use 'LaTeX' data constructors.
 module Text.LaTeX.Base.Syntax
  ( -- * @LaTeX@ datatype
-   LaTeX (..)- , braces
+   LaTeX (..)
  , TeXArg (..)
  , (<>)
+   -- * Utils
+ , braces
+ , comm
    ) where
 
 import Data.Text (Text)
@@ -17,27 +21,23 @@ -- | A 'LaTeX' object represents some expression written in LaTeX.
 data LaTeX =
    TeXRaw Text -- ^ Raw text.
- | TeXComm String [TeXArg] -- ^ Constructor for commands.-                           -- First argument is the name of the command.+ | TeXComm String [TeXArg] -- ^ Constructor for commands.
+                           -- First argument is the name of the command.
                            -- Second, its arguments.
- | TeXCommS String
- | TeXEnv String [TeXArg] LaTeX -- ^ Constructor for environments.-                                -- First argument is the name of the environment.-                                -- Second, its arguments.+ | TeXCommS String -- ^ Constructor for commands with no arguments.
+ | TeXEnv String [TeXArg] LaTeX -- ^ Constructor for environments.
+                                -- First argument is the name of the environment.
+                                -- Second, its arguments.
                                 -- Third, its content.
  | TeXMath LaTeX -- ^ Mathematical expressions.
  | TeXNewLine Bool -- ^ Newline character.
- | TeXOp String LaTeX LaTeX -- ^ Operators.+ | TeXOp String LaTeX LaTeX -- ^ Operators.
  | TeXBraces LaTeX -- A expression between braces.
- | TeXSeq LaTeX LaTeX -- ^ Sequencing of 'LaTeX' expressions.+ | TeXSeq LaTeX LaTeX -- ^ Sequencing of 'LaTeX' expressions.
                       -- Use '<>' preferably.
- | TeXEmpty -- ^ An empty expression.+ | TeXEmpty -- ^ An empty expression.
             -- Neutral element of '<>'.
-   deriving (Eq,Show)---- | Alias for 'TeXBraces'.-braces :: LaTeX -> LaTeX-braces = TeXBraces
+   deriving (Eq,Show)
 
 -- | An argument for a 'LaTeX' command or environment.
 data TeXArg =
@@ -50,21 +50,25 @@ 
 -- Monoid instance for 'LaTeX'.
 
--- | 'mappend' is strict in its first argument.
+-- | Method 'mappend' is strict in both arguments (except in the case when the first argument is 'TeXEmpty').
 instance Monoid LaTeX where
  mempty = TeXEmpty
  mappend TeXEmpty x = x
  mappend x TeXEmpty = x
  mappend x y = TeXSeq x y
 
+-- Since GHC starting from 7.4 provides (<>) as synonym to 'mappend',
+-- we avoid an overlapping definition with a CPP conditional.
+#if GHC_VERSION < 704
 -- | Alias for 'mappend'.
 (<>) :: Monoid a => a -> a -> a
 (<>) = mappend
-+#endif
+
 -- | 'fromString' escapes LaTeX reserved characters.
 instance IsString LaTeX where
  fromString = TeXRaw . fromString . protectString
-+
 -- | Escape LaTeX reserved characters in a 'String'.
 protectString :: String -> String
 protectString = mconcat . fmap protectChar
@@ -78,6 +82,17 @@ protectChar '{'  = "\\{"
 protectChar '}'  = "\\}"
 protectChar '~'  = "\\~{}"
-protectChar '\\' = "\\textbackslash{}"+protectChar '\\' = "\\textbackslash{}"
 protectChar '_'  = "\\_{}"
-protectChar x = [x]+protectChar x = [x]
+
+---- UTILS
+
+-- | Alias for 'TeXBraces'.
+braces :: LaTeX -> LaTeX
+braces = TeXBraces
+
+-- | A simple (without arguments) command generator,
+--   given the name of the command.
+comm :: String -> LaTeX
+comm str = TeXComm str []
Text/LaTeX/Base/Types.hs view
@@ -1,75 +1,81 @@--{-# LANGUAGE OverloadedStrings #-}--module Text.LaTeX.Base.Types (-   Label- , createLabel , labelName- , Pos (..)- , TableSpec (..)- , Measure (..)- ) where--import Text.LaTeX.Base.Syntax-import Text.LaTeX.Base.Render--newtype Label = Label String deriving (Eq, Show)--createLabel :: String -> Label-createLabel = Label--labelName :: Label -> String-labelName (Label str) = str--instance Render Label where- render (Label str) = fromString str--instance IsString Label where- fromString = createLabel--data Pos = Bottom | Center | Top deriving Show--instance Render Pos where- render Bottom = "b"- render Center = "c"- render Top    = "t"--data TableSpec =-   LeftColumn         -- ^ Left-justified column.- | CenterColumn       -- ^ Centered column.- | RightColumn        -- ^ Right-justified column.- | ParColumnTop LaTeX -- ^ Paragraph column with text vertically aligned at the top.- | ParColumnMid LaTeX -- ^ Paragraph column with text vertically aligned at the middle. Requires 'array' package.- | 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.-   deriving Show--instance Render TableSpec where- render LeftColumn       = "l"- render CenterColumn     = "c"- render RightColumn      = "r"- render (ParColumnTop l) = "p" <> render (FixArg l)- render (ParColumnMid l) = "m" <> render (FixArg l)- render (ParColumnBot l) = "b" <> render (FixArg l)- render VerticalLine     = "|"- render DVerticalLine    = "||"--data Measure =-   Pt Int   -- ^ A point is 1/72.27 inch, that means about 0.0138 inch or 0.3515 mm.- | Mm Float -- ^ Millimeter.- | Cm Float -- ^ Centimeter.- | In Float -- ^ Inch.- | Ex Float -- ^ The height of an \"x\" in the current font.- | Em Float -- ^ The width of an \"M\" in the current font.- | CustomMeasure LaTeX -- ^ You can introduce a 'LaTeX' expression as a measure.-   deriving Show--instance Render Measure where- render (Pt x) = render x <> "pt"- render (Mm x) = render x <> "mm"- render (Cm x) = render x <> "cm"- render (In x) = render x <> "in"- render (Ex x) = render x <> "ex"- render (Em x) = render x <> "em"+
+{-# LANGUAGE OverloadedStrings #-}
+
+module Text.LaTeX.Base.Types (
+   ClassName
+ , PackageName
+ , Label
+ , createLabel , labelName
+ , Pos (..)
+ , TableSpec (..)
+ , Measure (..)
+ ) where
+
+import Text.LaTeX.Base.Syntax
+import Text.LaTeX.Base.Render
+
+-- | Class names are represented by a 'String'.
+type ClassName = String
+
+type PackageName = String
+
+newtype Label = Label String deriving (Eq, Show)
+
+createLabel :: String -> Label
+createLabel = Label
+
+labelName :: Label -> String
+labelName (Label str) = str
+
+instance Render Label where
+ render (Label str) = fromString str
+
+instance IsString Label where
+ fromString = createLabel
+
+data Pos = Bottom | Center | Top deriving Show
+
+instance Render Pos where
+ render Bottom = "b"
+ render Center = "c"
+ render Top    = "t"
+
+data TableSpec =
+   LeftColumn         -- ^ Left-justified column.
+ | CenterColumn       -- ^ Centered column.
+ | RightColumn        -- ^ Right-justified column.
+ | ParColumnTop LaTeX -- ^ Paragraph column with text vertically aligned at the top.
+ | ParColumnMid LaTeX -- ^ Paragraph column with text vertically aligned at the middle. Requires 'array' package.
+ | 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.
+   deriving Show
+
+instance Render TableSpec where
+ render LeftColumn       = "l"
+ render CenterColumn     = "c"
+ render RightColumn      = "r"
+ render (ParColumnTop l) = "p" <> render (FixArg l)
+ render (ParColumnMid l) = "m" <> render (FixArg l)
+ render (ParColumnBot l) = "b" <> render (FixArg l)
+ render VerticalLine     = "|"
+ render DVerticalLine    = "||"
+
+data Measure =
+   Pt Int   -- ^ A point is 1/72.27 inch, that means about 0.0138 inch or 0.3515 mm.
+ | Mm Float -- ^ Millimeter.
+ | Cm Float -- ^ Centimeter.
+ | In Float -- ^ Inch.
+ | Ex Float -- ^ The height of an \"x\" in the current font.
+ | Em Float -- ^ The width of an \"M\" in the current font.
+ | CustomMeasure LaTeX -- ^ You can introduce a 'LaTeX' expression as a measure.
+   deriving Show
+
+instance Render Measure where
+ render (Pt x) = render x <> "pt"
+ render (Mm x) = render x <> "mm"
+ render (Cm x) = render x <> "cm"
+ render (In x) = render x <> "in"
+ render (Ex x) = render x <> "ex"
+ render (Em x) = render x <> "em"
  render (CustomMeasure x) = render x-
Text/LaTeX/Base/Warnings.hs view
@@ -1,141 +1,146 @@--{-# LANGUAGE OverloadedStrings #-}--module Text.LaTeX.Base.Warnings (-   -- * Warnings datatype-   Warning (..)- , TeXCheck- , check- , checkFromFunction-   -- * Several checkings- , checkLabels- , checkClass- , checkDoc-   -- * Complete checking- , checkAll- ) where--import Text.LaTeX.Base.Syntax-import Control.Monad.State-import Data.Text-import Data.Maybe-import Control.Arrow-import Data.Monoid---- | List of possible warnings.-data Warning =-   UnusedLabel Text    -- ^ There is an unused label. Argument is its name.- | UndefinedLabel Text -- ^ There is a reference to an undefined label. Arguments is the name.-   --- | NoClassSelected     -- ^ No class selected with 'documentclass'.- | NoDocumentInserted  -- ^ No 'document' inserted.-   --- | CustomWarning Text  -- ^ Custom warning for custom checkings. Use it as you want.-   deriving (Eq,Show)---- | A 'TeXCheck' is a function that checks possible warnings from a 'LaTeX' value.---   Use the 'Monoid' instance to combine check functions.-newtype TeXCheck = TC { check :: LaTeX -> [Warning] -- ^ Apply a checking.-                      }--- | Build a 'TeXCheck' from a function.-checkFromFunction :: (LaTeX -> [Warning]) -> TeXCheck-checkFromFunction = TC--instance Monoid TeXCheck where- mempty = TC $ const []- mappend (TC tc1) (TC tc2) = TC $ uncurry mappend . (tc1 &&& tc2)--checkAll :: TeXCheck-checkAll = mconcat [ checkLabels , checkClass , checkDoc ]---- Searching for 'documentclass' and 'document'--type BoolSt = State Bool---- | Check if a document class is specified for the document (using 'documentclass').-checkClass :: TeXCheck-checkClass = TC $ \l -> if execState (classcheck l) False then [] else [NoClassSelected]--classcheck :: LaTeX -> BoolSt ()-classcheck (TeXComm c _) =- case c of-  "documentclass" -> put True-  _ -> return ()-classcheck (TeXBraces l) = classcheck l-classcheck (TeXSeq l1 l2) = classcheck l1 >> classcheck l2-classcheck _ = return ()---- | Check if the 'document' environment is called in a 'LaTeX'.-checkDoc :: TeXCheck-checkDoc = TC $ \l -> if execState (doccheck l) False then [] else [NoDocumentInserted]--doccheck :: LaTeX -> BoolSt ()-doccheck (TeXEnv n _ _) =- case n of-  "document" -> put True-  _ -> return ()-doccheck (TeXBraces l) = doccheck l-doccheck (TeXSeq l1 l2) = doccheck l1 >> doccheck l2-doccheck _ = return ()---- Checking labels--data LabWarn =-   RefNoLabel Text- | LabelNoRef Text- | LabelRef Text--labWarnToWarning :: LabWarn -> Maybe Warning-labWarnToWarning (RefNoLabel n) = Just $ UndefinedLabel n-labWarnToWarning (LabelNoRef n) = Just $ UnusedLabel n-labWarnToWarning _ = Nothing--type LabSt = State [LabWarn]---- | Checking for unused labels or references tu undefined labels.-checkLabels :: TeXCheck-checkLabels = TC $ \l -> catMaybes . fmap labWarnToWarning $ execState (labcheck l) []--labcheck :: LaTeX -> LabSt ()-labcheck (TeXComm c [FixArg (TeXRaw n)]) =- case c of-  "label"   -> newlab n-  "ref"     -> newref n-  "pageref" -> newref n-labcheck (TeXEnv _ _ l) = labcheck l-labcheck (TeXMath l) = labcheck l-labcheck (TeXOp _ l1 l2) = labcheck l1 >> labcheck l2-labcheck (TeXBraces l) = labcheck l-labcheck (TeXSeq l1 l2) = labcheck l1 >> labcheck l2-labcheck _ = return ()--newlab :: Text -> LabSt ()-newlab n = do- st <- get- let addLab :: Text -> [LabWarn] -> [LabWarn]-     addLab n [] = [LabelNoRef n]-     addLab n l@(x:xs) = let ys = x : addLab n xs in-       case x of-        RefNoLabel m -> if n == m then LabelRef n : xs-                                  else ys-        LabelNoRef m -> if n == m then l-                                  else ys-        LabelRef   m -> if n == m then l-                                  else ys- put $ addLab n st--newref :: Text -> LabSt ()-newref n = do- st <- get- let addRef :: Text -> [LabWarn] -> [LabWarn]-     addRef n [] = [RefNoLabel n]-     addRef n l@(x:xs) = let ys = x : addRef n xs in-       case x of-        RefNoLabel m -> if n == m then l-                                  else ys-        LabelNoRef m -> if n == m then LabelRef n : xs-                                  else ys-        LabelRef   m -> if n == m then l-                                  else ys- put $ addRef n st-+
+{-# LANGUAGE OverloadedStrings #-}
+
+-- | This module provides functionality for check a 'LaTeX' value for
+--   possibly undesired things (like the call to an undefined label),
+--   returning 'Warning's. These are called 'Warning's because they
+--   never terminates the program execution.
+module Text.LaTeX.Base.Warnings (
+   -- * Warnings datatype
+   Warning (..)
+ , TeXCheck
+ , check
+ , checkFromFunction
+   -- * Several checkings
+ , checkLabels
+ , checkClass
+ , checkDoc
+   -- * Complete checking
+ , checkAll
+ ) where
+
+import Text.LaTeX.Base.Syntax
+import Control.Monad.Trans.State
+import Data.Text
+import Data.Maybe
+import Control.Arrow
+import Data.Monoid
+
+-- | List of possible warnings.
+data Warning =
+   UnusedLabel Text    -- ^ There is an unused label. Argument is its name.
+ | UndefinedLabel Text -- ^ There is a reference to an undefined label. Arguments is the name.
+   --
+ | NoClassSelected     -- ^ No class selected with 'documentclass'.
+ | NoDocumentInserted  -- ^ No 'document' inserted.
+   --
+ | CustomWarning Text  -- ^ Custom warning for custom checkings. Use it as you want.
+   deriving (Eq,Show)
+
+-- | A 'TeXCheck' is a function that checks possible warnings from a 'LaTeX' value.
+--   Use the 'Monoid' instance to combine check functions.
+newtype TeXCheck = TC { check :: LaTeX -> [Warning] -- ^ Apply a checking.
+                      }
+-- | Build a 'TeXCheck' from a function.
+checkFromFunction :: (LaTeX -> [Warning]) -> TeXCheck
+checkFromFunction = TC
+
+instance Monoid TeXCheck where
+ mempty = TC $ const []
+ mappend (TC tc1) (TC tc2) = TC $ uncurry mappend . (tc1 &&& tc2)
+
+-- | Check with 'checkLabels', 'checkClass' and 'checkDoc'.
+checkAll :: TeXCheck
+checkAll = mconcat [ checkLabels , checkClass , checkDoc ]
+
+-- Searching for 'documentclass' and 'document'
+
+type BoolSt = State Bool
+
+-- | Check if a document class is specified for the document (using 'documentclass').
+checkClass :: TeXCheck
+checkClass = TC $ \l -> if execState (classcheck l) False then [] else [NoClassSelected]
+
+classcheck :: LaTeX -> BoolSt ()
+classcheck (TeXComm c _) =
+ case c of
+  "documentclass" -> put True
+  _ -> return ()
+classcheck (TeXBraces l) = classcheck l
+classcheck (TeXSeq l1 l2) = classcheck l1 >> classcheck l2
+classcheck _ = return ()
+
+-- | Check if the 'document' environment is called in a 'LaTeX'.
+checkDoc :: TeXCheck
+checkDoc = TC $ \l -> if execState (doccheck l) False then [] else [NoDocumentInserted]
+
+doccheck :: LaTeX -> BoolSt ()
+doccheck (TeXEnv n _ _) =
+ case n of
+  "document" -> put True
+  _ -> return ()
+doccheck (TeXBraces l) = doccheck l
+doccheck (TeXSeq l1 l2) = doccheck l1 >> doccheck l2
+doccheck _ = return ()
+
+-- Checking labels
+
+data LabWarn =
+   RefNoLabel Text
+ | LabelNoRef Text
+ | LabelRef Text
+
+labWarnToWarning :: LabWarn -> Maybe Warning
+labWarnToWarning (RefNoLabel n) = Just $ UndefinedLabel n
+labWarnToWarning (LabelNoRef n) = Just $ UnusedLabel n
+labWarnToWarning _ = Nothing
+
+type LabSt = State [LabWarn]
+
+-- | Checking for unused labels or references tu undefined labels.
+checkLabels :: TeXCheck
+checkLabels = TC $ \l -> catMaybes . fmap labWarnToWarning $ execState (labcheck l) []
+
+labcheck :: LaTeX -> LabSt ()
+labcheck (TeXComm c [FixArg (TeXRaw n)]) =
+ case c of
+  "label"   -> newlab n
+  "ref"     -> newref n
+  "pageref" -> newref n
+labcheck (TeXEnv _ _ l) = labcheck l
+labcheck (TeXMath l) = labcheck l
+labcheck (TeXOp _ l1 l2) = labcheck l1 >> labcheck l2
+labcheck (TeXBraces l) = labcheck l
+labcheck (TeXSeq l1 l2) = labcheck l1 >> labcheck l2
+labcheck _ = return ()
+
+newlab :: Text -> LabSt ()
+newlab n = do
+ st <- get
+ let addLab :: Text -> [LabWarn] -> [LabWarn]
+     addLab n [] = [LabelNoRef n]
+     addLab n l@(x:xs) = let ys = x : addLab n xs in
+       case x of
+        RefNoLabel m -> if n == m then LabelRef n : xs
+                                  else ys
+        LabelNoRef m -> if n == m then l
+                                  else ys
+        LabelRef   m -> if n == m then l
+                                  else ys
+ put $ addLab n st
+
+newref :: Text -> LabSt ()
+newref n = do
+ st <- get
+ let addRef :: Text -> [LabWarn] -> [LabWarn]
+     addRef n [] = [RefNoLabel n]
+     addRef n l@(x:xs) = let ys = x : addRef n xs in
+       case x of
+        RefNoLabel m -> if n == m then l
+                                  else ys
+        LabelNoRef m -> if n == m then LabelRef n : xs
+                                  else ys
+        LabelRef   m -> if n == m then l
+                                  else ys
+ put $ addRef n st
+
Text/LaTeX/Base/Writer.hs view
@@ -3,98 +3,102 @@ 
 module Text.LaTeX.Base.Writer
  ( -- * @LaTeXT@ writer
-   LaTeXT+   LaTeXT
  , LaTeXT_
  , runLaTeXT
- , execLaTeXT+ , execLaTeXT
  , execLaTeXTWarn
- , extractLaTeX- , extractLaTeX_- , textell- , liftFun+ , extractLaTeX
+ , extractLaTeX_
+ , textell
+ , liftFun
  , liftOp
+   -- * Re-export
+ , lift
    ) where
--import Control.Monad.Writer
-import Control.Monad.State
-import Control.Applicative-import Control.Arrow+
+import Control.Monad.Trans.Writer
+import Control.Monad.Trans.State
+import Control.Monad.IO.Class
+import Control.Monad.Trans.Class
+import Control.Applicative
+import Control.Arrow
 import Data.String
 --
 import Text.LaTeX.Base.Syntax
-import Text.LaTeX.Base.Render-import Text.LaTeX.Base.Warnings (Warning,checkAll,check)----import Control.Monad (liftM)+import Text.LaTeX.Base.Render
+import Text.LaTeX.Base.Warnings (Warning,checkAll,check)
+--
+import Control.Monad (liftM)
 
-newtype LaTeXT m a =- LaTeXT { unwrapLaTeXT :: WriterT LaTeX m a }+newtype LaTeXT m a =
+ LaTeXT { unwrapLaTeXT :: WriterT LaTeX m a }
    deriving (Functor,Applicative,Monad,MonadIO)
--instance MonadTrans LaTeXT where- lift = LaTeXT . lift--type LaTeXT_ m = LaTeXT m () 
+instance MonadTrans LaTeXT where
+ lift = LaTeXT . lift
+
+type LaTeXT_ m = LaTeXT m ()
+
 runLaTeXT :: LaTeXT m a -> m (a,LaTeX)
 runLaTeXT = runWriterT . unwrapLaTeXT
---- | This is the usual way to run the 'LaTeXT' monad+
+-- | This is the usual way to run the 'LaTeXT' monad
 --   and obtain a 'LaTeX' value.
 execLaTeXT :: Monad m => LaTeXT m a -> m LaTeX
-execLaTeXT = liftM snd . runLaTeXT---- | Version of 'execLaTeXT' with possible warning messages.---   This function applies 'checkAll' to the 'LaTeX' output.-execLaTeXTWarn :: Monad m => LaTeXT m a -> m (LaTeX,[Warning])-execLaTeXTWarn = liftM (id &&& check checkAll) . execLaTeXT---- | This function run a 'LaTeXT' computation,+execLaTeXT = liftM snd . runLaTeXT
+
+-- | Version of 'execLaTeXT' with possible warning messages.
+--   This function applies 'checkAll' to the 'LaTeX' output.
+execLaTeXTWarn :: Monad m => LaTeXT m a -> m (LaTeX,[Warning])
+execLaTeXTWarn = liftM (id &&& check checkAll) . execLaTeXT
+
+-- | This function run a 'LaTeXT' computation,
 --   lifting the result again in the monad.
 extractLaTeX :: Monad m => LaTeXT m a -> LaTeXT m (a,LaTeX)
 extractLaTeX = LaTeXT . lift . runLaTeXT
-+
 extractLaTeX_ :: Monad m => LaTeXT m a -> LaTeXT m LaTeX
-extractLaTeX_ = liftM snd . extractLaTeX---- | With 'textell' you can append 'LaTeX' values to the+extractLaTeX_ = liftM snd . extractLaTeX
+
+-- | With 'textell' you can append 'LaTeX' values to the
 --   state of the 'LaTeXT' monad.
 textell :: Monad m => LaTeX -> LaTeXT m ()
-textell = LaTeXT . tell---- | Lift a function over 'LaTeX' values to a function---   acting over the state of a 'LaTeXT' computation.-liftFun :: Monad m-        => (LaTeX -> LaTeX)-        -> (LaTeXT m a -> LaTeXT m a)-liftFun f ml = do- (a,l') <- lift $ do-            (a,l) <- runLaTeXT ml-            let l' = f l-            return (a,l')- textell l'- return a---- | Lift an operator over 'LaTeX' values to an operator---   acting over the state of two 'LaTeXT' computations.------ /Note: The returned value is the one returned by the/--- /second argument of the lifted operator./-liftOp :: Monad m-       => (LaTeX -> LaTeX -> LaTeX)-       -> (LaTeXT m a -> LaTeXT m a -> LaTeXT m a)-liftOp op ml1 ml2 = do- (a,l') <- lift $ do-            (_,l1) <- runLaTeXT ml1-            (a,l2) <- runLaTeXT ml2-            let l' = l1 `op` l2-            return (a,l')- textell l'- return a---- Overloaded Strings---- | Be careful when using 'fromString' over a 'LaTeXT' value,---   the returned value of the computation is bottom (i.e. 'undefined').-instance Monad m => IsString (LaTeXT m a) where- fromString = (>> return undefined) . textell . fromString+textell = LaTeXT . tell
+
+-- | Lift a function over 'LaTeX' values to a function
+--   acting over the state of a 'LaTeXT' computation.
+liftFun :: Monad m
+        => (LaTeX -> LaTeX)
+        -> (LaTeXT m a -> LaTeXT m a)
+liftFun f ml = do
+ (a,l') <- lift $ do
+            (a,l) <- runLaTeXT ml
+            let l' = f l
+            return (a,l')
+ textell l'
+ return a
+
+-- | Lift an operator over 'LaTeX' values to an operator
+--   acting over the state of two 'LaTeXT' computations.
+--
+-- /Note: The returned value is the one returned by the/
+-- /second argument of the lifted operator./
+liftOp :: Monad m
+       => (LaTeX -> LaTeX -> LaTeX)
+       -> (LaTeXT m a -> LaTeXT m a -> LaTeXT m a)
+liftOp op ml1 ml2 = do
+ (a,l') <- lift $ do
+            (_,l1) <- runLaTeXT ml1
+            (a,l2) <- runLaTeXT ml2
+            let l' = l1 `op` l2
+            return (a,l')
+ textell l'
+ return a
+
+-- Overloaded Strings
+
+-- | Be careful when using 'fromString' over a 'LaTeXT' value,
+--   the returned value of the computation is bottom (i.e. 'undefined').
+instance Monad m => IsString (LaTeXT m a) where
+ fromString = (>> return undefined) . textell . fromString
Text/LaTeX/Monad.hs view
@@ -1,8 +1,8 @@---- | This module is a re-export of the main modules.---   Importing this will you give access to almost all---   functionality of the library. It is recommended---   to import the @Base@ module and, then, import only+
+-- | This module is a re-export of the main modules.
+--   Importing this will you give access to almost all
+--   functionality of the library. It is recommended
+--   to import the @Base@ module and, then, import only
 --   packages you will need.
 module Text.LaTeX.Monad
  ( module Text.LaTeX.Base.Monad
@@ -10,4 +10,4 @@    ) where
 
 import Text.LaTeX.Base.Monad
-import Text.LaTeX.Packages.Monad+import Text.LaTeX.Packages.Monad
Text/LaTeX/Packages.hs view
@@ -5,19 +5,21 @@    -- * Cross-reference packages
  , module Text.LaTeX.Packages.Hyperref
    -- * Presentation packages
- , module Text.LaTeX.Packages.Beamer-   -- * Mathematics packages- , module Text.LaTeX.Packages.AMSMath- , module Text.LaTeX.Packages.AMSFonts- , module Text.LaTeX.Packages.AMSThm-   -- * Graphics packages+ , module Text.LaTeX.Packages.Beamer
+   -- * Mathematics packages
+ , module Text.LaTeX.Packages.AMSMath
+ , module Text.LaTeX.Packages.AMSFonts
+ , module Text.LaTeX.Packages.AMSThm
+   -- * Graphics packages
  , module Text.LaTeX.Packages.Color
+ , module Text.LaTeX.Packages.Graphicx
    ) where
 
 import Text.LaTeX.Packages.Inputenc
 import Text.LaTeX.Packages.Hyperref
-import Text.LaTeX.Packages.Beamer-import Text.LaTeX.Packages.AMSMath-import Text.LaTeX.Packages.AMSFonts-import Text.LaTeX.Packages.AMSThm-import Text.LaTeX.Packages.Color+import Text.LaTeX.Packages.Beamer
+import Text.LaTeX.Packages.AMSMath
+import Text.LaTeX.Packages.AMSFonts
+import Text.LaTeX.Packages.AMSThm
+import Text.LaTeX.Packages.Color
+import Text.LaTeX.Packages.Graphicx
Text/LaTeX/Packages/AMSFonts.hs view
@@ -1,29 +1,30 @@--{-# OPTIONS_HATEX MakeMonadic #-}--module Text.LaTeX.Packages.AMSFonts- ( -- * AMSFonts package-   amsfonts-   -- * Fonts- , mathbb-   ) where--import Text.LaTeX.Base.Syntax---- | AMSFonts package.--- Example:------ > usepackage [] amsfonts-amsfonts :: String-amsfonts = "amsfonts"-------- | This font is useful for representing sets like---   R (real numbers) or Z (integers). For instance:------ > "The set of real numbers are represented by " <> mathbb "R" <> "."------ /Note the use of overloaded strings./-mathbb :: LaTeX -> LaTeX-mathbb l = TeXComm "mathbb" [FixArg l]+
+{-# OPTIONS_HATEX MakeMonadic #-}
+
+module Text.LaTeX.Packages.AMSFonts
+ ( -- * AMSFonts package
+   amsfonts
+   -- * Fonts
+ , mathbb
+   ) where
+
+import Text.LaTeX.Base.Syntax
+import Text.LaTeX.Base.Types
+
+-- | AMSFonts package.
+-- Example:
+--
+-- > usepackage [] amsfonts
+amsfonts :: ClassName
+amsfonts = "amsfonts"
+
+--
+
+-- | This font is useful for representing sets like
+--   R (real numbers) or Z (integers). For instance:
+--
+-- > "The set of real numbers are represented by " <> mathbb "R" <> "."
+--
+-- /Note the use of overloaded strings./
+mathbb :: LaTeX -> LaTeX
+mathbb l = TeXComm "mathbb" [FixArg l]
Text/LaTeX/Packages/AMSFonts/Monad.hs view
@@ -3,7 +3,7 @@ -- 
 -- /For contributors: This module was automatically generated by HaTeX-meta./
 -- /So, please, don't make any change here directly, because/
--- /this is intended to be generated from/
+-- /this is intended to be generated automatically from/
 -- "Text.LaTeX.Packages.AMSFonts" /module via HaTeX-meta,/
 -- /and therefore, changes must to be done in these places./
 
@@ -27,7 +27,7 @@ >  usepackage [] amsfonts
 
 -}
-amsfonts :: String
+amsfonts :: ClassName
 amsfonts = App.amsfonts
 
 {-|
Text/LaTeX/Packages/AMSMath.hs view
@@ -1,176 +1,317 @@-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_HATEX MakeMonadic #-}--module Text.LaTeX.Packages.AMSMath- ( -- * AMSMath package-   amsmath-   -- * AMSMath functions- , math-   -- * Symbols and utilities-   -- ** Superscript and subscript- , (^:) , (!:)-   -- ** Function symbols-   -- | Some symbols are preceded with /t/ to be distinguished from-   --   predefined Haskell entities (like 'sin' and 'cos').- , tsin , arcsin- , tcos , arccos- , ttan , arctan- , texp- , tlog , ln-   -- ** Operator symbols- , (=:) , (/=:)- , (>:) , (>=:)- , (<:) , (<=:)- , in_ , ni , notin-   -- ** Other symbols- , to- , forall- , dagger, ddagger-   -- * Fonts- , mathbf- , mathrm- , mathcal- , mathsf- , mathtt- , mathit-   ) where--import Text.LaTeX.Base.Syntax-import Text.LaTeX.Base.Commands (raw,between)---- | AMSMath package.--- Example:------ > usepackage [] amsmath-amsmath :: String-amsmath = "amsmath"---- | Inline mathematical expressions.-math :: LaTeX -> LaTeX-math = TeXMath----------------------------------------------- Symbols and utilities ----------- | Superscript.-(^:) :: LaTeX -> LaTeX -> LaTeX-x ^: y = x <> raw "^"  <> braces y---- | Subscript.-(!:) :: LaTeX -> LaTeX -> LaTeX-x !: y = x <> raw "_" <> braces y------ Function symbols---- | Sine function symbol.-tsin :: LaTeX-tsin = TeXComm "sin" []---- | Arcsine function symbol.-arcsin :: LaTeX-arcsin = TeXComm "arcsin" []---- | Cosine function symbol.-tcos :: LaTeX-tcos = TeXComm "cos" []---- | Arccosine function symbol.-arccos :: LaTeX-arccos = TeXComm "arccos" []---- | Tangent function symbol.-ttan :: LaTeX-ttan = TeXComm "tan" []--arctan :: LaTeX-arctan = TeXComm "arctan" []---- | Exponential function symbol.-texp :: LaTeX-texp = TeXComm "exp" []---- | Logarithm function symbol.-tlog :: LaTeX-tlog = TeXComm "log" []---- | Natural logarithm symbol.-ln :: LaTeX-ln = TeXComm "ln" []------ Operator symbols---- | Negative form of an operator.-notop :: (LaTeX -> LaTeX -> LaTeX)-      -> (LaTeX -> LaTeX -> LaTeX)-notop op =- \l1 l2 ->-   (l1 <> TeXCommS "not") `op` l2--infix 4 =: , /=:--(=:),(/=:) :: LaTeX -> LaTeX -> LaTeX-(=:)  = TeXOp "="-(/=:) = notop (=:)---- | Greater.-(>:) :: LaTeX -> LaTeX -> LaTeX-(>:) = TeXOp ">"---- | Greater or equal.-(>=:) :: LaTeX -> LaTeX -> LaTeX-(>=:) = between $ TeXComm "geq" []---- | Lesser.-(<:) :: LaTeX -> LaTeX -> LaTeX-(<:) = TeXOp "<"---- | Lesser or equal.-(<=:) :: LaTeX -> LaTeX -> LaTeX-(<=:) = between $ TeXComm "leq" []--in_ :: LaTeX -> LaTeX -> LaTeX-in_ = between $ TeXComm "in" []--ni :: LaTeX -> LaTeX -> LaTeX-ni  = between $ TeXComm "ni" []--notin :: LaTeX -> LaTeX -> LaTeX-notin = between $ TeXComm "notin" []------ Other symbols---- | A right-arrow.-to :: LaTeX-to = TeXComm "to" []--forall :: LaTeX-forall = TeXComm "forall" []---- | Dagger symbol.-dagger :: LaTeX-dagger = TeXComm "dagger" []---- | Double dagger symbol.-ddagger :: LaTeX-ddagger = TeXComm "ddagger" []---------------------------------------------------- Math Fonts ---------------mathbf :: LaTeX -> LaTeX-mathbf l = TeXComm "mathbf" [FixArg l]--mathrm :: LaTeX -> LaTeX-mathrm l = TeXComm "mathrm" [FixArg l]--mathcal :: LaTeX -> LaTeX-mathcal l = TeXComm "mathcal" [FixArg l]--mathsf :: LaTeX -> LaTeX-mathsf l = TeXComm "mathsf" [FixArg l]--mathtt :: LaTeX -> LaTeX-mathtt l = TeXComm "mathtt" [FixArg l]--mathit :: LaTeX -> LaTeX-mathit l = TeXComm "mathit" [FixArg l]+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_HATEX MakeMonadic #-}
+
+module Text.LaTeX.Packages.AMSMath
+ ( -- * AMSMath package
+   amsmath
+   -- * AMSMath functions
+ , math
+   -- * Symbols and utilities
+   -- ** Superscript and subscript
+ , (^:) , (!:)
+   -- ** Function symbols
+   -- | Some symbols are preceded with /t/ to be distinguished from
+   --   predefined Haskell entities (like 'sin' and 'cos').
+ , tsin , arcsin
+ , tcos , arccos
+ , ttan , arctan
+ , texp
+ , tlog , ln
+   -- ** Operator symbols
+ , (=:) , (/=:)
+ , (>:) , (>=:)
+ , (<:) , (<=:)
+ , in_ , ni , notin
+   -- ** Greek alphabet
+   -- | Functions of greek alphabet symbols.
+   --
+   --   Uppercase versions are suffixed with @u@.
+   --   Variants are prefixed with @var@.
+   --   The function 'pi_' is ended by an underscore symbol to
+   --   distinguish it from the 'pi' Prelude function.
+ , alpha    , beta       , gamma
+ , gammau   , delta      , deltau
+ , epsilon  , varepsilon , zeta
+ , eta      , theta      , thetau
+ , iota     , kappa      , lambda
+ , lambdau  , mu         , nu
+ , xi       , xiu        , pi_
+ , varpi    , piu        , rho
+ , varrho   , sigma      , varsigma
+ , sigmau   , tau        , upsilon
+ , upsilonu , phi        , varphi
+ , phiu     , chi        , psi
+ , psiu     , omega      , omegau
+   -- ** Other symbols
+ , to
+ , forall
+ , dagger, ddagger
+   -- * Fonts
+ , mathbf
+ , mathrm
+ , mathcal
+ , mathsf
+ , mathtt
+ , mathit
+   ) where
+
+import Text.LaTeX.Base.Syntax
+import Text.LaTeX.Base.Commands (raw,between)
+import Text.LaTeX.Base.Types
+
+-- | AMSMath package.
+-- Example:
+--
+-- > usepackage [] amsmath
+amsmath :: PackageName
+amsmath = "amsmath"
+
+-- | Inline mathematical expressions.
+math :: LaTeX -> LaTeX
+math = TeXMath
+
+-------------------------------------
+------- Symbols and utilities -------
+
+-- | Superscript.
+(^:) :: LaTeX -> LaTeX -> LaTeX
+x ^: y = x <> raw "^"  <> braces y
+
+-- | Subscript.
+(!:) :: LaTeX -> LaTeX -> LaTeX
+x !: y = x <> raw "_" <> braces y
+
+---- Function symbols
+
+-- | Sine function symbol.
+tsin :: LaTeX
+tsin = TeXComm "sin" []
+
+-- | Arcsine function symbol.
+arcsin :: LaTeX
+arcsin = TeXComm "arcsin" []
+
+-- | Cosine function symbol.
+tcos :: LaTeX
+tcos = TeXComm "cos" []
+
+-- | Arccosine function symbol.
+arccos :: LaTeX
+arccos = TeXComm "arccos" []
+
+-- | Tangent function symbol.
+ttan :: LaTeX
+ttan = TeXComm "tan" []
+
+arctan :: LaTeX
+arctan = TeXComm "arctan" []
+
+-- | Exponential function symbol.
+texp :: LaTeX
+texp = TeXComm "exp" []
+
+-- | Logarithm function symbol.
+tlog :: LaTeX
+tlog = TeXComm "log" []
+
+-- | Natural logarithm symbol.
+ln :: LaTeX
+ln = TeXComm "ln" []
+
+---- Operator symbols
+
+-- | Negative form of an operator.
+notop :: (LaTeX -> LaTeX -> LaTeX)
+      -> (LaTeX -> LaTeX -> LaTeX)
+notop op =
+ \l1 l2 ->
+   (l1 <> TeXCommS "not") `op` l2
+
+infix 4 =: , /=:
+
+(=:),(/=:) :: LaTeX -> LaTeX -> LaTeX
+(=:)  = TeXOp "="
+(/=:) = notop (=:)
+
+-- | Greater.
+(>:) :: LaTeX -> LaTeX -> LaTeX
+(>:) = TeXOp ">"
+
+-- | Greater or equal.
+(>=:) :: LaTeX -> LaTeX -> LaTeX
+(>=:) = between $ TeXComm "geq" []
+
+-- | Lesser.
+(<:) :: LaTeX -> LaTeX -> LaTeX
+(<:) = TeXOp "<"
+
+-- | Lesser or equal.
+(<=:) :: LaTeX -> LaTeX -> LaTeX
+(<=:) = between $ TeXComm "leq" []
+
+in_ :: LaTeX -> LaTeX -> LaTeX
+in_ = between $ TeXComm "in" []
+
+ni :: LaTeX -> LaTeX -> LaTeX
+ni  = between $ TeXComm "ni" []
+
+notin :: LaTeX -> LaTeX -> LaTeX
+notin = between $ TeXComm "notin" []
+
+---- Greek alphabet
+
+alpha :: LaTeX
+alpha = TeXComm "alpha" []
+
+beta :: LaTeX
+beta = TeXComm "beta" []
+
+gamma :: LaTeX
+gamma = TeXComm "gamma" []
+
+gammau :: LaTeX
+gammau = TeXComm "Gamma" []
+
+delta :: LaTeX
+delta = TeXComm "delta" []
+
+deltau :: LaTeX
+deltau = TeXComm "Delta" []
+
+epsilon :: LaTeX
+epsilon = TeXComm "epsilon" []
+
+varepsilon :: LaTeX
+varepsilon = TeXComm "epsilon" []
+
+zeta :: LaTeX
+zeta = TeXComm "zeta" []
+
+eta :: LaTeX
+eta = TeXComm "eta" []
+
+theta :: LaTeX
+theta = TeXComm "theta" []
+
+thetau :: LaTeX
+thetau = TeXComm "thetau" []
+
+iota :: LaTeX
+iota = TeXComm "iota" []
+
+kappa :: LaTeX
+kappa = TeXComm "kappa" []
+
+lambda :: LaTeX
+lambda = TeXComm "lambda" []
+
+lambdau :: LaTeX
+lambdau = TeXComm "Lambda" []
+
+mu :: LaTeX
+mu = TeXComm "mu" []
+
+nu :: LaTeX
+nu = TeXComm "nu" []
+
+xi :: LaTeX
+xi = TeXComm "xi" []
+
+xiu :: LaTeX
+xiu = TeXComm "Xi" []
+
+pi_ :: LaTeX
+pi_ = TeXComm "pi" []
+
+varpi :: LaTeX
+varpi = TeXComm "varpi" []
+
+piu :: LaTeX
+piu = TeXComm "Pi" []
+
+rho :: LaTeX
+rho = TeXComm "rho" []
+
+varrho :: LaTeX
+varrho = TeXComm "varrho" []
+
+sigma :: LaTeX
+sigma = TeXComm "sigma" []
+
+varsigma :: LaTeX
+varsigma = TeXComm "varsigma" []
+
+sigmau :: LaTeX
+sigmau = TeXComm "Sigma" []
+
+tau :: LaTeX
+tau = TeXComm "tau" []
+
+upsilon :: LaTeX
+upsilon = TeXComm "upsilon" []
+
+upsilonu :: LaTeX
+upsilonu = TeXComm "Upsilon" []
+
+phi :: LaTeX
+phi = TeXComm "phi" []
+
+varphi :: LaTeX
+varphi = TeXComm "varphi" []
+
+phiu :: LaTeX
+phiu = TeXComm "Phi" []
+
+chi :: LaTeX
+chi = TeXComm "chi" []
+
+psi :: LaTeX
+psi = TeXComm "psi" []
+
+psiu :: LaTeX
+psiu = TeXComm "Psi" []
+
+omega :: LaTeX
+omega = TeXComm "omega" []
+
+omegau :: LaTeX
+omegau = TeXComm "Omega" []
+
+---- Other symbols
+
+-- | A right-arrow.
+to :: LaTeX
+to = TeXComm "to" []
+
+-- | /For all/ symbol.
+forall :: LaTeX
+forall = TeXComm "forall" []
+
+-- | Dagger symbol.
+dagger :: LaTeX
+dagger = TeXComm "dagger" []
+
+-- | Double dagger symbol.
+ddagger :: LaTeX
+ddagger = TeXComm "ddagger" []
+
+-------------------------------------
+------------ Math Fonts -------------
+
+mathbf :: LaTeX -> LaTeX
+mathbf l = TeXComm "mathbf" [FixArg l]
+
+mathrm :: LaTeX -> LaTeX
+mathrm l = TeXComm "mathrm" [FixArg l]
+
+mathcal :: LaTeX -> LaTeX
+mathcal l = TeXComm "mathcal" [FixArg l]
+
+mathsf :: LaTeX -> LaTeX
+mathsf l = TeXComm "mathsf" [FixArg l]
+
+mathtt :: LaTeX -> LaTeX
+mathtt l = TeXComm "mathtt" [FixArg l]
+
+mathit :: LaTeX -> LaTeX
+mathit l = TeXComm "mathit" [FixArg l]
Text/LaTeX/Packages/AMSMath/Monad.hs view
@@ -4,7 +4,7 @@ -- 
 -- /For contributors: This module was automatically generated by HaTeX-meta./
 -- /So, please, don't make any change here directly, because/
--- /this is intended to be generated from/
+-- /this is intended to be generated automatically from/
 -- "Text.LaTeX.Packages.AMSMath" /module via HaTeX-meta,/
 -- /and therefore, changes must to be done in these places./
 
@@ -29,6 +29,26 @@  , (>:) , (>=:)
  , (<:) , (<=:)
  , in_ , ni , notin
+   -- ** Greek alphabet
+   -- | Functions of greek alphabet symbols.
+   --
+   --   Uppercase versions are suffixed with @u@.
+   --   Variants are prefixed with @var@.
+   --   The function 'pi_' is ended by an underscore symbol to
+   --   distinguish it from the 'pi' Prelude function.
+ , alpha    , beta       , gamma
+ , gammau   , delta      , deltau
+ , epsilon  , varepsilon , zeta
+ , eta      , theta      , thetau
+ , iota     , kappa      , lambda
+ , lambdau  , mu         , nu
+ , xi       , xiu        , pi_
+ , varpi    , piu        , rho
+ , varrho   , sigma      , varsigma
+ , sigmau   , tau        , upsilon
+ , upsilonu , phi        , varphi
+ , phiu     , chi        , psi
+ , psiu     , omega      , omegau
    -- ** Other symbols
  , to
  , forall
@@ -55,7 +75,7 @@ >  usepackage [] amsmath
 
 -}
-amsmath :: String
+amsmath :: PackageName
 amsmath = App.amsmath
 
 -- | Inline mathematical expressions.
@@ -186,11 +206,168 @@        a2 <- extractLaTeX_ a2
        textell ( App.notin a1 a2)
 
+
+alpha ::   (Monad m) => LaTeXT_ m
+alpha = do textell ( App.alpha)
+
+
+beta ::   (Monad m) => LaTeXT_ m
+beta = do textell ( App.beta)
+
+
+gamma ::   (Monad m) => LaTeXT_ m
+gamma = do textell ( App.gamma)
+
+
+gammau ::   (Monad m) => LaTeXT_ m
+gammau = do textell ( App.gammau)
+
+
+delta ::   (Monad m) => LaTeXT_ m
+delta = do textell ( App.delta)
+
+
+deltau ::   (Monad m) => LaTeXT_ m
+deltau = do textell ( App.deltau)
+
+
+epsilon ::   (Monad m) => LaTeXT_ m
+epsilon = do textell ( App.epsilon)
+
+
+varepsilon ::   (Monad m) => LaTeXT_ m
+varepsilon = do textell ( App.varepsilon)
+
+
+zeta ::   (Monad m) => LaTeXT_ m
+zeta = do textell ( App.zeta)
+
+
+eta ::   (Monad m) => LaTeXT_ m
+eta = do textell ( App.eta)
+
+
+theta ::   (Monad m) => LaTeXT_ m
+theta = do textell ( App.theta)
+
+
+thetau ::   (Monad m) => LaTeXT_ m
+thetau = do textell ( App.thetau)
+
+
+iota ::   (Monad m) => LaTeXT_ m
+iota = do textell ( App.iota)
+
+
+kappa ::   (Monad m) => LaTeXT_ m
+kappa = do textell ( App.kappa)
+
+
+lambda ::   (Monad m) => LaTeXT_ m
+lambda = do textell ( App.lambda)
+
+
+lambdau ::   (Monad m) => LaTeXT_ m
+lambdau = do textell ( App.lambdau)
+
+
+mu ::   (Monad m) => LaTeXT_ m
+mu = do textell ( App.mu)
+
+
+nu ::   (Monad m) => LaTeXT_ m
+nu = do textell ( App.nu)
+
+
+xi ::   (Monad m) => LaTeXT_ m
+xi = do textell ( App.xi)
+
+
+xiu ::   (Monad m) => LaTeXT_ m
+xiu = do textell ( App.xiu)
+
+
+pi_ ::   (Monad m) => LaTeXT_ m
+pi_ = do textell ( App.pi_)
+
+
+varpi ::   (Monad m) => LaTeXT_ m
+varpi = do textell ( App.varpi)
+
+
+piu ::   (Monad m) => LaTeXT_ m
+piu = do textell ( App.piu)
+
+
+rho ::   (Monad m) => LaTeXT_ m
+rho = do textell ( App.rho)
+
+
+varrho ::   (Monad m) => LaTeXT_ m
+varrho = do textell ( App.varrho)
+
+
+sigma ::   (Monad m) => LaTeXT_ m
+sigma = do textell ( App.sigma)
+
+
+varsigma ::   (Monad m) => LaTeXT_ m
+varsigma = do textell ( App.varsigma)
+
+
+sigmau ::   (Monad m) => LaTeXT_ m
+sigmau = do textell ( App.sigmau)
+
+
+tau ::   (Monad m) => LaTeXT_ m
+tau = do textell ( App.tau)
+
+
+upsilon ::   (Monad m) => LaTeXT_ m
+upsilon = do textell ( App.upsilon)
+
+
+upsilonu ::   (Monad m) => LaTeXT_ m
+upsilonu = do textell ( App.upsilonu)
+
+
+phi ::   (Monad m) => LaTeXT_ m
+phi = do textell ( App.phi)
+
+
+varphi ::   (Monad m) => LaTeXT_ m
+varphi = do textell ( App.varphi)
+
+
+phiu ::   (Monad m) => LaTeXT_ m
+phiu = do textell ( App.phiu)
+
+
+chi ::   (Monad m) => LaTeXT_ m
+chi = do textell ( App.chi)
+
+
+psi ::   (Monad m) => LaTeXT_ m
+psi = do textell ( App.psi)
+
+
+psiu ::   (Monad m) => LaTeXT_ m
+psiu = do textell ( App.psiu)
+
+
+omega ::   (Monad m) => LaTeXT_ m
+omega = do textell ( App.omega)
+
+
+omegau ::   (Monad m) => LaTeXT_ m
+omegau = do textell ( App.omegau)
+
 -- | A right-arrow.
 
 to ::   (Monad m) => LaTeXT_ m
 to = do textell ( App.to)
 
+-- | /For all/ symbol.
 
 forall ::   (Monad m) => LaTeXT_ m
 forall = do textell ( App.forall)
Text/LaTeX/Packages/AMSThm.hs view
@@ -1,69 +1,70 @@--{-# OPTIONS_HATEX MakeMonadic #-}-{-# LANGUAGE OverloadedStrings #-}---- | Package for theorem environments.-module Text.LaTeX.Packages.AMSThm- ( -- * AMSThm package-   amsthm-   -- * AMSThm functions- , newtheorem- , theorem- , proof- , qedhere- , TheoremStyle (..)- , theoremstyle-   ) where--import Text.LaTeX.Base.Syntax-import Text.LaTeX.Base.Render---- | AMSThm package.--- Example:------ > usepackage [] amsthm-amsthm :: String-amsthm = "amsthm"---- | Create a new 'theorem' environment type.---   Arguments are environment name (this will be the argument---   when using the 'theorem' function) and the displayed title.------   For example:------ > newtheorem "prop" "Proposition"------ > theorem "prop" "This is it."-newtheorem :: String -> LaTeX -> LaTeX-newtheorem str l = TeXComm "newtheorem" [ FixArg $ fromString str , FixArg l ]--theorem :: String -> LaTeX -> LaTeX-theorem str l = TeXEnv str [] l---- | The 'proof' environment. The first optional argument---   is used to put a custom title to the proof.-proof :: Maybe LaTeX -> LaTeX -> LaTeX-proof  Nothing l = TeXEnv "proof" [ ] l-proof (Just n) l = TeXEnv "proof" [ OptArg n ] l---- | Insert the /QED/ symbol.-qedhere :: LaTeX-qedhere = TeXComm "qedhere" []--data TheoremStyle =-   Plain- | Definition- | Remark- | CustomThmStyle String-   deriving Show--instance Render TheoremStyle where- render Plain = "plain"- render Definition = "definition"- render Remark = "remark"- render (CustomThmStyle str) = fromString str---- | Set the theorem style. Call this function in the preamble.-theoremstyle :: TheoremStyle -> LaTeX-theoremstyle thmsty = TeXComm "theoremstyle" [ FixArg $ TeXRaw $ render thmsty ]-+
+{-# OPTIONS_HATEX MakeMonadic #-}
+{-# LANGUAGE OverloadedStrings #-}
+
+-- | Package for theorem environments.
+module Text.LaTeX.Packages.AMSThm
+ ( -- * AMSThm package
+   amsthm
+   -- * AMSThm functions
+ , newtheorem
+ , theorem
+ , proof
+ , qedhere
+ , TheoremStyle (..)
+ , theoremstyle
+   ) where
+
+import Text.LaTeX.Base.Syntax
+import Text.LaTeX.Base.Render
+import Text.LaTeX.Base.Types
+
+-- | AMSThm package.
+-- Example:
+--
+-- > usepackage [] amsthm
+amsthm :: PackageName
+amsthm = "amsthm"
+
+-- | Create a new 'theorem' environment type.
+--   Arguments are environment name (this will be the argument
+--   when using the 'theorem' function) and the displayed title.
+--
+--   For example:
+--
+-- > newtheorem "prop" "Proposition"
+--
+-- > theorem "prop" "This is it."
+newtheorem :: String -> LaTeX -> LaTeX
+newtheorem str l = TeXComm "newtheorem" [ FixArg $ fromString str , FixArg l ]
+
+theorem :: String -> LaTeX -> LaTeX
+theorem str l = TeXEnv str [] l
+
+-- | The 'proof' environment. The first optional argument
+--   is used to put a custom title to the proof.
+proof :: Maybe LaTeX -> LaTeX -> LaTeX
+proof  Nothing l = TeXEnv "proof" [ ] l
+proof (Just n) l = TeXEnv "proof" [ OptArg n ] l
+
+-- | Insert the /QED/ symbol.
+qedhere :: LaTeX
+qedhere = TeXComm "qedhere" []
+
+data TheoremStyle =
+   Plain
+ | Definition
+ | Remark
+ | CustomThmStyle String
+   deriving Show
+
+instance Render TheoremStyle where
+ render Plain = "plain"
+ render Definition = "definition"
+ render Remark = "remark"
+ render (CustomThmStyle str) = fromString str
+
+-- | Set the theorem style. Call this function in the preamble.
+theoremstyle :: TheoremStyle -> LaTeX
+theoremstyle thmsty = TeXComm "theoremstyle" [ FixArg $ TeXRaw $ render thmsty ]
+
Text/LaTeX/Packages/AMSThm/Monad.hs view
@@ -4,7 +4,7 @@ -- 
 -- /For contributors: This module was automatically generated by HaTeX-meta./
 -- /So, please, don't make any change here directly, because/
--- /this is intended to be generated from/
+-- /this is intended to be generated automatically from/
 -- "Text.LaTeX.Packages.AMSThm" /module via HaTeX-meta,/
 -- /and therefore, changes must to be done in these places./
 
@@ -33,7 +33,7 @@ >  usepackage [] amsthm
 
 -}
-amsthm :: String
+amsthm :: PackageName
 amsthm = App.amsthm
 
 {-|
Text/LaTeX/Packages/Beamer.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE OverloadedStrings #-}
 {-# OPTIONS_HATEX MakeMonadic #-}
 
 module Text.LaTeX.Packages.Beamer
@@ -23,12 +23,13 @@ 
 import Text.LaTeX.Base.Syntax
 import Text.LaTeX.Base.Render
+import Text.LaTeX.Base.Types
 import Data.String
 
 -- | The 'beamer' document class. Importing a package is not required. Example:
 --
 -- > documentclass [] beamer
-beamer :: String
+beamer :: ClassName
 beamer = "beamer"
 
 -- | A presentation is composed of a sequence of frames. Each frame is created with this function.
Text/LaTeX/Packages/Beamer/Monad.hs view
@@ -4,7 +4,7 @@ -- 
 -- /For contributors: This module was automatically generated by HaTeX-meta./
 -- /So, please, don't make any change here directly, because/
--- /this is intended to be generated from/
+-- /this is intended to be generated automatically from/
 -- "Text.LaTeX.Packages.Beamer" /module via HaTeX-meta,/
 -- /and therefore, changes must to be done in these places./
 
@@ -40,7 +40,7 @@ >  documentclass [] beamer
 
 -}
-beamer :: String
+beamer :: ClassName
 beamer = App.beamer
 
 -- | A presentation is composed of a sequence of frames. Each frame is created with this function.
Text/LaTeX/Packages/Color.hs view
@@ -1,151 +1,152 @@--{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_HATEX MakeMonadic #-}--module Text.LaTeX.Packages.Color- ( -- * Color package-   pcolor-   -- * Package options- , monochrome- , dvipsnames- , nodvipsnames- , usenames-   -- * Types- , Color (..)- , ColorName (..)- , ColorModel (..)- , ColSpec (..)-   -- * Commands- , pagecolor- , color- , textcolor- , colorbox , fcolorbox- , normalcolor-   ) where--import Text.LaTeX.Base.Syntax-import Text.LaTeX.Base.Render----import Data.Monoid---- | The 'color' package.
+
+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_HATEX MakeMonadic #-}
+
+module Text.LaTeX.Packages.Color
+ ( -- * Color package
+   pcolor
+   -- * Package options
+ , monochrome
+ , dvipsnames
+ , nodvipsnames
+ , usenames
+   -- * Types
+ , Color (..)
+ , ColorName (..)
+ , ColorModel (..)
+ , ColSpec (..)
+   -- * Commands
+ , pagecolor
+ , color
+ , textcolor
+ , colorbox , fcolorbox
+ , normalcolor
+   ) where
+
+import Text.LaTeX.Base.Syntax
+import Text.LaTeX.Base.Render
+import Text.LaTeX.Base.Types
 --
--- > usepackage [] pcolor-pcolor :: String-pcolor = "color"---- | To convert all colour commands to black and white,---   for previewers that cannot handle colour.-monochrome :: LaTeX-monochrome = "monochrome"--dvipsnames :: LaTeX-dvipsnames = "dvipsnames"--nodvipsnames :: LaTeX-nodvipsnames = "nodvipsnames"--usenames :: LaTeX-usenames = "usenames"------data ColSpec =-   DefColor Color- | ModColor ColorModel- | DvipsColor ColorName-   deriving Show--data Color =-   Red- | Green- | Blue- | Yellow- | Cyan- | Magenta- | Black- | White-   deriving Show--data ColorModel =-   RGB Float Float Float- | RGB255 Int Int Int- | GrayM Float- | HTML String- | CMYK Float Float Float Float-   deriving Show--data ColorName =-   Apricot       | Aquamarine  | Bittersweet- | BlueGreen     | BlueViolet  | BrickRed- | Brown         | BurntOrange | CadetBlue- | CarnationPink | Cerulean    | CornflowerBlue- | Dandelion     | DarkOrchid  | Emerald- | ForestGreen   | Fuchsia     | Goldenrod- | Gray          | GreenYellow | JungleGreen- | Lavender      | LimeGreen   | Mahogany- | Maroon        | Melon       | MidnightBlue- | Mulberry      | NavyBlue    | OliveGreen- | Orange        | OrangeRed   | Orchid- | Peach         | Periwinkle  | PineGreen- | Plum          | ProcessBlue | Purple- | RawSienna     | RedOrange   | RedViolet- | Rhodamine     | RoyalBlue   | RubineRed- | Salmon        | SeaGreen    | Sepia- | SkyBlue       | SpringGreen | Tan- | TealBlue      | Thistle     | Turquoise- | Violet        | VioletRed   | WildStrawberry- | YellowGreen   | YellowOrange-   deriving Show--instance Render Color where- render = fromString . show--instance Render ColorModel where- render (RGB r g b) = mconcat [ "[rgb]{" , renderCommas [r,g,b] , "}" ]- render (RGB255 r g b) = mconcat [ "[RGB]{" , renderCommas [r,g,b] , "}" ]- render (GrayM k) = mconcat [ "[gray]{" , render k , "}"]- render (HTML str) = mconcat [ "[HTML]{" , fromString str , "}" ]- render (CMYK c m y k) = mconcat [ "[cmyk]{" , renderCommas [c,m,y,k] , "}" ]--instance Render ColorName where- render = fromString . show--instance Render ColSpec where- render (DefColor c)   = mconcat [ "{" , render c , "}" ]- render (ModColor cm)  = render cm- render (DvipsColor c) = mconcat [ "{" , render c , "}" ]---- Commands---- | Set the background color fot the current and following pages.-pagecolor :: ColSpec -> LaTeX-pagecolor = (TeXCommS "pagecolor" <>) . rendertex---- | Switch to a new text color.-color :: ColSpec -> LaTeX-color = (TeXCommS "color" <>) . rendertex---- | Set the text of its argument in the given colour.-textcolor :: ColSpec -> LaTeX -> LaTeX-textcolor cs l = TeXCommS "textcolor" <> rendertex cs-              <> braces l---- | Put its argument in a box with the given colour as background.-colorbox :: ColSpec -> LaTeX -> LaTeX-colorbox cs l = TeXCommS "colorbox" <> rendertex cs-             <> braces l---- | Application of @fcolorbox cs1 cs2 l@ put @l@ in a framed box with---   @cs1@ as frame color and @cs2@ as background color.-fcolorbox :: ColSpec -> ColSpec -> LaTeX -> LaTeX-fcolorbox cs1 cs2 l =-    TeXCommS "fcolorbox" <> rendertex cs1-                         <> rendertex cs2- <> braces l---- | Switch to the colour that was active at the end of the preamble.---   Thus, placing a 'color' command in the preamble can change the---   standard colour of the whole document.-normalcolor :: LaTeX-normalcolor = TeXComm "normalcolor" []+import Data.Monoid
+
+-- | The 'pcolor' package.
+--
+-- > usepackage [] pcolor
+pcolor :: PackageName
+pcolor = "color"
+
+-- | To convert all colour commands to black and white,
+--   for previewers that cannot handle colour.
+monochrome :: LaTeX
+monochrome = "monochrome"
+
+dvipsnames :: LaTeX
+dvipsnames = "dvipsnames"
+
+nodvipsnames :: LaTeX
+nodvipsnames = "nodvipsnames"
+
+usenames :: LaTeX
+usenames = "usenames"
+
+--
+
+data ColSpec =
+   DefColor Color
+ | ModColor ColorModel
+ | DvipsColor ColorName
+   deriving Show
+
+data Color =
+   Red
+ | Green
+ | Blue
+ | Yellow
+ | Cyan
+ | Magenta
+ | Black
+ | White
+   deriving Show
+
+data ColorModel =
+   RGB Float Float Float
+ | RGB255 Int Int Int
+ | GrayM Float
+ | HTML String
+ | CMYK Float Float Float Float
+   deriving Show
+
+data ColorName =
+   Apricot       | Aquamarine  | Bittersweet
+ | BlueGreen     | BlueViolet  | BrickRed
+ | Brown         | BurntOrange | CadetBlue
+ | CarnationPink | Cerulean    | CornflowerBlue
+ | Dandelion     | DarkOrchid  | Emerald
+ | ForestGreen   | Fuchsia     | Goldenrod
+ | Gray          | GreenYellow | JungleGreen
+ | Lavender      | LimeGreen   | Mahogany
+ | Maroon        | Melon       | MidnightBlue
+ | Mulberry      | NavyBlue    | OliveGreen
+ | Orange        | OrangeRed   | Orchid
+ | Peach         | Periwinkle  | PineGreen
+ | Plum          | ProcessBlue | Purple
+ | RawSienna     | RedOrange   | RedViolet
+ | Rhodamine     | RoyalBlue   | RubineRed
+ | Salmon        | SeaGreen    | Sepia
+ | SkyBlue       | SpringGreen | Tan
+ | TealBlue      | Thistle     | Turquoise
+ | Violet        | VioletRed   | WildStrawberry
+ | YellowGreen   | YellowOrange
+   deriving Show
+
+instance Render Color where
+ render = fromString . show
+
+instance Render ColorModel where
+ render (RGB r g b) = mconcat [ "[rgb]{" , renderCommas [r,g,b] , "}" ]
+ render (RGB255 r g b) = mconcat [ "[RGB]{" , renderCommas [r,g,b] , "}" ]
+ render (GrayM k) = mconcat [ "[gray]{" , render k , "}"]
+ render (HTML str) = mconcat [ "[HTML]{" , fromString str , "}" ]
+ render (CMYK c m y k) = mconcat [ "[cmyk]{" , renderCommas [c,m,y,k] , "}" ]
+
+instance Render ColorName where
+ render = fromString . show
+
+instance Render ColSpec where
+ render (DefColor c)   = mconcat [ "{" , render c , "}" ]
+ render (ModColor cm)  = render cm
+ render (DvipsColor c) = mconcat [ "{" , render c , "}" ]
+
+-- Commands
+
+-- | Set the background color fot the current and following pages.
+pagecolor :: ColSpec -> LaTeX
+pagecolor = (TeXCommS "pagecolor" <>) . rendertex
+
+-- | Switch to a new text color.
+color :: ColSpec -> LaTeX
+color = (TeXCommS "color" <>) . rendertex
+
+-- | Set the text of its argument in the given colour.
+textcolor :: ColSpec -> LaTeX -> LaTeX
+textcolor cs l = TeXCommS "textcolor" <> rendertex cs
+              <> braces l
+
+-- | Put its argument in a box with the given colour as background.
+colorbox :: ColSpec -> LaTeX -> LaTeX
+colorbox cs l = TeXCommS "colorbox" <> rendertex cs
+             <> braces l
+
+-- | Application of @fcolorbox cs1 cs2 l@ put @l@ in a framed box with
+--   @cs1@ as frame color and @cs2@ as background color.
+fcolorbox :: ColSpec -> ColSpec -> LaTeX -> LaTeX
+fcolorbox cs1 cs2 l =
+    TeXCommS "fcolorbox" <> rendertex cs1
+                         <> rendertex cs2
+ <> braces l
+
+-- | Switch to the colour that was active at the end of the preamble.
+--   Thus, placing a 'color' command in the preamble can change the
+--   standard colour of the whole document.
+normalcolor :: LaTeX
+normalcolor = TeXComm "normalcolor" []
Text/LaTeX/Packages/Color/Monad.hs view
@@ -4,7 +4,7 @@ -- 
 -- /For contributors: This module was automatically generated by HaTeX-meta./
 -- /So, please, don't make any change here directly, because/
--- /this is intended to be generated from/
+-- /this is intended to be generated automatically from/
 -- "Text.LaTeX.Packages.Color" /module via HaTeX-meta,/
 -- /and therefore, changes must to be done in these places./
 
@@ -36,12 +36,12 @@ import Text.LaTeX.Packages.Color(ColSpec,Color,ColorModel,ColorName)
 
 {-|
-The 'color' package.
+The 'pcolor' package.
 
 >  usepackage [] pcolor
 
 -}
-pcolor :: String
+pcolor :: PackageName
 pcolor = App.pcolor
 
 {-|
+ Text/LaTeX/Packages/Graphicx.hs view
@@ -0,0 +1,66 @@+
+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_HATEX MakeMonadic #-}
+
+-- | This module allows you to use the LaTeX graphicx library in order to
+--   insert graphics in a document.
+module Text.LaTeX.Packages.Graphicx
+ ( -- * Graphicx package
+   graphicx
+   -- * Package options
+ , dvips
+ , dvipdfm
+ , pdftex
+   -- * Including graphics
+ , IGOption (..)
+ , includegraphics
+   ) where
+
+import Text.LaTeX.Base.Syntax
+import Text.LaTeX.Base.Render
+import Text.LaTeX.Base.Types
+--
+import Data.Char (toLower)
+
+-- | The 'graphicx' package.
+--
+-- > usepackage [] graphicx
+graphicx :: PackageName
+graphicx = "graphicx"
+
+-- Package options
+
+dvips, dvipdfm, pdftex :: LaTeX
+dvips = "dvips"
+dvipdfm = "dvipdfm"
+pdftex = "pdftex"
+
+-- Including graphics
+
+-- | Include Graphics Option. This options can be passed as arguments to the 'includegraphics' function.
+data IGOption =
+   IGWidth Measure -- ^ Specify the preferred width of the imported image.
+ | IGHeight Measure -- ^ Specify the preferred height of the imported image.
+ | KeepAspectRatio Bool -- ^ When 'True', it will scale the image according to both 'IGWidth' and 'IGHeight'
+                        -- , but will not distort the image, so that neither 'IGWidth' nor 'IGHeight' are exceeded.
+ | IGScale Float -- ^ Scales the image by the desired scale factor.
+ | IGAngle Int -- ^ Rotate the image by given degrees.
+ | IGTrim Measure Measure Measure Measure -- ^ This option will crop the imported image. Arguments are from-left
+                                          -- , from-bottom, from-right and from-top respectively.
+ | IGClip Bool -- ^ For the 'IGTrim' option to work, you must set 'IGClip' to 'True'.
+ | IGPage Int -- ^ If the image file is a pdf file with multiple pages, this parameter allows you to use a different page than the first.
+   deriving Show
+
+instance Render IGOption where
+ render (IGWidth m) = "width=" <> render m
+ render (IGHeight m) = "height=" <> render m
+ render (KeepAspectRatio b) = "keepaspectratio=" <> (fromString $ fmap toLower $ show b)
+ render (IGScale r) = "scale=" <> render r
+ render (IGAngle a) = "angle=" <> render a
+ render (IGTrim l b r t) = "trim=" <> renderChars ' ' [l,b,r,t]
+ render (IGClip b) = "clip=" <> (fromString $ fmap toLower $ show b)
+ render (IGPage p) = "page=" <> render p
+
+-- | Include an image in the document.
+includegraphics :: [IGOption] -> FilePath -> LaTeX
+includegraphics opts fp = TeXComm "includegraphics" [ MOptArg $ fmap rendertex opts , FixArg $ TeXRaw $ fromString fp ]
+ Text/LaTeX/Packages/Graphicx/Monad.hs view
@@ -0,0 +1,57 @@+{-# LANGUAGE OverloadedStrings #-}
+
+{-|
+This module allows you to use the LaTeX graphicx library in order to
+   insert graphics in a document.
+-}-- 
+-- /For contributors: This module was automatically generated by HaTeX-meta./
+-- /So, please, don't make any change here directly, because/
+-- /this is intended to be generated automatically from/
+-- "Text.LaTeX.Packages.Graphicx" /module via HaTeX-meta,/
+-- /and therefore, changes must to be done in these places./
+
+module Text.LaTeX.Packages.Graphicx.Monad
+ ( -- * Graphicx package
+   graphicx
+   -- * Package options
+ , dvips
+ , dvipdfm
+ , pdftex
+   -- * Including graphics
+ , IGOption (..)
+ , includegraphics
+   ) where
+
+import Text.LaTeX.Base.Writer
+import Text.LaTeX.Base.Render
+import Text.LaTeX.Base.Types
+import qualified Text.LaTeX.Packages.Graphicx as App
+import Text.LaTeX.Packages.Graphicx(IGOption)
+
+{-|
+The 'graphicx' package.
+
+>  usepackage [] graphicx
+
+-}
+graphicx :: PackageName
+graphicx = App.graphicx
+
+
+dvips ::   (Monad m) => LaTeXT_ m
+dvips = do textell ( App.dvips)
+
+
+dvipdfm ::   (Monad m) => LaTeXT_ m
+dvipdfm = do textell ( App.dvipdfm)
+
+
+pdftex ::   (Monad m) => LaTeXT_ m
+pdftex = do textell ( App.pdftex)
+
+-- | Include an image in the document.
+
+includegraphics ::   (Monad m) => [IGOption] -> FilePath -> LaTeXT_ m
+includegraphics a1 a2 = do textell ( App.includegraphics a1 a2)
+
+
Text/LaTeX/Packages/Hyperref.hs view
@@ -1,13 +1,13 @@--{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_HATEX MakeMonadic #-} 
+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_HATEX MakeMonadic #-}
+
 module Text.LaTeX.Packages.Hyperref
  ( -- * Hyperref package
    hyperref
    -- * Hyperref commands
  , HRefOption (..)
- , URL+ , URL
  , createURL
  , href
  , url
@@ -24,7 +24,7 @@ -- | The 'hyperref' package.
 --
 -- > usepackage [] hyperref
-hyperref :: String
+hyperref :: PackageName
 hyperref = "hyperref"
 
 data HRefOption =
@@ -41,9 +41,9 @@ newtype URL = URL String deriving Show
 
 instance Render URL where
- render (URL str) = fromString str--createURL :: String -> URL+ render (URL str) = fromString str
+
+createURL :: String -> URL
 createURL = URL
 
 -- | Reference to an 'URL'.
@@ -72,4 +72,4 @@ 
 -- | This is a replacement for the usual 'ref' command that places a contextual label in front of the reference.
 autoref :: Label -> LaTeX
-autoref l = TeXComm "autoref" [ FixArg $ TeXRaw $ render l ]+autoref l = TeXComm "autoref" [ FixArg $ TeXRaw $ render l ]
Text/LaTeX/Packages/Hyperref/Monad.hs view
@@ -4,7 +4,7 @@ -- 
 -- /For contributors: This module was automatically generated by HaTeX-meta./
 -- /So, please, don't make any change here directly, because/
--- /this is intended to be generated from/
+-- /this is intended to be generated automatically from/
 -- "Text.LaTeX.Packages.Hyperref" /module via HaTeX-meta,/
 -- /and therefore, changes must to be done in these places./
 
@@ -35,7 +35,7 @@ >  usepackage [] hyperref
 
 -}
-hyperref :: String
+hyperref :: PackageName
 hyperref = App.hyperref
 
 
Text/LaTeX/Packages/Inputenc.hs view
@@ -1,7 +1,7 @@--{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_HATEX MakeMonadic #-} 
+{-# LANGUAGE OverloadedStrings #-}
+{-# OPTIONS_HATEX MakeMonadic #-}
+
 module Text.LaTeX.Packages.Inputenc
  ( -- * Inputenc package
    inputenc
@@ -11,12 +11,13 @@    ) where
 
 import Text.LaTeX.Base.Syntax
+import Text.LaTeX.Base.Types
 
 -- | Inputenc package.
 -- Example:
 --
 -- > usepackage [utf8] inputenc
-inputenc :: String
+inputenc :: PackageName
 inputenc = "inputenc"
 
 -- | UTF-8 encoding.
@@ -25,4 +26,4 @@ 
 -- | Latin-1 encoding.
 latin1 :: LaTeX
-latin1 = "latin1"+latin1 = "latin1"
Text/LaTeX/Packages/Inputenc/Monad.hs view
@@ -4,7 +4,7 @@ -- 
 -- /For contributors: This module was automatically generated by HaTeX-meta./
 -- /So, please, don't make any change here directly, because/
--- /this is intended to be generated from/
+-- /this is intended to be generated automatically from/
 -- "Text.LaTeX.Packages.Inputenc" /module via HaTeX-meta,/
 -- /and therefore, changes must to be done in these places./
 
@@ -29,7 +29,7 @@ >  usepackage [utf8] inputenc
 
 -}
-inputenc :: String
+inputenc :: PackageName
 inputenc = App.inputenc
 
 -- | UTF-8 encoding.
Text/LaTeX/Packages/Monad.hs view
@@ -5,19 +5,19 @@    -- * Cross-reference packages
  , module Text.LaTeX.Packages.Hyperref.Monad
    -- * Presentation packages
- , module Text.LaTeX.Packages.Beamer.Monad-   -- * Mathematics packages- , module Text.LaTeX.Packages.AMSMath.Monad- , module Text.LaTeX.Packages.AMSFonts.Monad- , module Text.LaTeX.Packages.AMSThm.Monad-   -- * Graphics packages+ , module Text.LaTeX.Packages.Beamer.Monad
+   -- * Mathematics packages
+ , module Text.LaTeX.Packages.AMSMath.Monad
+ , module Text.LaTeX.Packages.AMSFonts.Monad
+ , module Text.LaTeX.Packages.AMSThm.Monad
+   -- * Graphics packages
  , module Text.LaTeX.Packages.Color.Monad
    ) where
 
 import Text.LaTeX.Packages.Inputenc.Monad
 import Text.LaTeX.Packages.Hyperref.Monad
-import Text.LaTeX.Packages.Beamer.Monad-import Text.LaTeX.Packages.AMSMath.Monad-import Text.LaTeX.Packages.AMSFonts.Monad-import Text.LaTeX.Packages.AMSThm.Monad-import Text.LaTeX.Packages.Color.Monad+import Text.LaTeX.Packages.Beamer.Monad
+import Text.LaTeX.Packages.AMSMath.Monad
+import Text.LaTeX.Packages.AMSFonts.Monad
+import Text.LaTeX.Packages.AMSThm.Monad
+import Text.LaTeX.Packages.Color.Monad
license view
@@ -1,4 +1,4 @@-Copyright (c)2011, Daniel Díaz
+Copyright (c)2012, Daniel Díaz
 
 All rights reserved.