Skip to content
Snippets Groups Projects
Commit ddd7c13e authored by roidelapluie's avatar roidelapluie
Browse files

Beter handling of LaTeX in feature window

parent 4071d313
No related branches found
No related tags found
No related merge requests found
......@@ -87,7 +87,7 @@ def __init__(self):
_('Requires compilation of the idle module from Gajim sources.')),
_('LaTeX'): (self.latex_available,
_('Transform LaTeX espressions between $$ $$.'),
_('Requires latex, dvips and imagemagick. You have to set \'use_latex\' to True in the Advanced Configuration Editor.'),
_('Requires texlive-latex-base, dvips and imagemagick. You have to set \'use_latex\' to True in the Advanced Configuration Editor.'),
_('Feature not available under Windows.')),
}
......@@ -244,17 +244,26 @@ def latex_available(self):
file.write(texstr)
file.flush()
file.close()
p = Popen(['latex', '--interaction=nonstopmode', tmpfile + '.tex'],
cwd=gettempdir())
exitcode = p.wait()
if exitcode == 0:
p = Popen(['dvips', '-E', '-o', tmpfile + '.ps', tmpfile + '.dvi'],
try:
p = Popen(['latex', '--interaction=nonstopmode', tmpfile + '.tex'],
cwd=gettempdir())
exitcode = p.wait()
except:
exitcode = 1
if exitcode == 0:
p = Popen(['convert', tmpfile + '.ps', tmpfile + '.png'],
cwd=gettempdir())
exitcode = p.wait()
try:
p = Popen(['dvips', '-E', '-o', tmpfile + '.ps', tmpfile + '.dvi'],
cwd=gettempdir())
exitcode = p.wait()
except:
exitcode = 1
if exitcode == 0:
try:
p = Popen(['convert', tmpfile + '.ps', tmpfile + '.png'],
cwd=gettempdir())
exitcode = p.wait()
except:
exitcode = 1
extensions = [".tex", ".log", ".aux", ".dvi", ".ps", ".png"]
for ext in extensions:
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment