Skip to content
This repository has been archived by the owner on Sep 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #83 from romildo/math-space
Browse files Browse the repository at this point in the history
Implement missing math space commands
  • Loading branch information
Daniel-Diaz committed Jul 24, 2016
2 parents 2094faa + ebf7537 commit 1c414f5
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 9 deletions.
23 changes: 23 additions & 0 deletions Examples/mathSpaces.hs
@@ -0,0 +1,23 @@
{-# LANGUAGE OverloadedStrings #-}

module Main where

import Text.LaTeX
import Text.LaTeX.Packages.AMSMath

main :: IO ()
main = execLaTeXT mathSpaces >>= renderFile "mathSpaces.tex"

mathSpaces :: Monad m => LaTeXT_ m
mathSpaces = do
documentclass [] article
usepackage [] amsmath
document $
tabular Nothing [RightColumn, LeftColumn] $ do
texttt "quad" & math ("H" >> quad >> "H") ; lnbk
texttt "qquad" & math ("H" >> qquad >> "H") ; lnbk
texttt "thinspace" & math ("H" >> thinspace >> "H") ; lnbk
texttt "medspace" & math ("H" >> medspace >> "H") ; lnbk
texttt "thickspace" & math ("H" >> thickspace >> "H") ; lnbk
texttt "negspace" & math ("H" >> negspace >> "H") ; lnbk
texttt "space" & math ("H" >> space >> "H")
27 changes: 18 additions & 9 deletions Text/LaTeX/Packages/AMSMath.hs
Expand Up @@ -119,6 +119,7 @@ module Text.LaTeX.Packages.AMSMath
, v2matrix
-- * Math spacing
, quad, qquad
, thinspace, medspace, thickspace, negspace, space
) where

import Text.LaTeX.Base
Expand Down Expand Up @@ -1055,14 +1056,22 @@ quad = comm0 "quad"
qquad :: LaTeXC l => l
qquad = comm0 "qquad"

{-
The following commands are pending. Someone needs to find suitable
names for them.
-- | \, space equal to 3/18 of \quad (= 3 mu)
thinspace :: LaTeXC l => l
thinspace = comm0 ","

-- | \: space equal to 4/18 of \quad (= 4 mu)
medspace :: LaTeXC l => l
medspace = comm0 ":"

-- | \: space equal to 5/18 of \quad (= 5 mu)
thickspace :: LaTeXC l => l
thickspace = comm0 ";"

\, 3/18 of \quad (= 3 mu)
\: 4/18 of \quad (= 4 mu)
\; 5/18 of \quad (= 5 mu)
\! -3/18 of \quad (= -3 mu)
\ (space after backslash!) equivalent of space in normal text
-- | \! space equal to -3/18 of \quad (= -3 mu)
negspace :: LaTeXC l => l
negspace = comm0 "!"

-}
-- | \ (space after backslash) equivalent of space in normal text
space :: LaTeXC l => l
space = comm0 " "

0 comments on commit 1c414f5

Please sign in to comment.