Skip to content

Translating equation references from latex to rst #2077

@drufat

Description

@drufat

Pandoc does not translate equation references from latex to rst correctly. Consider the following very simple latex file, named simple.tex:

\documentclass{article}
\begin{document}

The Euler Identity is given by:

\begin{equation}
e^{i\pi} + 1 = 0
\label{euler}
\end{equation}

and we can refer back to the Euler Identity as Eq. \ref{euler}.

\end{document}

which demonstrates how to use the \label and \ref latex directives to refer to equations.

Translating the above document to restructured text using the command

   $ pandoc -f latex -t rst simple.tex > simple.rst

results in a file simple.rst:

The Euler Identity is given by:

.. math::

   e^{i\pi} + 1 = 0
   \label{euler}

and we can refer back to the Euler Identity as Eq. [euler].

However, this is not the correct way to refer to equations in ReST. According to the sphinx implementation, the correct output should be:

The Euler Identity is given by:

.. math::
    :label: euler

   e^{i\pi} + 1 = 0

and we can refer back to the Euler Identity as Eq. :eq:`euler`.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions