HaTeX 3.9.0.0 → 3.9.1.0
raw patch · 5 files changed
+36/−16 lines, 5 filesdep ~text
Dependency ranges changed: text
Files
- HaTeX.cabal +3/−3
- Text/LaTeX.hs +1/−1
- Text/LaTeX/Base/Render.hs +9/−0
- Text/LaTeX/Packages/Beamer.hs +21/−0
- Text/LaTeX/Packages/TikZ/Syntax.hs +2/−12
HaTeX.cabal view
@@ -1,5 +1,5 @@ Name: HaTeX -Version: 3.9.0.0 +Version: 3.9.1.0 Author: Daniel Díaz Category: Text, LaTeX Build-type: Simple @@ -19,7 +19,7 @@ parse a LaTeX file and obtain its Abstract Syntax Tree (AST), pretty-print Haskell values in LaTeX, generate TikZ scripts easily, ... . - See the @examples@ directory in the source distribution to look some simple examples. + Browse the @examples@ directory in the source distribution to see some simple examples. It would be good to get you started. The HaTeX User's Guide is available at <https://github.com/Daniel-Diaz/hatex-guide/blob/master/README.md>. Cabal-version: >= 1.10 @@ -46,7 +46,7 @@ Build-depends: base == 4.* , bytestring >= 0.9.2.1 && < 0.11 , transformers >= 0.2.2 && < 0.4 - , text >= 0.11.2.3 && < 0.12 + , text >= 0.11.2.3 && < 2 , attoparsec >= 0.10.2 && < 0.11 , matrix , containers >= 0.4.2.1 && < 0.6
Text/LaTeX.hs view
@@ -91,7 +91,7 @@ Both interfaces are fused into one under the 'LaTeXC' class, the class of LaTeX blocks. Particular documentation of each feature can be found in the corresponding module. Further explanation of the library and its concepts can be found in the /HaTeX User's Guide/ -(<http://daniel-diaz.github.com/projects/hatex/HaTeX-Guide.pdf>). +(<https://github.com/Daniel-Diaz/hatex-guide/blob/master/README.md>). -} {- $exm
Text/LaTeX/Base/Render.hs view
@@ -18,6 +18,8 @@ , rendertex -- * Reading files , readFileTex + -- * Util + , showFloat ) where import Data.Text (Text,lines,unlines) @@ -28,6 +30,7 @@ import Data.List (intersperse) import qualified Data.ByteString as B import Data.Word (Word8) +import Numeric (showFFloat) -- | Class of values that can be transformed to 'Text'. -- You mainly will use this to obtain the 'Text' output @@ -148,10 +151,16 @@ -- Other instances +-- | Show a signed floating number using standard decimal notation using 5 decimals. +showFloat :: RealFloat a => a -> String +showFloat x = showFFloat (Just 5) x [] + instance Render Int where instance Render Integer where instance Render Float where + render = fromString . showFloat instance Render Double where + render = fromString . showFloat instance Render Word8 where instance Render a => Render [a] where
Text/LaTeX/Packages/Beamer.hs view
@@ -1,6 +1,27 @@ {-# LANGUAGE OverloadedStrings #-} -- | Beamer is a LaTeX package for the creation of slides. +-- +-- Each frame is contained within the 'frame' function. Here is an example: +-- +-- > {-# LANGUAGE OverloadedStrings #-} +-- > +-- > import Text.LaTeX +-- > import Text.LaTeX.Packages.Beamer +-- > +-- > mySlides :: Monad m => LaTeXT m () +-- > mySlides = do +-- > frame $ do +-- > frametitle "First frame" +-- > "Content of the first frame." +-- > frame $ do +-- > frametitle "Second frame" +-- > "Content of the second frame." +-- > pause +-- > " And actually a little more." +-- +-- The 'pause' command in the second frame makes the second part of the text +-- to appear one screen later. module Text.LaTeX.Packages.Beamer ( -- * Beamer package beamer
Text/LaTeX/Packages/TikZ/Syntax.hs view
@@ -49,7 +49,6 @@ import Data.Monoid import Data.Foldable (foldMap) import qualified Data.Sequence as S-import Numeric (showFFloat) -- POINTS @@ -62,19 +61,10 @@ | RelPoint_ TPoint deriving Show --- | Newtype of double with a custom 'Show' instance.-newtype TikZDouble = TikZDouble Double--instance Show TikZDouble where- show (TikZDouble x) = showFFloat (Just 5) x []--instance Render TikZDouble where- render = fromString . show- instance Render TPoint where render (DimPoint x y) = "(" <> renderCommas [x,y] <> ")"- render (XYPoint x y) = "(" <> renderCommas [TikZDouble x,TikZDouble y] <> ")"- render (XYZPoint x y z) = "(" <> renderCommas [TikZDouble x,TikZDouble y,TikZDouble z] <> ")"+ render (XYPoint x y) = "(" <> renderCommas [x,y] <> ")"+ render (XYZPoint x y z) = "(" <> renderCommas [x,y,z] <> ")" render (RelPoint p) = "++" <> render p render (RelPoint_ p) = "+" <> render p