@@ -29,7 +29,7 @@ import Prelude
29import Control.Applicative (many, optional, (<|>))
29import Control.Applicative (many, optional, (<|>))
30import Control.Monad
30import Control.Monad
31import Control.Monad.Except (throwError)
31import Control.Monad.Except (throwError)
32−import Data.Char (isDigit, isLetter, toLower, toUpper)
32+import Data.Char (isDigit, isLetter, toLower, toUpper, chr)
33import Data.Default
33import Data.Default
34import Data.List (intercalate, isPrefixOf)
34import Data.List (intercalate, isPrefixOf)
35import qualified Data.Map as M
35import qualified Data.Map as M
@@ -893,6 +893,8 @@ inlineCommands = M.union inlineLanguageCommands $ M.fromList
893 , ("cref", rawInlineOr "cref" $ doref "ref") -- from cleveref.sty
893 , ("cref", rawInlineOr "cref" $ doref "ref") -- from cleveref.sty
894 , ("vref", rawInlineOr "vref" $ doref "ref+page") -- from varioref.sty
894 , ("vref", rawInlineOr "vref" $ doref "ref+page") -- from varioref.sty
895 , ("eqref", rawInlineOr "eqref" $ doref "eqref") -- from amsmath.sty
895 , ("eqref", rawInlineOr "eqref" $ doref "eqref") -- from amsmath.sty
896+ , ("mbox", rawInlineOr "mbox" $ processHBox <$> tok)
897+ , ("hbox", rawInlineOr "hbox" $ processHBox <$> tok)
896 , ("lettrine", optional opt >> extractSpaces (spanWith ("",["lettrine"],[])) <$> tok)
898 , ("lettrine", optional opt >> extractSpaces (spanWith ("",["lettrine"],[])) <$> tok)
897 , ("(", mathInline . toksToString <$> manyTill anyTok (controlSeq ")"))
899 , ("(", mathInline . toksToString <$> manyTill anyTok (controlSeq ")"))
898 , ("[", mathDisplay . toksToString <$> manyTill anyTok (controlSeq "]"))
900 , ("[", mathDisplay . toksToString <$> manyTill anyTok (controlSeq "]"))
@@ -1287,6 +1289,14 @@ rawInlineOr name' fallback = do
1287 then rawInline "latex" <$> getRawCommand name' ("\\" <> name')
1289 then rawInline "latex" <$> getRawCommand name' ("\\" <> name')
1288 else fallback
1290 else fallback
1292+processHBox :: Inlines -> Inlines
1293+processHBox = walk convert
1295+ convert Space = Str [chr 160] -- non-breakable space
1296+ convert SoftBreak = Str [chr 160] -- non-breakable space
1297+ convert LineBreak = Str ""
1290getRawCommand :: PandocMonad m => Text -> Text -> LP m String
1300getRawCommand :: PandocMonad m => Text -> Text -> LP m String
1291getRawCommand name txt = do
1301getRawCommand name txt = do
1292 (_, rawargs) <- withRaw $
1302 (_, rawargs) <- withRaw $