Spaces in multi characters variable name in pandoc

2019-07-31 14:45发布

问题:

I'm writing a Haskell program to export some mathematics formula to docx and I have noted that variable names with multiple character are written with a blank white space between each letter and I don't understand why ?

My basic code is :

import Text.Pandoc
import Data.Map (fromList)
import qualified Data.ByteString.Lazy as B

main = do
  document <- writeDocx WriterOptions{ writerStandalone=False
                                     , writerReferenceDocx=Nothing
                                     , writerUserDataDir=Nothing
                                     , writerHighlight= False
                                     }  pandoc
  B.writeFile "document.docx" document

pandoc = Pandoc ( Meta {unMeta = fromList []})
                           [ Para  [Str "A small Math example"]
                           , Plain [Math InlineMath "A_e = var + 5"]
                           , HorizontalRule
                           ]

and the result is :

and I would like to get :

I tried to modify the string defining my equation to

Math InlineMath "A_e = {var} + 5"

but It didn't change anything

I also tried :

Math InlineMath "A_e = \\{var\\} + 5"

But It gave :

Do you know how to remove these boring white spaces ?

回答1:

It's actually texmath that takes care of the latex->omml conversion (OMML is the xml format that docx uses). So you should post a bug there.