otfried / ipe

The Ipe extensible drawing editor
http://ipe.otfried.org
156 stars 15 forks source link

crash (ipe hangs) while compiling latex #338

Closed doppelhammer closed 1 year ago

doppelhammer commented 4 years ago

ipe hangs when trying to compile latex-code. I could not find out why -- in some documents it works, in others it doesn't (even in very simple ones). So far latex-compilation has worked well on my computer and I did not change anything on my latex-installation.

Any ideas? Radgeschwindigkeit.zip

otfried commented 4 years ago

Are you still using 7.2.18? There was a bug where Ipe would hang when you run Latex on a document without text.

otfried commented 4 years ago

To be more precise, there was a bug in 7.2.18 where Ipe would hang when running Latex on documents that do not contain any text object.

The problem should be solved in 7.2.19.

grolschie commented 4 years ago

I'm getting this problem with 7.2.20 on Windows 10. When I add any text to my drawing it just sits there with "IPE waiting" and "Compiling Latex". It never times out or gives an error message. I have to kill the process.

otfried commented 4 years ago

Which Tex installation are you using? texlive, miktex, or online-compilation?

grolschie commented 4 years ago

miktex 2.9. basic-miktex-20.6-x64.exe (June 2020) is the installer I downloaded and used the other day. The download page now has a May 2020 installer. Hmmm. Copy/pasting my image from the IPE window into the older IPE 7.2.8 window, and then typing some text works though.

otfried commented 4 years ago

Quite mysterious. This happens with every document that contains any text, even if it's just a single letter "a"?

