Math using additional packages fails to render.
asmyers opened this issue · comments
Andrew Myers commented
I was trying to use this to compile the .tex
file from this repository
to an epub book. The filter generally works really well! However, that book makes liberal use of math macros from additional packages, resulting in errors like this one instead of rendered math:
No file working.aux.
! Undefined control sequence.
<recently read> \mathbb
l.7 \mathbb
D &=& \{{\mathsf{E}}, {\mathsf{O}}, \top\} \\
[1] (./working.aux) )
(see the transcript file for additional information)
Output written on working.dvi (1 page, 1608 bytes).
Transcript written on working.log.
Is there an undocumented way to provide a template which includes those packages?
Liam O'Connor commented
The provided filter is just an example. If you recompile it with different options, you can include arbitrary packages in the prelude.
For example,
import Image.LaTeX.Render.Pandoc
import Image.LaTeX.Render
import Text.Pandoc.JSON
import Text.Pandoc.Definition
myPreamble = "\\usepackage{amsmath}\\usepackage{amssymb}"
main :: IO ()
main = toJSONFilter $ convertFormulaDataURI defaultEnv formulaOpts
where
formulaOpts = defaultPandocFormulaOptions
{ formulaOptions = \x -> case x of
InlineMath -> math { preamble = myPreamble }
DisplayMath -> displaymath { preamble = myPreamble }
}