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

Your LaTeX code has problems #48

Closed
JohnCovering opened this issue Oct 15, 2018 · 17 comments
Closed

Your LaTeX code has problems #48

JohnCovering opened this issue Oct 15, 2018 · 17 comments
Labels
bug Something isn't working

Comments

@JohnCovering
Copy link

JohnCovering commented Oct 15, 2018

Hello,

I tried to run TexText 0.8.1 with Inkscape 0.92.3 on Windows 10, but I got the following error when clicking on the Save button.
The LaTeX code was : $x$

With TexText 0.7.3 I don't have any error.

Your LaTeX code has problems:

Traceback (most recent call last):
File "asktext.py", line 599, in cb_ok
self._texcmd_cbox.get_active_text().lower())
File "textext.py", line 292, in callback
tex_cmd, original_scale=current_scale)
File "textext.py", line 393, in do_convert
new_svg_ele = converter.convert(text, preamble_file, scale_factor, tex_command)
File "textext.py", line 820, in convert
self.tex_to_pdf(tex_command, latex_text, preamble_file)
File "textext.py", line 763, in tex_to_pdf
raise RuntimeError("Your LaTeX code has problems:\n\n{errors}".format(errors=parsed_log))
RuntimeError: Your LaTeX code has problems:

@sizmailov
Copy link
Collaborator

sizmailov commented Oct 15, 2018

I wonder, is your error message truncated? Is there anything after RuntimeError: Your LaTeX code has problems:?

@JohnCovering
Copy link
Author

No, there's nothing after "RuntimeError: Your LaTeX code has problems:"

@michaelhaar
Copy link

michaelhaar commented Nov 30, 2018

I am getting the same error message.

  • operating system: Win10 64bit
  • inscape version: 0.92.3 with Python 2.7
  • Miktex version 2.9.6821
  • installed PyGTK-2.24-Inkscape-0.92.3-64bit.exe, pstoedit Version 3.73, ghostscript Version 9.25 and ImageMagick-7.0.8-14-Q16-x64-static.exe as described in the wiki
  • edit: textext version is 0.8.1

I also tried to use install textext on my office computer. It also displays the same error message.

Note: The error only occurs if pdflatex is selected. xelatex works fine 😄

@sizmailov
Copy link
Collaborator

@michaelhaar Thanks for the report!

What is TexText version?

Presumably pdflatex fails in unusual way, which makes (third-party) log parser fail to find the error to display.
Does this error depend on entered text? Try enter plain text/math/both.

Newer version of TexText with a number of fixes is coming, but I think this issue may persist.

@michaelhaar
Copy link

@sizmailov TexText version is 0.8.1.

The error doesn't depend on the text itself. It always gives the same error

@sizmailov
Copy link
Collaborator

sizmailov commented Nov 30, 2018

Can you create a tex file with following content and compile it from command line with pdflatex?

one.tex:

\documentclass{article}

\usepackage{amsmath,amsthm,amssymb,amsfonts}
\usepackage{color}

\pagestyle{empty}
\begin{document}
% ***Your code***
\end{document}

two.tex:

\documentclass{article}

\pagestyle{empty}
\begin{document}
% ***Your code***
\end{document}
  1. Hit Windows+R, enter cmd. The command line will appear.
  2. enter cd "<your folder with test tex files>"; Note the quotes
  3. run pdflatex.exe one.tex "-interaction=nonstopmode" "-halt-on-error"
  4. run pdflatex.exe two.tex "-interaction=nonstopmode" "-halt-on-error"

Copy output here as markdown code blocks to avoid formatting.

@michaelhaar
Copy link

Output of one.tex (it wants to install the latex package mptopdf)