Could you try - when Ipe 7.2.20 hangs again - to open a command window, go to the Latex directory (Help -> Show Configuration, it's normally something like C:\users\...\Local Settings\Application Data\ipe. That directory should contain a file ipetemp.tex. Check that it compiles correctly if you just say pdflatex ipetemp.tex in this directory.

grolschie commented 4 years ago

Here's a screen crop of me typing the letters "sds". Here is the resulting ipetemp.tex file:

\expandafter\ifx\csname pdfobjcompresslevel\endcsname\relax\else\pdfobjcompresslevel0\fi
\documentclass{article}
\newdimen\ipefs
\newcounter{ipePage}\newcounter{ipeView}
\newcounter{ipePages}\newcounter{ipeViews}
\newcommand{\PageTitle}[1]{#1}
\newcommand{\ipesymbol}[4]{$\bullet$}
\def\ipedefinecolors#1{\ipecolorpreamble{#1}\let\ipecolorpreamble\relax}
\def\ipecolorpreamble#1{\usepackage[#1]{xcolor}
\definecolor{red}{rgb}{1,0,0}
\definecolor{blue}{rgb}{0,0,1}
\definecolor{green}{rgb}{0,1,0}
\definecolor{yellow}{rgb}{1,1,0}
\definecolor{orange}{rgb}{1,0.647,0}
\definecolor{gold}{rgb}{1,0.843,0}
\definecolor{purple}{rgb}{0.627,0.125,0.941}
\definecolor{gray}{gray}{0.745}
\definecolor{brown}{rgb}{0.647,0.165,0.165}
\definecolor{navy}{rgb}{0,0,0.502}
\definecolor{pink}{rgb}{1,0.753,0.796}
\definecolor{seagreen}{rgb}{0.18,0.545,0.341}
\definecolor{turquoise}{rgb}{0.251,0.878,0.816}
\definecolor{violet}{rgb}{0.933,0.51,0.933}
\definecolor{darkblue}{rgb}{0,0,0.545}
\definecolor{darkcyan}{rgb}{0,0.545,0.545}
\definecolor{darkgray}{gray}{0.663}
\definecolor{darkgreen}{rgb}{0,0.392,0}
\definecolor{darkmagenta}{rgb}{0.545,0,0.545}
\definecolor{darkorange}{rgb}{1,0.549,0}
\definecolor{darkred}{rgb}{0.545,0,0}
\definecolor{lightblue}{rgb}{0.678,0.847,0.902}
\definecolor{lightcyan}{rgb}{0.878,1,1}
\definecolor{lightgray}{gray}{0.827}
\definecolor{lightgreen}{rgb}{0.565,0.933,0.565}
\definecolor{lightyellow}{rgb}{1,1,0.878}
\definecolor{black}{gray}{0}
\definecolor{white}{gray}{1}
}
\makeatletter
\def\ipesetcolor#1#2#3{\def\current@color{#1 #2 #3 rg #1 #2 #3 RG}\pdfcolorstack\@pdfcolorstack push{\current@color}}
\def\iperesetcolor{\pdfcolorstack\@pdfcolorstack pop}
\makeatother

\ipedefinecolors{}
\pagestyle{empty}
\newcount\bigpoint\dimen0=0.01bp\bigpoint=\dimen0
\begin{document}
\begin{picture}(500,500)
\setbox0=\hbox{\normalsize
\ipesetcolor{0}{0}{0}%
sds%
\iperesetcolor}
\count0=\dp0\divide\count0 by \bigpoint
\pdfxform attr{/IpeId 1 /IpeStretch 1 /IpeDepth \the\count0}0\put(0,0){\pdfrefxform\pdflastxform}
\end{picture}
\end{document}
otfried commented 4 years ago

And can you run Latex from the command line on ipetemp.tex?

grolschie commented 4 years ago
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.6.29)
entering extended mode
(ipetemp.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-06-18>
("C:\Program Files\MiKTeX\tex/latex/base\article.cls"
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
("C:\Program Files\MiKTeX\tex/latex/base\size10.clo"))
("C:\Program Files\MiKTeX\tex/latex/xcolor\xcolor.sty"
("C:\Program Files\MiKTeX\tex/latex/graphics-cfg\color.cfg")
("C:\Program Files\MiKTeX\tex/latex/graphics-def\dvips.def"))
("C:\Program Files\MiKTeX\tex/latex/l3backend\l3backend-dvips.def")
(ipetemp.aux)
! pdfTeX error (\pdfcolorstack): not allowed in DVI mode (\pdfoutput <= 0).
\ipesetcolor ... #3 rg #1 #2 #3 RG}\pdfcolorstack
                                                  \@pdfcolorstack push{\curr...
l.54 \ipesetcolor{0}{0}{0}
                          %
No pages of output.
Transcript written on ipetemp.log.
otfried commented 4 years ago

Did you say latex ipetemp.tex ? You need to use pdflatex ipetemp.tex.

grolschie commented 4 years ago

I used the command latex ipetemp.tex and the above was the output.

If I type pdflatex ipetemp.tex I get

This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.6.29)
entering extended mode
(ipetemp.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-06-18>
("C:\Program Files\MiKTeX\tex/latex/base\article.cls"
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
("C:\Program Files\MiKTeX\tex/latex/base\size10.clo"))
("C:\Program Files\MiKTeX\tex/latex/xcolor\xcolor.sty"
("C:\Program Files\MiKTeX\tex/latex/graphics-cfg\color.cfg")
("C:\Program Files\MiKTeX\tex/latex/graphics-def\pdftex.def"))
("C:\Program Files\MiKTeX\tex/latex/l3backend\l3backend-pdfmode.def")
(ipetemp.aux) ("C:\Program Files\MiKTeX\tex/context/base/mkii\supp-pdf.mkii"
[Loading MPS to PDF converter (version 2006.09.02).]
)
Overfull \hbox (170.0pt too wide) in paragraph at lines 59--60
[][]
[1{C:/Users/username/AppData/Local/MiKTeX/pdftex/config/pdftex.map}]
(ipetemp.aux) )
(see the transcript file for additional information)<C:/Program Files/MiKTeX/fo
nts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on ipetemp.pdf (1 page, 10943 bytes).
Transcript written on ipetemp.log.
otfried commented 4 years ago

Thanks for testing this. It's a strange problem - since most Ipe users seem to have no problems, I'm suspecting a race condition - but on the other hand you say that it happens every time you are adding some text?

Could you try this Ipe file? It takes longer to run pdflatex on this - if it's a race condition, this one should not trigger it.

bar-chart.zip

grolschie commented 4 years ago

That file works.

otfried commented 4 years ago

Many thanks - I will go hunting for a race condition.

If you want to use 7.2.20 without worrying about latex hanging, you could edit the file model.lua in the Ipe lua directory, finding the function MODEL:runLatex(), and changing the following lines:

  ipeui.waitDialog(self.ui:win(),
           function ()
             success, errmsg, result, log = self.doc:runLatex(self.file_name)
           end, "Compiling Latex")

into

     success, errmsg, result, log = self.doc:runLatex(self.file_name)
grolschie commented 4 years ago

The problem occured for me in a newly created drawing. Adding any text to my drawing causes it to hang like that.

grolschie commented 4 years ago

Thank you.

Zimmux commented 4 years ago

I encountered the same problem, and believe I found a reproducible way to obtain a hanging dialog:

Ipe: waiting Compiling Latex

Add \usepackage{amssymb} (or perhaps any package) to the preamble, and create a text field containing a single letter a. I have encountered this problem only when loading a package before adding any text, so perhaps it is only a problem with the first compilation in a document.

ausathe commented 4 years ago

I am also encountering this problem. It sometime compiles correctly. Sometimes it just doesn't. There seems to be no reason. I just run it a few times and it works.

rfischerb commented 4 years ago

Same problem. Ipe 7.2.20, pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.7 NEXT).

