Latex 用Pandoc处理RST中的乳胶
我想用ReStructuredText做笔记,有时我想用LaTeX给笔记添加方程式。我听从了两个问题答案的建议,但它们都不适合我。我有一个名为Latex 用Pandoc处理RST中的乳胶,latex,restructuredtext,pandoc,pdflatex,Latex,Restructuredtext,Pandoc,Pdflatex,我想用ReStructuredText做笔记,有时我想用LaTeX给笔记添加方程式。我听从了两个问题答案的建议,但它们都不适合我。我有一个名为foo.RST的RST文件,其中包含以下内容: .. role:: latex(raw) :format: latex ============== This is a test ============== Test with latex role :latex:`\Delta X` Test with raw role :raw:`\Del
foo.RST
的RST文件,其中包含以下内容:
.. role:: latex(raw)
:format: latex
==============
This is a test
==============
Test with latex role :latex:`\Delta X`
Test with raw role :raw:`\Delta X`
Test with raw role and $ :raw:`$\Delta X$`
Test with raw role and $ :raw:`$\Delta X$`
然后,当我用pandoc-o foo.pdf foo.rst
将其编译成pdf时,我得到了这个输出
如果我首先编译为tex,我会得到以下结果:
\section{This is a test}\label{this-is-a-test}
Test with latex role \textbackslash{}Delta X
Test with raw role \textbackslash{}Delta X
Test with raw role and \$ \$\textbackslash{}Delta X\$
Test with raw role and \$ \$\textbackslash{}Delta X\$
它似乎在转义raw
和latex
指令中的文本。有没有办法将内联乳胶与pandoc和RST一起使用?有a和a可以完成这项工作:
The area of a circle is :math:`A_\text{c} = (\pi/4) d^2`.
然后:
结果:
你在邮件列表上询问可能会更成功。这太完美了,正是我想要的!非常感谢。很好,但是其他乳胶呢?在Pandoc Markdown中,您可以内联任意latex代码,它将保持原样,直到粘贴到Pandoc模板中,然后编译为PDF。这是否也适用于StructuredText?
pandoc -o foo.pdf foo.rst