I have a markdown document with lots of equations (mathjax I think) which renders fine with the application Marked 2. When I try to convert it to pdf with pandoc to create the bibliography, I get an error.
For example, with
\\[ \mu_{s,h,d,y} = \left\{
\begin{array}{1 1}
\omega_{s,h,d,y} + \delta_{s}(t_{s,h,d-1,y} - \omega_{s,h,d-1,y}) & \quad \text{for $t_{s,h,d-1,y}$ is real} \\
\omega_{s,h,d,y} & \quad \text{for $t_{s,h,d-1,y}$ is not real}
\end{array} \right.
\\]
It looks like
However, when I run
pandoc -H format.sty -V fontsize=12pt --bibliography northeast_temperature_refs.bib --csl=american-geophysical-union.csl northeast_temperature_ms2.md -o northeast_temperature_ms.pdf --mathjax
with or without --mathjax
I get the following error
! Missing $ inserted.
<inserted text>
$
l.268 \textbackslash{}{[} \mu
pandoc: Error producing PDF from TeX source
If I try to use $$
instead of \\\\[
like:
$$
\mu_{s,h,d,y} = \left\{
\begin{array}
\omega_{s,h,d,y} + \delta_{s}(t_{s,h,d-1,y} - \omega_{s,h,d-1,y}) & \quad \text{for $$t_{s,h,d-1,y}$$ is real} \\
\omega_{s,h,d,y} & \quad \text{for $$t_{s,h,d-1,y}$$ is not real}
\end{array} \right.
$$
I get the following error:
! LaTeX Error: Illegal character in array arg.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.278 \begin{array}{1 1}
pandoc: Error producing PDF from TeX source
This is my first time ever trying to write equations outside a canned program so any help would be appreciated. I thought I was doing such a good job when I did quick checks with Marked but apparently it doesn't work with pandoc the way I have it.
I am on a Mac with Yosemite and have MacTex installed.
Marked uses a different markdown processor under the hood (MultiMarkdown) than Pandoc, which has different syntax for equations ( \\\\[ \\\\]
instead of $$
). If you want to write in a single format for both Marked previewing/HTML and pandoc PDF/anything else output, you can change Marked's processor to Pandoc (directions here ). This way you can use $$
syntax for everything.
I think that pandoc doesn't cover the array command, as your command doesn't work for me in an IPython notebook. However, replacing the array command with a cases
statement does work for me:
\\[ \mu_{s,h,d,y} = \begin{cases}
\omega_{s,h,d,y} + \delta_{s}(t_{s,h,d-1,y} - \omega_{s,h,d-1,y}) & \quad \text{for $t_{s,h,d-1,y}$ is real} \\
\omega_{s,h,d,y} & \quad \text{for $t_{s,h,d-1,y}$ is not real}
\end{cases}
\\]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.