rfischerb commented 4 years ago

But fix worked.

otfried commented 4 years ago

Could you try this version? I have implemented how Ipe handles the little dialog shown during the Latex run, this should hopefully fix the race condition.

ipe-7.2.20-win64.zip

rfischerb commented 4 years ago

Thank you, I will. In the meanwhile I have successfully used your suggestion of changing the function MODEL:runLatex().

Regards,

RF

On Thu, Sep 24, 2020 at 5:25 PM Otfried Cheong notifications@github.com wrote:

Could you try this version? I have implemented how Ipe handles the little dialog shown during the Latex run, this should hopefully fix the race condition.

ipe-7.2.20-win64.zip https://github.com/otfried/ipe-issues/files/5278985/ipe-7.2.20-win64.zip

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/otfried/ipe-issues/issues/338#issuecomment-698570179, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM43O5I3JDTYZAGHTOGLKWTSHOTLPANCNFSM4OF2FX3Q .

-- Ronald Fischer CEA-DII, Universidad de Chile http://ssrn.com/author=122349 Blog: http://variacioncompensada.wordpress.com/ http://ssrn.com/author=122349

RonaldAarts commented 4 years ago

I had similar issues: Starting a new figure, adding the first text, waiting ....... Configuration: Windows 10, MiKTeX-pdfTeX 4.0.1 (MiKTeX 20.7). I installed the ipe from the zip file of September 24. Up and running again!

otfried commented 4 years ago

Many thanks for the feedback.

I should release this version soon.

rfischerb commented 4 years ago

Dear Otfried,

So far it has worked correctly. Thank you,

Regards,

RF

On Fri, Sep 25, 2020 at 11:14 AM Ronald Fischer rfischer@dii.uchile.cl wrote:

Thank you, I will. In the meanwhile I have successfully used your suggestion of changing the function MODEL:runLatex().

Regards,

RF

On Thu, Sep 24, 2020 at 5:25 PM Otfried Cheong notifications@github.com wrote:

Could you try this version? I have implemented how Ipe handles the little dialog shown during the Latex run, this should hopefully fix the race condition.

