HaTeX 2.1.1 → 2.1.2
raw patch · 6 files changed
+63/−42 lines, 6 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- HaTeX.cabal +12/−6
- Text/LaTeX.hs +29/−21
- Text/LaTeX/Arguments.hs +6/−1
- Text/LaTeX/Commands.hs +8/−8
- Text/LaTeX/Define.hs +3/−3
- Text/LaTeX/Result.hs +5/−3
HaTeX.cabal view
@@ -1,16 +1,18 @@ Name: HaTeX -Version: 2.1.1 +Version: 2.1.2 Author: Daniel Diaz Homepage: http://ddiaz.asofilak.es/packages/HaTeX License: BSD3 License-file: license Maintainer: danieldiaz@asofilak.es Category: Text -Synopsis: Library for write LaTeX code. +Synopsis: Monadic tool for write LaTeX files. Description: - You can write LaTeX files using this package. - See Text.LaTeX for a brief introduction. + See <http://www.haskell.org/haskellwiki/HaTeX> for a brief introduction. + Also included in Text.LaTeX module API documentation. . + More information in /HaTeX, a monadic perspective of LaTeX/, available in the package homepage. + . Report any bug or suggestion to the author: . danieldiaz\@asofilak.es @@ -19,9 +21,13 @@ . Changes from last version: . - * Now, Text.LaTeX module re-export Data.String. + * Fixed a bug in @lnbk@ and @lnbk_@ functions. They need no more adding an extra space after their use. . - * Fixed some documentation. + * Modified some documentation. + . + * Added some documentation. + . + * Removed an unnecesary import from Text.LaTeX.Result. Extensions: OverloadedStrings , FlexibleInstances , TypeSynonymInstances Build-type: Simple Build-depends: base == 4.*
Text/LaTeX.hs view
@@ -6,6 +6,9 @@ -- at the HaTeX home page: <http://ddiaz.asofilak.es/packages/HaTeX>. module Text.LaTeX ( -- * How to use HaTeX + -- ** About HaTeX + -- $guide0 + -- ** Introduction -- $guide1 @@ -64,7 +67,7 @@ -- | Your HaTeX version. hatexVersion :: Monad m => LaTeX m -hatexVersion = do textbf "2" ; ".1.1" +hatexVersion = do textbf "2" ; ".1.2" -- | Render 'LaTeX' to 'String'. render :: Monad m => LaTeX m -> m String @@ -82,6 +85,14 @@ ----------------------------------------------------------------------------------------------------------- +{- $guide0 +HaTeX is a package which lets you to write LaTeX code from Haskell. + +HaTeX page: <http://ddiaz.asofilak.es/packages/HaTeX> + +Here a link to the package in Hackage: <http://hackage.haskell.org/package/HaTeX> +-} + -- Introduction {- $guide1 @@ -96,7 +107,7 @@ {- $guide2 A LaTeX file has two parts: -- A header where you define general settings (document class, page style, use of extern packages, ...) of your document. +- A /preamble/ where you define general settings (document class, page style, use of extern packages, ...) of your document. - The document's content. -} @@ -106,13 +117,13 @@ {- $guide3 We're going to write an example, the best for understanding. -* Function 'documentclass' is used for determining if our document is an 'article', a 'book', a 'report', etc. +* Function 'documentclass' is used for determining if our document is an 'article', a 'book', a 'report', etc. -* Function 'author' is used for specify document's authory. +* Function 'author' is used for specify document's authory. -* Function 'title' for document's title. +* Function 'title' for document's title. -Then, with this three functions, we will define a header in the 'LaTeX' monad. +Then, with this three functions, we will define a preamble in the 'LaTeX' monad. 'LaTeX' is a writer monad that concatenates the text generated by the programmer. Usually, the text is generated simply writing it, or by functions. @@ -138,11 +149,14 @@ > example = do documentclass [] article > author "Daniel Diaz" > title "Example" -> document hello +> document $ do maketitle +> hello -At first glance, it seems that 'author', 'title' or 'document' receive a @String@ as argument. +/Note: /'maketitle'/ doesn't work in some document classes./ + +At first glance, it seems that 'author', 'title' or 'document' receive a 'String' as argument. Really, they require a 'LaTeX' argument. 'LaTeX' is the type that represents texts in HaTeX. -So, I recommend to use /Overloaded Strings/ +So, I recommend to use Overloaded Strings (See <http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/type-class-extensions.html#overloaded-strings>). -} @@ -150,9 +164,7 @@ {- $guide4 There are numerous functions to enrich your document. -One feature is change your font format with the functions shown here: "Text.LaTeX.Commands#Fonts". - -For example, in: +One feature is change your font format. For example, in: > texttt "Hello!" @@ -160,9 +172,9 @@ > texttt $ textbf "Hello!" -'textbf' sets as bold font the monospaced font of @\"Hello!\"@. +'textbf' sets as bold font the monospaced font of '"Hello!"'. -If you only want @\"ll\"@ with bold format: +If you only want '"ll"' with bold format: > texttt $ do "He" > textbf "ll" @@ -175,7 +187,6 @@ {- $guide5 All computations in HaTeX take place in the 'LaTeXT' monadic transformer. - To includes a monadic computation, use 'mlx'. > gtime = do t <- mlx getClockTime @@ -186,14 +197,11 @@ -- Adding sections {- $guide6 -Commands to adding sections are included in "Text.LaTeX.Commands". -Examples are 'section' or 'paragraph'. +Commands to adding sections are included in Text.LaTeX.Commands. Examples are 'section' or 'paragraph'. -If you want sections without number, use 'section_'. -This also avoid showing the section into the table of contents. +If you want sections without number, use 'section_'. This also avoid showing the section into the table of contents. -If you want title of section to be different in the context than in the table of contents, -use 'sectiontab'. +If you want title of section to be different in the context than in the table of contents, use 'sectiontab'. -}
Text/LaTeX/Arguments.hs view
@@ -54,6 +54,7 @@ , width, height, depth , totalheight -- $measures + -- ** Measures , mm , cm , inch , pt , em , ex @@ -179,15 +180,19 @@ -- - +-- | Page style for a LaTeX document. type Style m = LaTeX m +-- | Page numbers on the bottom of the page, at the middle of the footer. +-- Default style. plain :: Monad m => Style m plain = "plain" +-- | Current chapter and page number at the top of the page. headings :: Monad m => Style m headings = "headings" +-- | Empty page style. empty :: Monad m => Style m empty = "empty"
Text/LaTeX/Commands.hs view
@@ -156,15 +156,15 @@ -- --- | In header, determines the document class. +-- | In preamble, determines the document class. documentclass :: Monad m => [ClassOption m] -> Class m -> LaTeX m documentclass = comm4 "documentclass" --- | In header, import a package. +-- | In preamble, import a package. usepackage :: Monad m => [PackageOption m] -> Package m -> LaTeX m usepackage = comm4 "usepackage" --- | In header, determines page style. +-- | In preamble, determines page style. pagestyle :: Monad m => Style m -> LaTeX m pagestyle = comm1 "pagestyle" @@ -172,15 +172,15 @@ thispagestyle :: Monad m => Style m -> LaTeX m thispagestyle = comm1 "thispagestyle" --- | In header, especifies the document's author. +-- | In preamble, especifies the document's author. author :: Monad m => Name m -> LaTeX m author = comm1 "author" --- | In header, especifies the document's title. +-- | In preamble, especifies the document's title. title :: Monad m => Title m -> LaTeX m title = comm1 "title" --- | In header, inserts a date of writing. +-- | In preamble, inserts a date of writing. -- If you don't specify one, it takes the date of export. date :: Monad m => Date m -> LaTeX m date = comm1 "date" @@ -195,14 +195,14 @@ -- | Starts a new line. lnbk :: Monad m => LaTeX m -lnbk = comm0_ "\\" +lnbk = comm0_ "\\ " -- | Starts a new paragraph. pfbk :: Monad m => LaTeX m pfbk = newline >> newline lnbk_ :: Monad m => LaTeX m -lnbk_ = comm0_ "\\*" +lnbk_ = comm0_ "\\* " -- | Starts a new page. newpage :: Monad m => LaTeX m
Text/LaTeX/Define.hs view
@@ -1,8 +1,8 @@ {-# LANGUAGE OverloadedStrings #-} --- | This module allows you to add commands and environments of LaTeX wich are not defined in HaTeX. --- Usually, you don't need to use this functions. +-- | This module allows you to add commands and environments of LaTeX which are not defined in HaTeX. +-- Usually, you don't need to use these functions. -- -- If a desired command doesn't appear in HaTeX and you need it, use these functions and report the missing function to the maintainer. module Text.LaTeX.Define ( @@ -30,7 +30,7 @@ import Control.Monad.Writer import Data.List (intersperse) -import Data.String.Combinators (braces,comma,brackets) +import Data.String.Combinators (braces,comma,brackets,between) import Text.LaTeX.Monad import Text.LaTeX.Result
Text/LaTeX/Result.hs view
@@ -1,4 +1,4 @@- + {-# LANGUAGE OverloadedStrings #-} module Text.LaTeX.Result ( @@ -15,24 +15,26 @@ import Data.String (fromString) import Data.String.ToString (toString) -import Data.String.Combinators - -- Result Type -------------- -- Instances needed: Monoid, IsString, ToString +-- | The state of the @LaTeX@ monad. A 'Result' is represented by a 'DString'. type Result = DString -- +-- | Transform a 'String' to a 'Result'. toResult :: String -> Result toResult = fromString +-- | Transform a 'Result' to a 'String'. fromResult :: Result -> String fromResult = toString ------------------------------------ +-- | Set of LaTeX reserved characters, and their safe writings as 'Result's. resCharsStr :: [(Char,Result)] resCharsStr = [ ('#',"\\#") , ('$',"\\$")