This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6840 64-bit)
entering extended mode
(one.tex
LaTeX2e <2018-04-01> patch level 5
("C:\Program Files\Miktex\tex\latex\base\article.cls"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
("C:\Program Files\Miktex\tex\latex\base\size10.clo"))
("C:\Program Files\Miktex\tex\latex\amsmath\amsmath.sty"
For additional information on amsmath, use the `?' option.
("C:\Program Files\Miktex\tex\latex\amsmath\amstext.sty"
("C:\Program Files\Miktex\tex\latex\amsmath\amsgen.sty"))
("C:\Program Files\Miktex\tex\latex\amsmath\amsbsy.sty")
("C:\Program Files\Miktex\tex\latex\amsmath\amsopn.sty"))
("C:\Program Files\Miktex\tex\latex\amscls\amsthm.sty")
("C:\Program Files\Miktex\tex\latex\amsfonts\amssymb.sty"
("C:\Program Files\Miktex\tex\latex\amsfonts\amsfonts.sty"))
("C:\Program Files\Miktex\tex\latex\graphics\color.sty"
("C:\Program Files\Miktex\tex\latex\graphics-cfg\color.cfg")
("C:\Program Files\Miktex\tex\latex\graphics-def\pdftex.def"))
No file one.aux.
QWindowsWindow::setGeometry: Unable to set geometry 451x317+690+357 on QWidgetWindow/'InstallPackageDialogWindow'. Resulting geometry:  541x317+690+357 (frame: 9, 38, 9, 9, custom margin: 0, 0, 0, 0, minimum size: 541x287, maximum size: 16777215x16777215).

======================================================================
starting package maintenance...
installation directory: "C:\Program Files\Miktex"
package repository: http://mirror.easyname.at/ctan/systems/win32/miktex/tm/packages/
visiting repository http://mirror.easyname.at/ctan/systems/win32/miktex/tm/packages/...
repository type: remote package repository
loading lightweight database...
downloading http://mirror.easyname.at/ctan/systems/win32/miktex/tm/packages/miktex-zzdb1-2.9.tar.lzma...
0.18 MB, 2.38 Mbit/s

Unfortunately, the package mptopdf could not be installed.
Please check the log file:
C:\Users\Michael Haar\AppData\Local\MiKTeX\2.9\miktex\log\pdflatex.log
======================================================================
(one.aux) )
No pages of output.
Transcript written on one.log.

Output of two.tex:

This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6840 64-bit)
entering extended mode
(two.tex
LaTeX2e <2018-04-01> patch level 5
("C:\Program Files\Miktex\tex\latex\base\article.cls"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
("C:\Program Files\Miktex\tex\latex\base\size10.clo"))
No file two.aux.
(two.aux) )
No pages of output.
Transcript written on two.log.

@sizmailov
Copy link
Collaborator

sizmailov commented Nov 30, 2018

Thanks! We are making progress.

Default preamble file includes some packages which are not installed on your system.
pdflatex tries to install them and fails. Might be insufficient rights to install folder.

Presumably you may have them installed by compiling one.tex in MikTex GUI interface. It should have enough rights to do so.

The file two.tex has no packages in preamble and goes well. If you choose empty preamble file in TexText it should produce the output.

The parser fails to find any .tex file error, because there is no errors with tex file itself, its installation of package error.

I think we get to the bottom of the problem.

@sizmailov
Copy link
Collaborator

@michaelhaar Can you confirm next two points?

  1. the empty preamble produce the output (at least for plain text)
  2. after installation of extra packages with MikTex the TexText works with default preamble

@sizmailov
Copy link
Collaborator

@jcwinkler Can we investigate it deeper?

On the one hand we should not have in default preamble / .tex template anything beyond default installation. On another hand we can't remove the packages which are already here to maintain backward compatibility. Seems like something happened with tex distribution or packages.

We probably should add functionality to show full latex log on demand.

@michaelhaar
Copy link

@michaelhaar Can you confirm next two points?

  1. the empty preamble produce the output (at least for plain text)
  2. after installation of extra packages with MikTex the TexText works with default preamble

I can confirm the second statement 👍
TexText works with default preamble after installation of the mptopdf package (I had to run the MikTex Console as administrator ).

@sizmailov
Copy link
Collaborator

@michaelhaar Good enough, thank you!

@jcwinkler
Copy link
Member

@michaelhaar Did you install MiKTeX with the so-called "basic" installer or with the "net" installer?

@sizmailov

  1. Definitely we should offer the possibility to show the complete output.
  2. Maybe we could check for the existence of the packages in setup.py. For example
 kpsewhich amsmath.sty

returns the full path +filename to the package if it is installed and nothing if not.

@michaelhaar
Copy link

@jcwinkler I just downloaded the standard Miktex installer from here

@jcwinkler
Copy link
Member

@michaelhaar Thank you. It explains why some packages are missing on your system.

@sizmailov

# Exec tex_command: tex -> pdf
try:
exec_command([tex_command, self.tmp('tex')] + self.LATEX_OPTIONS)
except TexTextCommandFailed as error:
if os.path.exists(self.tmp('log')):
parsed_log = self.parse_pdf_log(self.tmp('log'))
raise TexTextConversionError(parsed_log)
else:
raise TexTextConversionError(error.message)

I suggest that we pass the full log file to TexTextConversionError if the logfileparser does not find anything or even better parse_pdf_log returns the full log file if it does not find any tex file error.

@sizmailov
Copy link
Collaborator

Created #77, lets move discussion there.

@sizmailov
Copy link
Collaborator

@JohnCovering Can you confirm the solution works for you too?

@jcwinkler jcwinkler added the bug Something isn't working label Dec 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants