aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-05-20 09:11:26 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2021-05-20 10:13:20 -0700
commit5dc917da3ed997c6e48e22bde242f0f8e1ae5333 (patch)
tree0816d3315b0130f5868511a873d239f59224676e /src
parent183ce584779b344ad6a6a3e085ddfdb00faf62aa (diff)
downloadpandoc-5dc917da3ed997c6e48e22bde242f0f8e1ae5333.tar.gz
LaTeX reader siunitx: add leading 0 to numbers starting with .
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/LaTeX/SIunitx.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs b/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs
index 5e140ef7a..1474329d4 100644
--- a/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs
+++ b/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs
@@ -83,8 +83,11 @@ parseNumPart =
parseExp, parseSpace :: Parser Text () Inlines
parseDecimalNum = try $ do
pref <- option mempty $ (mempty <$ char '+') <|> ("\x2212" <$ char '-')
- basenum <- (pref <>) . T.pack
- <$> many1 (satisfy (\c -> isDigit c || c == '.'))
+ basenum' <- many1 (satisfy (\c -> isDigit c || c == '.'))
+ let basenum = pref <> T.pack
+ (case basenum' of
+ '.':_ -> '0':basenum'
+ _ -> basenum')
uncertainty <- option mempty $ T.pack <$> parseParens
if T.null uncertainty
then return $ str basenum