Skip to content

Display Math in LaTex became Inline Math in HTML/MathML #1719

@rgaiacs

Description

@rgaiacs

From W3C MathML Specification:

(The display attribute) specifies whether the enclosed MathML expression should be rendered as a separate vertical block (in display style) or inline, aligned with adjacent text.

The display="block" attribute isn't include in any LaTeX math environment.

TeX shorthand

Steps to reproduce

$ pandoc --version
pandoc 1.13.2
$ cat sample.tex 
\documentclass{article}
\usepackage{amsmath}
\begin{document}
$$x$$
\end{document}
$ pandoc -f latex -t html5 --mathml -o sample.html sample.tex 

Actual Results

$ cat sample.html
<p><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>x</mi><annotation encoding="application/x-tex">x</annotation></semantics></math></p>

Expected Results

$ cat sample.html
<p><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mi>x</mi><annotation encoding="application/x-tex">x</annotation></semantics></math></p>

LaTeX shorthand

Steps to reproduce

$ cat sample.tex 
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[x\]
\end{document}
$ pandoc -f latex -t html5 --mathml -o sample.html sample.tex

Actual Results

$ cat sample.html
<p><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>x</mi><annotation encoding="application/x-tex">x</annotation></semantics></math></p>

Expected Results

$ cat sample.html
<p><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mi>x</mi><annotation encoding="application/x-tex">x</annotation></semantics></math></p>

Equation Environment

Steps to reproduce

$ cat sample.tex 
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
  x
\end{equation}
\end{document}
$ pandoc -f latex -t html5 --mathml -o sample.html sample.tex

Actual Results

$ cat sample.html                                            
<p><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>x</mi><annotation encoding="application/x-tex">x</annotation></semantics></math></p>

Expected Results

$ cat sample.html                                            
<p><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mi>x</mi><annotation encoding="application/x-tex">x</annotation></semantics></math></p>

Align Environment

Steps to reproduce

$ cat sample.tex                                                                                                
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
  x
\end{align}
\end{document}
[raniere@pupunha] /tmp/tex
$ pandoc -f latex -t html5 --mathml -o sample.html sample.tex

Actual Results

$ cat sample.html                                                                                               
<p><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mtable><mtr><mtd columnalign="right"><mi>x</mi></mtd></mtr></mtable><annotation encoding="application/x-tex">\begin{aligned}
  x\end{aligned}</annotation></semantics></math></p>

Expected Results

$ cat sample.html                                                                                               
<p><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mtable><mtr><mtd columnalign="right"><mi>x</mi></mtd></mtr></mtable><annotation encoding="application/x-tex">\begin{aligned}
  x\end{aligned}</annotation></semantics></math></p>

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions