@@ -29,7 +29,7 @@ import Prelude
2929import Control.Applicative (many, optional, (<|>))
3030import Control.Monad
3131import Control.Monad.Except (throwError)
32−import Data.Char (isDigit, isLetter, toLower, toUpper)
32+import Data.Char (isDigit, isLetter, toLower, toUpper, chr)
3333import Data.Default
3434import Data.List (intercalate, isPrefixOf)
3535import qualified Data.Map as M
@@ -893,6 +893,8 @@ inlineCommands = M.union inlineLanguageCommands $ M.fromList
893893 , ("cref", rawInlineOr "cref" $ doref "ref") -- from cleveref.sty
894894 , ("vref", rawInlineOr "vref" $ doref "ref+page") -- from varioref.sty
895895 , ("eqref", rawInlineOr "eqref" $ doref "eqref") -- from amsmath.sty
896+ , ("mbox", rawInlineOr "mbox" $ processHBox <$> tok)
897+ , ("hbox", rawInlineOr "hbox" $ processHBox <$> tok)
896898 , ("lettrine", optional opt >> extractSpaces (spanWith ("",["lettrine"],[])) <$> tok)
897899 , ("(", mathInline . toksToString <$> manyTill anyTok (controlSeq ")"))
898900 , ("[", mathDisplay . toksToString <$> manyTill anyTok (controlSeq "]"))
@@ -1287,6 +1289,14 @@ rawInlineOr name' fallback = do
12871289 then rawInline "latex" <$> getRawCommand name' ("\\" <> name')
12881290 else fallback
12891291
1292+processHBox :: Inlines -> Inlines
1293+processHBox = walk convert
1294+ where
1295+ convert Space = Str [chr 160] -- non-breakable space
1296+ convert SoftBreak = Str [chr 160] -- non-breakable space
1297+ convert LineBreak = Str ""
1298+ convert x = x
1299+
12901300getRawCommand :: PandocMonad m => Text -> Text -> LP m String
12911301getRawCommand name txt = do
12921302 (_, rawargs) <- withRaw $