marxup 1.0.1 → 1.0.2
raw patch · 5 files changed
+44/−32 lines, 5 filesdep ~basedep ~filepathdep ~mtl
Dependency ranges changed: base, filepath, mtl, pretty
Files
- MarXup/DerivationTrees.hs +4/−4
- MarXup/Latex.hs +29/−18
- MarXup/Tex.hs +2/−3
- examples/LaTeX.hs +3/−2
- marxup.cabal +6/−5
MarXup/DerivationTrees.hs view
@@ -30,7 +30,7 @@ import System.IO.Unsafe import Data.LabeledTree -- import Control.Applicative.State-import Data.Monoid+import Data.Monoid hiding ((<>)) import MarXup.Tex hiding (label) import MarXup.MetaPost @@ -181,13 +181,13 @@ ------------------------------------------ -- Pipeline -derivationTree :: Derivation -> Tex Label-derivationTree j = do +derivationTree :: [String] -> Derivation -> Tex Label+derivationTree opts j = do f <- newLabel a <- delayTop <$> detachTop [Figure f j] bz <- tagifyTop a Metapost $ mapM stringizeFig bz- cmd "includegraphics" (MPFigure f)+ cmd' "includegraphics" opts (MPFigure f) return f -----------------------
MarXup/Latex.hs view
@@ -61,9 +61,19 @@ preamble = do cmd' "documentclass" options (Tex docClass) pre- ----------+-- Lists++item :: Tex a -> Tex a+item x = cmdn' "item" [] [] >> x++enumerate :: [Tex a] -> Tex [a]+enumerate [] = return [] -- latex does not like empty lists.+enumerate xs = env "enumerate" $ + mapM item xs++---------- -- Fonts sf, em :: Tex a -> Tex a@@ -75,37 +85,38 @@ align = env "align*" . mkrows . map mkcols +-- | A block+block :: [TeX] -> TeX block bod = do cmdn' "begin" [] [tex "array", tex "l"] mkrows $ bod cmdn' "end" [] [tex "array"]+ return () math = cmd "ensuremath" mbox = cmd "mbox" displayMath body = Tex "\\[" *> body <* Tex "\\]" -paren bod = do- tex "("- bod- tex ")"--brack bod = do- tex "["- bod- tex "]"+paren = parenthesize (tex "(") (tex ")")+brack = parenthesize (tex "[") (tex "]")+brac = parenthesize (backslash >> tex "{") (backslash >> tex "}")+bigBraces = bigParenthesize (backslash >> tex "{") (backslash >> tex "}") -brac bod = do- backslash >> tex "{"- bod- backslash >> tex "}"+bigParenthesize l r bod = do+ Tex "\\left" >> l+ x <- bod+ Tex "\\right" >> r+ return x+ +parenthesize l r bod = do+ l+ x <- bod+ r+ return x mathsf = cmd "mathsf"--instance Eq TeX where-instance Show TeX where- instance Fractional TeX where a / b = cmdn_ "frac" [a,b]
MarXup/Tex.hs view
@@ -63,9 +63,6 @@ mempty = Tex "" mappend = (>>) -(<>) :: Monoid a => a -> a -> a-(<>) = mappend- instance IsString (Tex ()) where fromString = Tex @@ -126,6 +123,8 @@ backslash = Tex ['\\'] nil = braces (Tex "")++cmd0 c = cmdn' c [] [] >> return () cmd c = cmd' c []
examples/LaTeX.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS_GHC -XTypeSynonymInstances -XOverloadedStrings -XDoRec -pgmF marchup -F #-}+{-# OPTIONS_GHC -XTypeSynonymInstances -XOverloadedStrings -XDoRec -pgmF marxup -F #-} import MarXup.Latex import MarXup.Tex@@ -9,9 +9,10 @@ preamble = do usepackage ["mathletters"] "ucs" usepackage ["utf8x"] "inputenc"+ usepackage [] "graphicx" -someTree = derivationTree $ Node (rule (mbox "modus ponens") "A → B") []+someTree = derivationTree [] $ Node (rule (mbox "modus ponens") "A → B") [] (∶) = binop ":" γ = cmd "Gamma" nil
marxup.cabal view
@@ -1,5 +1,5 @@ name: marxup-version: 1.0.1+version: 1.0.2 category: Text synopsis: Markup language preprocessor for Haskell description:@@ -11,6 +11,7 @@ maintainer: jeanphilippe.bernardy@gmail.com Cabal-Version: >= 1.8 tested-with: GHC==6.12.1+tested-with: GHC==7.4.1 build-type: Simple data-files:@@ -20,17 +21,17 @@ executable marxup extensions: FlexibleInstances, TupleSections main-is: Main.hs- build-depends: base==4.*- build-depends: pretty==1.0.*+ build-depends: base>=4.2&&<=5+ build-depends: pretty==1.1.* build-depends: parsec==2.1.* library extensions: FlexibleInstances, TypeSynonymInstances, GADTs build-depends: base==4.* -- build-depends: pandoc==1.5.* (broken)- build-depends: mtl==2.0.*+ build-depends: mtl==2.1.* build-depends: labeled-tree==1.* - build-depends: filepath==1.1.* + build-depends: filepath==1.3.* exposed-modules: MarXup.Tex exposed-modules: MarXup.MetaPost