aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorschrieveslaach <schrieveslaach@online.de>2017-07-13 20:56:59 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-07-13 20:56:59 +0200
commit911b63dfc371541700ea16708dc66725b02393f1 (patch)
treef428bb2ca91b30fb2d975c19f3eb89a9a3ad1656 /src/Text/Pandoc
parent8b502dd50ff842bdbbf346a67a607d1a7905bda3 (diff)
downloadpandoc-911b63dfc371541700ea16708dc66725b02393f1.tar.gz
Add LaTeX xspace support (#3797)
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX.hs b/src/Text/Pandoc/Readers/LaTeX.hs
index 9ec84b3f6..f5e387429 100644
--- a/src/Text/Pandoc/Readers/LaTeX.hs
+++ b/src/Text/Pandoc/Readers/LaTeX.hs
@@ -607,6 +607,16 @@ mkImage options src = do
return $ imageWith attr (addExtension src defaultExt) "" alt
_ -> return $ imageWith attr src "" alt
+doxspace :: PandocMonad m => LP m Inlines
+doxspace = do
+ (space <$ lookAhead (satisfyTok startsWithLetter)) <|> return mempty
+ where startsWithLetter (Tok _ Word t) =
+ case T.uncons t of
+ Just (c, _) | isLetter c -> True
+ _ -> False
+ startsWithLetter _ = False
+
+
-- converts e.g. \SI{1}[\$]{} to "$ 1" or \SI{1}{\euro} to "1 €"
dosiunitx :: PandocMonad m => LP m Inlines
dosiunitx = do
@@ -1336,6 +1346,8 @@ inlineCommands = M.fromList $
-- fontawesome
, ("faCheck", lit "\10003")
, ("faClose", lit "\10007")
+ -- xspace
+ , ("xspace", doxspace)
]
ttfamily :: PandocMonad m => LP m Inlines