【问题标题】:LaTeX in RST processed with Pandoc使用 Pandoc 处理的 RST 中的 LaTeX
【发布时间】:2014-11-05 17:47:57
【问题描述】:

我想用 ReStructuredText 做笔记,有时我想用 LaTeX 在笔记中添加方程式。我遵循了this 问题的两个答案的建议,但它们都不适合我。我有一个名为 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\$

它似乎正在转义 rawlatex 指令中的文本。有没有办法将内联 LaTeX 与 pandoc 和 RST 一起使用?

【问题讨论】:

标签: latex restructuredtext pandoc pdflatex


【解决方案1】:

有一个 math directive 和一个 math role 应该可以完成这项工作:

The area of a circle is :math:`A_\text{c} = (\pi/4) d^2`.

然后:

pandoc -o foo.pdf foo.rst

结果:

【讨论】:

  • 这是完美的,正是我想要的!谢谢!
  • 这很好,但其他乳胶呢?在 Pandoc Markdown 中,您可以内联任意乳胶代码,它将保持原样,直到将其粘贴到 pandoc 模板中,然后将其编译为 PDF。 reStructuredText 也可以吗?
猜你喜欢
  • 2012-09-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-07-08
  • 1970-01-01
  • 2013-08-26
相关资源
最近更新 更多