@@ -668,6 +668,8 @@ inlineCommands = M.fromList $
668668 , ("nocite", mempty <$ (citation "nocite" NormalCitation False >>=
669669 addMeta "nocite"))
670670 , ("hypertarget", braced >> tok)
671+ -- siuntix
672+ , ("SI", dosiunitx)
671673 ] ++ map ignoreInlines
672674 -- these commands will be ignored unless --parse-raw is specified,
673675 -- in which case they will appear as raw latex blocks:
@@ -726,6 +728,21 @@ dolstinline = do
726728doLHSverb :: PandocMonad m => LP m Inlines
727729doLHSverb = codeWith ("",["haskell"],[]) <$> manyTill (satisfy (/='\n')) (char '|')
728730
731+-- converts e.g. \SI{1}[\$]{} to "$ 1" or \SI{1}{\euro} to "1 €"
732+dosiunitx :: PandocMonad m => LP m Inlines
733+dosiunitx = do
734+ skipopts
735+ value <- tok
736+ valueprefix <- option "" $ char '[' >> (mconcat <$> manyTill tok (char ']'))
737+ unit <- tok
738+ let emptyOr160 "" = ""
739+ emptyOr160 _ = "\160"
740+ return . mconcat $ [valueprefix,
741+ emptyOr160 valueprefix,
742+ value,
743+ emptyOr160 unit,
744+ unit]
745+
729746lit :: String -> LP m Inlines
730747lit = pure . str
731748