Pandoc: Cannot convert math with `\over` command

Created on 12 Jan 2018  Â·  8Comments  Â·  Source: jgm/pandoc

input: demo.md

$$x+1\over\sqrt{1-x^2}$$

command:

pandoc -f markdown demo.md      

error:

[WARNING] Could not convert TeX math 'x+1\over\sqrt{1-x^2}', rendering as TeX:
  x+1\over\sqrt{1-x^2}
          ^
  unexpected "\\"
  expecting "%", "\\label", "\\nonumber" or whitespace
<p><br /><span class="math display">$$x+1\over\sqrt{1-x^2}$$</span><br /></p>

The error also happens if I try to convert demo.md into docx. The tex equation are not converted.

Pandoc version info is

pandoc 2.0.1.1
Compiled with pandoc-types 1.17.2, texmath 0.10, skylighting 0.4.3.2
Default user data directory: /Users/abner/.pandoc
Copyright (C) 2006-2017 John MacFarlane
Web:  http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.

Most helpful comment

By default pandoc will try to "fake it with unicode" for math.
But it can't really fake fractions. So here it just spits out
the raw TeX.

If you have fractions, you need to use --mathjax, --katex, or
some other method for rendering math in HTML.

Shaun Jackman notifications@github.com writes:

[WARNING] Could not convert TeX math '\textrm{PPV} = \frac{55}{210} = 0.26', rendering as TeX

What should I use instead of \frac{…}{…} inside $ math goes here $?

--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/jgm/pandoc/issues/4251#issuecomment-391829845

All 8 comments

Use \frac{x+1}{\sqrt{1-x^2} instead. This is the
idiomatic LaTeX version.
https://tex.stackexchange.com/questions/73822/what-is-the-difference-between-over-and-frac

The texmath library doesn't yet implement \over. If you
want to request support for it, put up an issue at
jgm/texmath.

It is not recommended to use \over because the semantics are a little freaky. Consider

\documentclass{article}
\begin{document}
$\displaystyle \int f(x) dx \over \sum_i f(x_i)$
\end{document}

You'd expect both the numerator and the denominator to be in display style, but this is the ouput
test
Please also have a look at Why is \[ … \] preferable to $$?

The texmath library doesn't yet implement \over. If you want to request support for it, put up an issue at jgm/texmath.

Thus closing this.

[WARNING] Could not convert TeX math '\textrm{PPV} = \frac{55}{210} = 0.26', rendering as TeX

What should I use instead of \frac{…}{…} inside $ math goes here $ with Pandoc 2.2.1?

By default pandoc will try to "fake it with unicode" for math.
But it can't really fake fractions. So here it just spits out
the raw TeX.

If you have fractions, you need to use --mathjax, --katex, or
some other method for rendering math in HTML.

Shaun Jackman notifications@github.com writes:

[WARNING] Could not convert TeX math '\textrm{PPV} = \frac{55}{210} = 0.26', rendering as TeX

What should I use instead of \frac{…}{…} inside $ math goes here $?

--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/jgm/pandoc/issues/4251#issuecomment-391829845

Is it possible to use \[ instead of $$? @hmenke @jgm
I find \[ not work in pandoc.
Here is a demo

@xu-song yes, see http://pandoc.org/MANUAL.html#extension-tex_math_single_backslash e.g.

pandoc -f markdown+tex_math_single_backslash --mathjax

thanks, it works

Was this page helpful?
0 / 5 - 0 ratings