anammari / pandoc

Automatically exported from code.google.com/p/pandoc
GNU General Public License v2.0
0 stars 0 forks source link

Inline math unsupported in reST documents #249

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
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!

Original issue reported on code.google.com by drcyg...@gmail.com on 19 Jul 2010 at 5:34

GoogleCodeExporter commented 8 years ago
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

Original comment by fiddloso...@gmail.com on 20 Jul 2010 at 5:39

GoogleCodeExporter commented 8 years ago
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 "$$...$$".

Original comment by drcyg...@gmail.com on 20 Jul 2010 at 5:46

GoogleCodeExporter commented 8 years ago
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.

Original comment by fiddloso...@gmail.com on 20 Jul 2010 at 6:20

GoogleCodeExporter commented 8 years ago
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!

Original comment by drcyg...@gmail.com on 20 Jul 2010 at 6:25

GoogleCodeExporter commented 8 years ago
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.

Original comment by drcyg...@gmail.com on 20 Jul 2010 at 6:29

GoogleCodeExporter commented 8 years ago

Original comment by fiddloso...@gmail.com on 7 Dec 2010 at 4:43

GoogleCodeExporter commented 8 years ago
Was the issue addressed in any way in the meantime?

Just defining a math role as proposed in comment 1 does not do the trick here 
with me. The above example gives me a mere ":math:`\$e=mc\^{}2\$`" in the TeX 
file.

I'd really appreciate math support in the ReST reader.

Regards,
Stefan

Original comment by s...@gmx.net on 26 Sep 2011 at 2:52

GoogleCodeExporter commented 8 years ago
There are quite a lot of Sphinx documents around, which use :math:`E = m c^2` 
notations. See http://sphinx.pocoo.org/latest/ext/math.html

rst2latex supports such documents, but pandoc (1.8.2) does not (it deletes 
displayed math altogether, and leaves inline math verbatim.

Original comment by s.astanin on 26 Oct 2011 at 2:28

GoogleCodeExporter commented 8 years ago
Math is now supported in RST reader & writer.

Original comment by fiddloso...@gmail.com on 31 Dec 2011 at 7:43