Skip to content
This repository was archived by the owner on Sep 28, 2023. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Text/LaTeX/Base/Render.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module Text.LaTeX.Base.Render
, showFloat
) where

import Data.Maybe (fromMaybe)
import Data.Text (Text,lines,unlines)
import Text.LaTeX.Base.Syntax
import Text.LaTeX.Base.Class
Expand Down Expand Up @@ -127,7 +128,11 @@ instance Render LaTeX where
render (TeXMath Square l) = "\\[" <> render l <> "\\]"
render (TeXMath Parentheses l) = "\\(" <> render l <> "\\)"

render (TeXLineBreak m b) = "\\\\" <> maybe mempty (\x -> "[" <> render x <> "]") m <> ( if b then "*" else mempty )
-- It is not safe to simply say \\, if the text following it starts
-- with a left square bracket or a star you will get an error or
-- something unexpected. I think this is why you see "\\%\n" so
-- often. Here I supply a zero "extra vertical space" argument.
render (TeXLineBreak m b) = "\\\\" <> (if b then "*" else mempty) <> "[" <> render (fromMaybe (Em 0.0) m) <> "]"

render (TeXBraces l) = "{" <> render l <> "}"

Expand Down