ipe-7.2.20-win64.zip https://github.com/otfried/ipe-issues/files/5278985/ipe-7.2.20-win64.zip

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/otfried/ipe-issues/issues/338#issuecomment-698570179, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM43O5I3JDTYZAGHTOGLKWTSHOTLPANCNFSM4OF2FX3Q .

-- Ronald Fischer CEA-DII, Universidad de Chile http://ssrn.com/author=122349 Blog: http://variacioncompensada.wordpress.com/ http://ssrn.com/author=122349

-- Ronald Fischer CEA-DII, Universidad de Chile http://ssrn.com/author=122349 Blog: http://variacioncompensada.wordpress.com/ http://ssrn.com/author=122349

Bjoernolav commented 3 years ago

I'm having the same problem on Ipe 7.2.24 running on Windows 10 Business.

Installed MiKTeX, and running pdflatex ipetmp.tex works and produces the following output:

This is pdfTeX, Version 3.141592653-2.6-1.40.23 (MiKTeX 21.8)
entering extended mode
(ipetemp.tex
LaTeX2e <2021-06-01> patch level 1
L3 programming layer <2021-08-27>

(C:\Users\Bjørn-OlavHoltungEri\AppData\Local\Programs\MiKTeX\tex/latex/base\ar
ticle.cls
Document Class: article 2021/02/12 v1.4n Standard LaTeX document class

(C:\Users\Bjørn-OlavHoltungEri\AppData\Local\Programs\MiKTeX\tex/latex/base\si
ze10.clo))
(C:\Users\Bjørn-OlavHoltungEri\AppData\Local\Programs\MiKTeX\tex/latex/xcolor\
xcolor.sty
(C:\Users\Bjørn-OlavHoltungEri\AppData\Local\Programs\MiKTeX\tex/latex/graphic
s-cfg\color.cfg)
(C:\Users\Bjørn-OlavHoltungEri\AppData\Local\Programs\MiKTeX\tex/latex/graphic
s-def\pdftex.def))
(C:\Users\Bjørn-OlavHoltungEri\AppData\Local\Programs\MiKTeX\tex/latex/l3backe
nd\l3backend-pdftex.def)
No file ipetemp.aux.

(C:\Users\Bjørn-OlavHoltungEri\AppData\Local\Programs\MiKTeX\tex/context/base/
mkii\supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
)
Overfull \hbox (170.0pt too wide) in paragraph at lines 60--61
[][]
[1{C:/Users/Bjørn-OlavHoltungEri/AppData/Local/MiKTeX/pdftex/config/pdftex.map
}] (ipetemp.aux) )
(see the transcript file for additional information)<C:/Users/Bjørn-OlavHoltun
gEri/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on ipetemp.pdf (1 page, 11879 bytes).
Transcript written on ipetemp.log.
otfried commented 3 years ago

But if you press Ctrl+L in Ipe it hangs during Latex compilation?

Bjoernolav commented 3 years ago

It hangs during Latex compilation if I open an empty document and add a textbox with any text.

Opening an empty document and pressing Ctrl + L does not make it hang, but adding a textbox afterwards produces the same behavior.

otfried commented 3 years ago

Could you try if this change https://github.com/otfried/ipe-issues/issues/338#issuecomment-653481624 stops Latex hanging for you?

In the Help menu, can you check under "Enable online Latex-compilation" that this is currently not enabled?

Bjoernolav commented 3 years ago

Could you try if this change #338 (comment) stops Latex hanging for you?

Ipe still hangs after adding a text box, but the dialog box is not shown.

Online Latex-compilation is disabled. I've also attempted to enable this, and did not manage to disable it again afterwards. Deleting the url1.txt file in AppData\Local\ipe seemed to disable the online compilation.

I tried to implement the change in model.lua with a new installation (removing the AppData\Local\ipe directory) with the same result.

otfried commented 3 years ago

Then it seems that this is really a different issue. Somehow Ipe does not find out about the Latex run terminating.

