You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having trouble getting both html and latex (to pdf) to render plain math latex environments.
For html to work, equation environments have to be nested inside $...$ but then that doesn't work for latex.
I think this issue was fixed in Pandoc 1.XX?, but I see the issue returning when I use 2.2.
Details below. Thanks for your help, and thanks for Pandoc!
--
Ryan
The contents of the example markdown document I am using are equivalent to
Mathematical expressions
===============================================================================
Typesetting math
-------------------------------------------------------------------------------
You can do latex inline like this:
Euler's formula is remarkable: $e^{i\pi} + 1 = 0$.
Euler's formula is remarkable: $e^{i\pi} + 1 = 0$.
You can use `$$` to make an equation block like this:
$$ \frac{\partial \rho}{\partial t} + \nabla \cdot \vec{j} = 0 \,. \label{eq:continuity} $$
$$ \frac{\partial \rho}{\partial t} + \nabla \cdot \vec{j} = 0 \,. \label{eq:continuity} $$
The latex equation environment can be used directly.
Stokes' theorem is pretty cool:
\begin{equation} \label{eq:stokes}
\int_{\partial\Omega} \omega = \int_{\Omega} \mathrm{d}\omega \,.
\end{equation}
\begin{equation} \label{eq:stokes}
\int_{\partial\Omega} \omega = \int_{\Omega} \mathrm{d}\omega \,.
\end{equation}
You can also refer to labeled equations, such as [@eq:stokes],
with the syntax:
... such as [@eq:stokes],
The `align` environment can also be used.
Maxwell's equations, [@eq:maxwell], are also tough to beat:
\begin{align}
\nabla \cdot \vec{E} &= \rho \nonumber \\
\nabla \cdot \vec{B} &= 0 \nonumber \\
\nabla \times \vec{E} &= - \frac{\partial \vec{B}}{\partial t} \label{eq:maxwell} \\
\nabla \times \vec{B} &= \vec{j} + \frac{\partial \vec{E}}{\partial t} \nonumber \,.
\end{align}
\begin{align}
\nabla \cdot \vec{E} &= \rho \nonumber \\
\nabla \cdot \vec{B} &= 0 \nonumber \\
\nabla \times \vec{E} &= - \frac{\partial \vec{B}}{\partial t} \label{eq:maxwell} \\
\nabla \times \vec{B} &= \vec{j} + \frac{\partial \vec{E}}{\partial t} \nonumber \,.
\end{align}
Mathjax
-------------------------------------------------------------------------------
When doing md $\rightarrow$ tex $\rightarrow$ pdf, LaTeX takes care of the math,
but to render the math in html, we use [MathJax](https://www.mathjax.org/).
Our html template includes the following code
to ask MathJax to render it and number the equations:
<!--- MathJax stuff -->
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ TeX: { equationNumbers: {autoNumber: "all"} } });
</script>
Please note there are "naked" latex environments: \begin{equation}... and \begin{align}.
Things were working fine with an older version of pandoc.
Then if I switch to 2.2:
brew switch pandoc 2.2
Cleaning /usr/local/Cellar/pandoc/1.19.2.4
Cleaning /usr/local/Cellar/pandoc/2.2
5 links created for /usr/local/Cellar/pandoc/2.2
And then run pandoc -t html --standalone --mathjax min.md, I get:
[WARNING] Could not convert TeX math ' \frac{\partial \rho}{\partial t} + \nabla \cdot \vec{j} = 0 \,. \label{eq:continuity} ', rendering as TeX
[WARNING] This document format requires a nonempty <title> element.
Please specify either 'title' or 'pagetitle' in the metadata.
Falling back to 'min'
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>min</title>
<style type="text/css">
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
</style>
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<h1 id="mathematical-expressions">Mathematical expressions</h1>
<h2 id="typesetting-math">Typesetting math</h2>
<p>You can do latex inline like this:</p>
<pre><code>Euler's formula is remarkable: $e^{i\pi} + 1 = 0$.</code></pre>
<p>Euler’s formula is remarkable: <span class="math inline"><em>e</em><sup><em>i</em><em>π</em></sup> + 1 = 0</span>.</p>
<p>You can use <code>$$</code> to make an equation block like this:</p>
<pre><code>$$ \frac{\partial \rho}{\partial t} + \nabla \cdot \vec{j} = 0 \,. \label{eq:continuity} $$</code></pre>
<p><br /><span class="math display">$$ \frac{\partial \rho}{\partial t} + \nabla \cdot \vec{j} = 0 \,. \label{eq:continuity} $$</span><br /></p>
<p>The latex equation environment can be used directly. Stokes’ theorem is pretty cool:</p>
<pre><code>\begin{equation} \label{eq:stokes}
\int_{\partial\Omega} \omega = \int_{\Omega} \mathrm{d}\omega \,.
\end{equation}</code></pre>
<p>You can also refer to labeled equations, such as <span class="citation" data-cites="eq:stokes">[@eq:stokes]</span>, with the syntax:</p>
<pre><code>... such as [@eq:stokes],</code></pre>
<p>The <code>align</code> environment can also be used. Maxwell’s equations, <span class="citation" data-cites="eq:maxwell">[@eq:maxwell]</span>, are also tough to beat:</p>
<pre><code>\begin{align}
\nabla \cdot \vec{E} &= \rho \nonumber \\
\nabla \cdot \vec{B} &= 0 \nonumber \\
\nabla \times \vec{E} &= - \frac{\partial \vec{B}}{\partial t} \label{eq:maxwell} \\
\nabla \times \vec{B} &= \vec{j} + \frac{\partial \vec{E}}{\partial t} \nonumber \,.
\end{align}</code></pre>
<h2 id="mathjax">Mathjax</h2>
<p>When doing md <span class="math inline">→</span> tex <span class="math inline">→</span> pdf, LaTeX takes care of the math, but to render the math in html, we use <a href="https://www.mathjax.org/">MathJax</a>. Our html template includes the following code to ask MathJax to render it and number the equations:</p>
<pre><code><!--- MathJax stuff -->
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ TeX: { equationNumbers: {autoNumber: "all"} } });
</script></code></pre>
</body>
</html>
Note that mathjax output of the naked latex environments is missing!
If I switch back to pandoc 1.19.2.4, everything is ok again.
brew switch pandoc 1.19.2.4
Cleaning /usr/local/Cellar/pandoc/1.19.2.4
Cleaning /usr/local/Cellar/pandoc/2.2
5 links created for /usr/local/Cellar/pandoc/1.19.2.4
The naked latex is passed to the html.
Running pandoc -t html --standalone --mathjax min.md, I get:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML-full" type="text/javascript"></script>
</head>
<body>
<h1 id="mathematical-expressions">Mathematical expressions</h1>
<h2 id="typesetting-math">Typesetting math</h2>
<p>You can do latex inline like this:</p>
<pre><code>Euler's formula is remarkable: $e^{i\pi} + 1 = 0$.</code></pre>
<p>Euler's formula is remarkable: <span class="math inline">\(e^{i\pi} + 1 = 0\)</span>.</p>
<p>You can use <code>$$</code> to make an equation block like this:</p>
<pre><code>$$ \frac{\partial \rho}{\partial t} + \nabla \cdot \vec{j} = 0 \,. \label{eq:continuity} $$</code></pre>
<p><span class="math display">\[ \frac{\partial \rho}{\partial t} + \nabla \cdot \vec{j} = 0 \,. \label{eq:continuity} \]</span></p>
<p>The latex equation environment can be used directly. Stokes' theorem is pretty cool:</p>
<pre><code>\begin{equation} \label{eq:stokes}
\int_{\partial\Omega} \omega = \int_{\Omega} \mathrm{d}\omega \,.
\end{equation}</code></pre>
<span class="math display">\[\begin{equation} \label{eq:stokes}
\int_{\partial\Omega} \omega = \int_{\Omega} \mathrm{d}\omega \,.
\end{equation}\]</span>
<p>You can also refer to labeled equations, such as <span class="citation">[@eq:stokes]</span>, with the syntax:</p>
<pre><code>... such as [@eq:stokes],</code></pre>
<p>The <code>align</code> environment can also be used. Maxwell's equations, <span class="citation">[@eq:maxwell]</span>, are also tough to beat:</p>
<pre><code>\begin{align}
\nabla \cdot \vec{E} &= \rho \nonumber \\
\nabla \cdot \vec{B} &= 0 \nonumber \\
\nabla \times \vec{E} &= - \frac{\partial \vec{B}}{\partial t} \label{eq:maxwell} \\
\nabla \times \vec{B} &= \vec{j} + \frac{\partial \vec{E}}{\partial t} \nonumber \,.
\end{align}</code></pre>
<span class="math display">\[\begin{align}
\nabla \cdot \vec{E} &= \rho \nonumber \\
\nabla \cdot \vec{B} &= 0 \nonumber \\
\nabla \times \vec{E} &= - \frac{\partial \vec{B}}{\partial t} \label{eq:maxwell} \\
\nabla \times \vec{B} &= \vec{j} + \frac{\partial \vec{E}}{\partial t} \nonumber \,.
\end{align}\]</span>
<h2 id="mathjax">Mathjax</h2>
<p>When doing md <span class="math inline">\(\rightarrow\)</span> tex <span class="math inline">\(\rightarrow\)</span> pdf, LaTeX takes care of the math, but to render the math in html, we use <a href="https://www.mathjax.org/">MathJax</a>. Our html template includes the following code to ask MathJax to render it and number the equations:</p>
<pre><code><!--- MathJax stuff -->
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({ TeX: { equationNumbers: {autoNumber: "all"} } });
</script></code></pre>
</body>
</html>
Note that you can now see the <span class="math display"> stuff for each latex environment.
The text was updated successfully, but these errors were encountered:
Similar to the issue reported here: #1938
I am having trouble getting both html and latex (to pdf) to render plain math latex environments.
For html to work, equation environments have to be nested inside
$...$
but then that doesn't work for latex.I think this issue was fixed in Pandoc 1.XX?, but I see the issue returning when I use 2.2.
Details below. Thanks for your help, and thanks for Pandoc!
--
Ryan
The contents of the example markdown document I am using are equivalent to
https://github.com/rreece/markdown-memo/blob/master/05-math.md
Locally, I have saved it as
min.md
.shows
Please note there are "naked" latex environments:
\begin{equation}...
and\begin{align}
.Things were working fine with an older version of pandoc.
Then if I switch to 2.2:
And then run
pandoc -t html --standalone --mathjax min.md
, I get:Note that mathjax output of the naked latex environments is missing!
If I switch back to pandoc 1.19.2.4, everything is ok again.
The naked latex is passed to the html.
Running
pandoc -t html --standalone --mathjax min.md
, I get:Note that you can now see the
<span class="math display">
stuff for each latex environment.The text was updated successfully, but these errors were encountered: