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

Inline math unsupported in reST documents #117

Closed
jgm opened this issue Jun 10, 2011 · 7 comments
Closed

Inline math unsupported in reST documents #117

jgm opened this issue Jun 10, 2011 · 7 comments
Assignees

Comments

@jgm
Copy link
Owner

jgm commented Jun 10, 2011

What steps will reproduce the problem?

  1. Author a brief reST document
  2. Insert a bit of inline math
  3. Resulting output document (HTML) does not treat math specially

What is the expected output? What do you see instead?
I expected EQ tags in the case of --gladtex, specifically.

What version of the product are you using? On what operating system?
Pandoc 1.5.1.1, Ubuntu 10.04, GHC 6.10.4.

Please provide any additional information below.
It was pretty straightforward to add support for math by copying the Markdown inline math-parsing code into the RST reader module (then removing 'failIfStrict'). Maybe it just got forgotten? Or maybe something about reST causes trouble for inline math parsing?

One final note: I'm filing this as a defect only because I haven't found evidence in the documentation that it's unsupported, so I was surprised to find out it wasn't. In any case, thanks for Pandoc!

Google Code Info:
Issue #: 249
Author: drcyg...@gmail.com
Created On: 2010-07-19T05:34:01.000Z
Closed On: 2010-12-07T04:43:43.000Z

@ghost ghost assigned jgm Jun 10, 2011
@jgm jgm closed this as completed Jun 10, 2011
@jgm
Copy link
Owner Author

jgm commented Jun 10, 2011

What syntax did you use to include the inline math? There is no standard syntax for math in RST (to my knowledge -- this may be out of date), so the RST reader doesn't read anything as math. (In particular, it doesn't assume that text between $$ is math, as the pandoc markdown reader does.)

In the RST writer, we render math as follows:
:math:$e=mc^2$
It wouldn't be hard to adapt the RST reader to accept this kind of syntax, if that would be useful.
It requires definition of the math role elsewhere in the document:

.. role:: math(raw)
:format: html latex

Google Code Info:
Author: fiddloso...@gmail.com
Created On: 2010-07-20T17:39:20.000Z

@jgm
Copy link
Owner Author

jgm commented Jun 10, 2011

Maybe I'm misunderstanding the spirit of the inline Math feature, but the user's guide says, "Anything between two $ characters will be treated as TeX math. The opening $ must have a character immediately to its right, while the closing $ must have a character immediately to its left." To me, that says that I should be able to write "$x$" in any input document format and have it result in an Inline in the Pandoc AST representing an InlineMath object. Am I off my rocker here?

In my RST document I used the "$...$" form. My modification to the RST parser just copies the Markdown parser's behavior when parsing "$...$" and "$$...$$".

Google Code Info:
Author: drcyg...@gmail.com
Created On: 2010-07-20T17:46:25.000Z

@jgm
Copy link
Owner Author

jgm commented Jun 10, 2011

You're looking at the part of the README entitled "Pandoc's markdown vs. standard markdown". It isn't meant to apply to RST, only to markdown.

Google Code Info:
Author: fiddloso...@gmail.com
Created On: 2010-07-20T18:20:55.000Z

@jgm
Copy link
Owner Author

jgm commented Jun 10, 2011

Ahh, fair enough. I didn't even notice that. In that case, I'll try (extended) Markdown as my input format. I'm an RST fan but the math parsing is a must. :) Sorry!

Google Code Info:
Author: drcyg...@gmail.com
Created On: 2010-07-20T18:25:54.000Z

@jgm
Copy link
Owner Author

jgm commented Jun 10, 2011

I suppose one could write an "extended RST" reader that parses "$...$"-style math, although I'm not excited about opening that can of worms for every input format. In any case, my motivation for wanting "$...$" is mostly that it's easier to type that than the RST 'math' role repeatedly.

Google Code Info:
Author: drcyg...@gmail.com
Created On: 2010-07-20T18:29:43.000Z

@jgm
Copy link
Owner Author

jgm commented Jun 10, 2011

Google Code Info:
Author: fiddloso...@gmail.com
Created On: 2010-12-07T04:43:43.000Z

@jgm
Copy link
Owner Author

jgm commented Dec 31, 2011

Math is now supported in RST reader and writer!

astanin pushed a commit to astanin/pandoc that referenced this issue Apr 19, 2012
Inline:  :math:`E=mc^2`

Block:

.. math: E = mc^2

.. math::

   E = mc^2

   a = b^2

(This latter will turn into a paragraph with two
display math elements.)

Closes jgm#117.
jgm added a commit that referenced this issue Feb 27, 2017
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

1 participant