Do we know for sure that Latex is actually started and runs successfully?

You could delete the AppData\Local\ipe directory, and see it it gets created and populated with ipetemp.tex, ipetemp.log, and ipetemp.pdf the first time you create a text object.

Bjoernolav commented 3 years ago

I was not able to remove the directory (some process was using it, might be from killing ipe earlier). Anyhow, managed to delete the files so it was an empty directory. Started ipe and adding a text box populated the folder with ipetemp.tex and rolatex.bat, but no latex output files.

Bjoernolav commented 3 years ago

Seems like pdflatex is started, screenshot from the task manager: image

Edit: Killing ipe and doing pdflatex ipetemp.tex manually produces a pdf with the text I entered.

otfried commented 3 years ago

That is very mysterious. I don't see how it can be that pdflatex is actually started, but no output is produced at all?

Can you attach the contents of the runlatex.bat file? And can you call that file from the command line?

What is the locale setting on your computer?

Bjoernolav commented 3 years ago

When launching ipe, the AppData\Local\ipe directory is empty, and pdflatex is not running: image

Attempted to add a textbox, pdflatex starts and ipe hangs: image

The AppData\Local\ipe directory now looks like this: image

The contents of runlatex.bat is:

C:
cd "C:\Users\Bjorn-OlavHoltungEri\AppData\Local\ipe\"
pdflatex ipetemp.tex

I think there might be a bug here: The correct path is C:\Users\Bjørn-OlavHoltungEri\AppData\Local\ipe\, it seems like the ø is replaced with an o: which is also supported by the output when running runlatex.bat manually:

PS C:\Users\Bjørn-OlavHoltungEri\AppData\Local\ipe> .\runlatex.bat

C:\Users\Bjørn-OlavHoltungEri\AppData\Local\ipe>C:

C:\Users\Bjørn-OlavHoltungEri\AppData\Local\ipe>cd "C:\Users\Bjorn-OlavHoltungEri\AppData\Local\ipe\"
The system cannot find the path specified.

C:\Users\Bjørn-OlavHoltungEri\AppData\Local\ipe>pdflatex ipetemp.tex
This is pdfTeX, Version 3.141592653-2.6-1.40.23 (MiKTeX 21.8)
entering extended mode
(ipetemp.tex
LaTeX2e <2021-06-01> patch level 1
L3 programming layer <2021-08-27>
<more pdflatex output>

Manually running runlatex.bat produces the expected output - but this is just because I'm running the file from the correct path.

The locale setting is English (United States)

otfried commented 3 years ago

Yes, that sounds like the problem. It seems this is the first time somebody has tried to run Ipe whose home directory name cannot be encoded in the encoding of the locale setting.

Batch files traditionally did not even use the windows encoding, but a special "OEM" encoding.

It seems that nowadays it should be possible to simply write the batch file in Unicode and forget about the OEM encoding. I will see if I can get this to work.

For the moment, the workaround for you is to create a special directory for Ipe to use for running latex, e.g. c:\ipelatexrun. Create it, then set the environment variable IPELATEXDIR and set it to the name of the directory.

You can either set the environment variable in Windows, or make a small file ipe.conf and place it at the top level of your Ipe setup (the directory that has the bin, styles, lua subdirectories). It's contents would simply be

IPELATEXDIR=c:\ipelatexrun

(See https://ipe.otfried.org/manual/manual_53.html)

Bjoernolav commented 3 years ago

Thanks, creating and setting a custom directory indeed made it work 👍

otfried commented 2 years ago

I believe the next release (7.2.25) will not need the setting of IPELATEXDIR anymore. Once it is out, could you give it a try?

wujastyk commented 1 month ago

Ipe 7.2.29 under Linux Mint 22 and a standard TeXlive installation. I had this hang problem, only when selecting xetex as the engine. I edited model.lua according to comment #333 and the problem seems to be okay.