Reputation: 4128
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.
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?
Upvotes: 3
Views: 1534
Reputation: 8337
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:
Upvotes: 3