Вопрос

Here is a simple markdown code:

$$ \alpha = \beta\label{eqone}$$
Refer equation (\ref{eqone}).

When I convert this to html using

pandoc --mathjax file.markdown -o file.html

the \ref{eqone} is omitted in the html output since it is raw tex. Is there a work around to include the raw tex in html output?

I understand that I could have used:

(@eqone) $$\alpha=\beta$$
Refer equation ((@eqone)).

for equation numbering and referencing. This produces the number on the left side and also does not distinguish between figures, tables and equations.

However, mathjax numbering appears on the right like the standard tex output.

Any other work around for proper equation numbering is also welcome.

Note: Following code needs to be added to the head of the generated html file to configure autonumbering in mathjax.

<script type="text/x-mathjax-config">
  MathJax.Hub.Config({ TeX: { equationNumbers: {autoNumber: "all"} } });
</script>
Это было полезно?

Решение

You could try to put the \ref into a math environment, $\ref{eqone}$. And if the command is not defined in math, switch back to text, $\text{\ref{eqone}}$. Ugly, but it might work.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top