question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

inline :math: fails

See original GitHub issue
What steps will reproduce the problem?
1. echo "This is :math:\`\\pi\`" > test.rst
2. rst2pdf test.rst -o test.pdf

What is the expected output? I expect a pdf with the symbol pi

What do you see instead? a python "ValueError"  (see the stack below)


Please answer the following questions, they are *very* important:

* Version of rst2pdf?
0.93.dev

* Version of reportlab?
from python, reportlab.__version__ is ' $Id$ '
and the egg says reportlab-3.1.8-py2.7-macosx-10.6-intel.egg


* Are you using wordaxe, and if true, what version?
don't think so

* Are you using rst2pdf with Sphinx, and if true, what version?
No


Please provide any additional information below.
When using inline math role, I get a python error, thus no pdf output. Because 
I don't understand it, I have no idea what test to do.
I paste the error stack below. I you have some idea of test to do, please tell 
me.

stack:
rst2pdf test.rst -o test.pdf
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/bin/rst2pdf", line 9, in <module>
    load_entry_point('rst2pdf==0.93.dev', 'console_scripts', 'rst2pdf')()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rst2pdf-0.93.dev-py2.7.egg/rst2pdf/createpdf.py", line 1495, in main
    compressed=options.compressed)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rst2pdf-0.93.dev-py2.7.egg/rst2pdf/createpdf.py", line 561, in createPdf
    elements = self.gen_elements(self.doctree)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rst2pdf-0.93.dev-py2.7.egg/rst2pdf/basenodehandler.py", line 250, in elemdispatch
    elements = self.getelements(client, node, style)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rst2pdf-0.93.dev-py2.7.egg/rst2pdf/basenodehandler.py", line 225, in getelements
    elements = self.gather_elements(client, node, style)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rst2pdf-0.93.dev-py2.7.egg/rst2pdf/basenodehandler.py", line 205, in gather_elements
    return client.gather_elements(node, style=style)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rst2pdf-0.93.dev-py2.7.egg/rst2pdf/createpdf.py", line 390, in gather_elements
    r.extend(self.gen_elements(n, style=style))
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rst2pdf-0.93.dev-py2.7.egg/rst2pdf/basenodehandler.py", line 250, in elemdispatch
    elements = self.getelements(client, node, style)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rst2pdf-0.93.dev-py2.7.egg/rst2pdf/basenodehandler.py", line 225, in getelements
    elements = self.gather_elements(client, node, style)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rst2pdf-0.93.dev-py2.7.egg/rst2pdf/genelements.py", line 188, in gather_elements
    return [Paragraph(client.gen_pdftext(node), style)]
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/reportlab-3.1.8-py2.7-macosx-10.6-intel.egg/reportlab/platypus/paragraph.py", line 987, in __init__
    self._setup(text, style, bulletText or getattr(style,'bulletText',None), frags, cleanBlockQuotedText)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/reportlab-3.1.8-py2.7-macosx-10.6-intel.egg/reportlab/platypus/paragraph.py", line 1012, in _setup
    % (_parser.errors[0],text[:min(30,len(text))]))
ValueError: xml parser error (valign: invalid value -1.000000/) in paragraph 
beginning
'This is <img src="/var/folders'

Original issue reported on code.google.com by julien.d...@gmail.com on 30 Jul 2014 at 5:55

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

2reactions
niejencommented, Feb 26, 2016

Found the error, this time with a tested fix: Add a space in rst2pdf/math_directive.py line 103. It should be: return '<img src="%s" width=%f height=%f valign=%f />' % (

NOW I get a pdf with math symbols. Doesn’t look fantastic, but it Works™.

0reactions
Griefcommented, Jul 4, 2016

@niejen thanks, that prevents the tool from crash. The result formula looks a little bit misaligned though. However, the project looks abandoned.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error on inline math · Issue #120 · readthedocs/recommonmark
There is an exception when processing markdown file containing inline math via Sphinx. The same markdown file previously worked. Here is a Travis...
Read more >
math mode - How to solve "$" error in this line? - TeX
Use $...$ for inline math mode, and [...] or one of the mathematical environments (e.g. equation) for display math mode. This applies to ......
Read more >
Display math should end with $$ - Overleaf, Online LaTeX Editor
inline math mode where the mathematical content is contained within a paragraph, ... The error message Display math should end with $$ is...
Read more >
Multi-line math fails in Quarto - pandoc - Stack Overflow
How do I use cases environment or multi-line math in Quarto? Note: This works with project type website, but not with project type...
Read more >
Help:Displaying a formula - Wikipedia
There are three methods for displaying formulas in Wikipedia: raw HTML, HTML with math templates (abbreviated here as {{math}}), and a subset of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found