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

Commit

Permalink
Add special case to rendering for TeXCommS.
Browse files Browse the repository at this point in the history
Update `render` in Render.hs so that rendering TeXSeq inserts spaces
after TeXCommS when necessary.
  • Loading branch information
rpglover64 committed Feb 13, 2015
1 parent 9495907 commit d68283d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Text/LaTeX/Base/Render.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ module Text.LaTeX.Base.Render
, showFloat
) where

import Data.Text (Text,lines,unlines)
import Data.Text (Text,lines,unlines,uncons)
import Text.LaTeX.Base.Syntax
import Text.LaTeX.Base.Class
import Data.String
import Data.Char (isAlpha)
import Data.Text.Encoding
import Data.List (intersperse)
import qualified Data.ByteString as B
Expand Down Expand Up @@ -136,6 +137,11 @@ instance Render LaTeX where
in if null xs then "%\n"
else Data.Text.unlines $ fmap ("%" <>) xs

render (TeXSeq l1@(TeXCommS _) l2) = let r2 = render l2 in
render l1 <> (case uncons r2 of
Just (c,_) | isIdentChar c -> " "
_ -> "") <> r2
where isIdentChar = isAlpha
render (TeXSeq l1 l2) = render l1 <> render l2
render TeXEmpty = mempty

Expand Down

0 comments on commit d68283d

Please sign in to comment.