简体   繁体   中英

LaTeX in RST processed with Pandoc

I want to use ReStructuredText to take notes, and I sometimes want to add equations to the notes with LaTeX. I followed the advice of both answers to this question, but neither of them worked for me. I have an RST file called foo.rst with these contents:

.. 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$`

Then when I compile this to a pdf with pandoc -o foo.pdf foo.rst , I get this output.

Imgur

If I first compile to tex, I get this:

\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\$

It seems to be escaping the text inside of the raw and latex directives. Is there a way to use inline LaTeX with pandoc and RST?

There are a math directive and a math role that should do the job:

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

Then:

pandoc -o foo.pdf foo.rst

Results in:

在此输入图像描述

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM