Improve fix to siunitx numbers with minus.
- use real minus sign
- use tests contributed by Igor Pashev.
commit5271c6b3fbdc72d6a3e0405718f7c98cdf47eda0
authorJohn MacFarlane <jgm@berkeley.edu>
dateMon 16 Nov 2020, 16:36 (6 years ago)
parent734b4c2
src/Text/Pandoc/Readers/LaTeX/SIunitx.hs+1−1
@@ -71,7 +71,7 @@ parseNumPart =
7171 parseSpace
7272 where
7373 parseDecimalNum = do
74− pref <- option mempty $ (mempty <$ char '+') <|> ("-" <$ char '-')
74+ pref <- option mempty $ (mempty <$ char '+') <|> ("\x2212" <$ char '-')
7575 basenum <- (pref <>) . T.pack
7676 <$> many1 (satisfy (\c -> isDigit c || c == '.'))
7777 uncertainty <- option mempty $ T.pack <$> parseParens
test/command/6844.mdnew file+27
@@ -0,0 +1,27 @@
1+Negative numbers with siunitx
2+
3+```
4+% pandoc -f latex -t native
5+\SI{123}{\celsius}
6+
7+^D
8+[Para [Str "123\160\176C"]]
9+```
10+
11+```
12+% pandoc -f latex -t native
13+\SI{-123}{\celsius}
14+
15+^D
16+[Para [Str "\8722\&123\160\176C"]]
17+```
18+
19+```
20+% pandoc -f latex -t native
21+\SI{+123}{\celsius}
22+
23+^D
24+[Para [Str "123\160\176C"]]
25+```
26+
27+
test/command/siunitx-negative-numbers.mddeleted−15
@@ -1,15 +0,0 @@
1−```
2−% pandoc -f latex
3−\SI{+33.3}{\m}
4−
5−\num{+5}
6−
7−\SI{-33.3}{\m}
8−
9−\num{-33}
10−^D
11−<p>33.3 m</p>
12−<p>5</p>
13−<p>-33.3 m</p>
14−<p>-33</p>
15−```