![](/img/trans.png)
[英]How do I convert a markdown file with centered text in atom, using pandoc-convert to pdf?
[英]How do I convert markdown equations to pdf using pandoc
我有一个Markdown文档,其中包含许多方程式(我认为是mathjax),使用Marked 2应用程序可以很好地呈现。当我尝试使用pandoc将其转换为pdf来创建参考书目时,出现错误。
例如,
\\[ \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.
\\]
看起来像
但是,当我跑步时
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
有或没有--mathjax
我都会收到以下错误
! Missing $ inserted.
<inserted text>
$
l.268 \textbackslash{}{[} \mu
pandoc: Error producing PDF from TeX source
如果我尝试使用$$
代替\\\\[
例如:
$$
\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.
$$
我收到以下错误:
! 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
这是我第一次尝试在固定程序之外编写方程式,因此将不胜感激。 当我对Marked进行快速检查时,我以为自己做得很好,但是显然,它与pandoc的工作方式不一样。
我在装有优胜美地的Mac上并安装了MacTex。
Marked在引擎盖下使用了与Pandoc不同的Markdown处理器(MultiMarkdown),后者对等式具有不同的语法( \\\\[ \\\\]
而不是$$
)。 如果您要为Marked预览/ HTML和pandoc PDF /其他任何输出都以单一格式编写,则可以将Marked的处理器更改为Pandoc( 此处的指示)。 这样,您可以对所有内容使用$$
语法。
我认为pandoc不会涵盖array命令,因为您的命令在IPython笔记本中对我不起作用。 但是,用cases
语句替换array命令确实对我有用:
\\[ \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}
\\]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.