diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-05-20 08:15:48 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-05-20 08:16:46 -0700 |
commit | 8437a4a002210a33ee721c58f5f95605898a8e1b (patch) | |
tree | 13fe56178172d0a3a6a032a73f3adcd5f1671e9e | |
parent | b6239f41509c368b5befd316c290b5b6cc6f00e3 (diff) | |
download | pandoc-8437a4a002210a33ee721c58f5f95605898a8e1b.tar.gz |
LaTeX reader: support `\pm` in `SI{..}`.
Closes #6620.
-rw-r--r-- | src/Text/Pandoc/Readers/LaTeX/SIunitx.hs | 4 | ||||
-rw-r--r-- | test/command/6620.md | 3 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs b/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs index 1952f4e1a..c4fb06700 100644 --- a/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs +++ b/src/Text/Pandoc/Readers/LaTeX/SIunitx.hs @@ -45,7 +45,9 @@ doSI tok = do unit] doSInum :: PandocMonad m => LP m Inlines -doSInum = skipopts *> (tonum . untokenize <$> braced) +doSInum = skipopts *> (tonum . untokenize . map convertPM <$> braced) + where convertPM (Tok pos (CtrlSeq "pm") _) = Tok pos Word "\xb1\xa0" + convertPM t = t tonum :: Text -> Inlines tonum value = diff --git a/test/command/6620.md b/test/command/6620.md index 314200d30..00643e57c 100644 --- a/test/command/6620.md +++ b/test/command/6620.md @@ -7,9 +7,12 @@ \SI{0.135(21)}{\m} \SI{12.3(60)}{\m} + +\SI{10.0 \pm 3.3}{\ms} ^D <p>23 ± 2 m</p> <p>125 ± 12 m</p> <p>0.135 ± 0.021 m</p> <p>12.3 ± 6 m</p> +<p>10.0 ± 3.3 ms</p> ``` |