Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LaTeX parser fails on nested math environments when $$ is used #3164

Closed
cazgp opened this issue Oct 17, 2016 · 4 comments
Closed

LaTeX parser fails on nested math environments when $$ is used #3164

cazgp opened this issue Oct 17, 2016 · 4 comments

Comments

@cazgp
Copy link

cazgp commented Oct 17, 2016

This MWE compiles fine in latex.

\documentclass{article}

\begin{document}
$$
{\mbox{\boldmath $\theta $}}_2||^2
$$
\end{document}

However, pandoc fails when reading it:

$ pandoc -f latex problem.tex -o test.xml
pandoc: 
Error at "source" (line 5, column 33):
unexpected "^"
expecting "%", lf new-line, "\\", "{", "-", "``", "\8220", "\"`", "\"", "`", "\8216", "''", "\8221", "'", "\8217", "~", "$$", "$", "^^", "&" or \end{document}
{\mbox{\boldmath $\theta $}}_2||^2

If, however, the $$ delimiters are changed to \begin{displaymath}, then it works fine.

@jgm
Copy link
Owner

jgm commented Oct 17, 2016

This issue should really be in jgm/texmath, which handles
math for pandoc.

texmath doesn't handle well commands that act as "switches",
like \boldmath. It likes commands with explicit arguments,
such as \mathbf. This could be improved in future versions.

Note that you should be able to do:

\mbox{$\mathbf{\theta}$}_2||^2

@cazgp
Copy link
Author

cazgp commented Oct 17, 2016

Unfortunately I don't have much control over the document other than that which can be done programmatically.

How come it works fine with \begin{displaymath}?

@cazgp
Copy link
Author

cazgp commented Oct 17, 2016

Closed in favour of jgm/texmath#93

@cazgp cazgp closed this as completed Oct 17, 2016
@jgm
Copy link
Owner

jgm commented Oct 17, 2016

OK, I looked into this further and found I couldn't reproduce the problem. You are undoubtedly using an older version of pandoc -- it would have helped to have had the pandoc version in the bug report.
(See CONTRIBUTING.md)

I do not get an error with pandoc problem.tex -o test.xml.
Moreover I get exactly the same output if I use \begin{displaymath}...\end{displaymath}.

Note that in neither case do I get mathml; that's because texmath doesn't handle \boldmath as noted above. I still don't get mathml when I use \textbf as suggested. This is because texmath can only handle simple \mbox environments which embed regular text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants