SublimeText / LaTeXTools

LaTeX plugin for Sublime Text
https://latextools.readthedocs.io/
2k stars 364 forks source link

epstopdf not behaving #1453

Open gsakradse opened 4 years ago

gsakradse commented 4 years ago

I am running ST3, with a fresh download of LatexTools on a Windows 10 machine with texlive2019, and ghostscript 9.50.

When running this example document

\documentclass{article}`
\usepackage{graphicx}
\usepackage{epstopdf}
\begin{document}
\begin{figure}
    \includegraphics[width = 0.8\textwidth]{TryEps.eps}
\end{figure}
\end{document}

I am getting a persistent epstopdf error:

Package pdftex.def Error: File 'TryEps-eps-converted-to.pdf' not found: using draft setting. [...graphics[width = 0.8\textwidth]{TryEps.eps}]

I added an explicit path to ghostscript and am running my texpath as:

"texpath" : "C:\\texlive\\2019\\bin\\win32;C:\\Program Files\\gs\\gs9.50\\bin;%PATH",

When I run the same example document in TeXWorks it compiles fine. I have found a difference in the log files.

The LaTeXTools log file contains this section where the error occurs:

Package epstopdf Info: Source file: <TryEps.eps>
(epstopdf)                    date: 2019-10-15 05:49:23
(epstopdf)                    size: 979264 bytes
(epstopdf)             Output file: <TryEps-eps-converted-to.pdf>
(epstopdf)             Command: <epstopdf --outfile=TryEps-eps-converted-to.pdf
 TryEps.eps>
(epstopdf)             \includegraphics on input line 8.
runsystem(epstopdf --outfile=TryEps-eps-converted-to.pdf TryEps.eps)...executed
.

Package epstopdf Info: Result file: <TryEps-eps-converted-to.pdf>.

! Package pdftex.def Error: File `TryEps-eps-converted-to.pdf' not found: using
 draft setting.

See the pdftex.def package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.8 ...graphics[width = 0.8\textwidth]{TryEps.eps}

Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.

[1{c:/texlive/2019/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./SimpleDebug.aux) )  

The same section from the TeXWorks log file looks like this:

Package epstopdf Info: Source file: <TryEps.eps>
(epstopdf)                    date: 2019-10-15 05:49:23
(epstopdf)                    size: 979264 bytes
(epstopdf)             Output file: <TryEps-eps-converted-to.pdf>
(epstopdf)                    date: 2019-12-02 16:02:38
(epstopdf)                    size: 260698 bytes
(epstopdf)             Command: <repstopdf --outfile=TryEps-eps-converted-to.pd
f TryEps.eps>
(epstopdf)             \includegraphics on input line 8.
Package epstopdf Info: Output file is already uptodate.
<TryEps-eps-converted-to.pdf, id=1, 481.8pt x 610.28pt>
File: TryEps-eps-converted-to.pdf Graphic file (type pdf)
<use TryEps-eps-converted-to.pdf>
Package pdftex.def Info: TryEps-eps-converted-to.pdf  used on input line 8.
(pdftex.def)             Requested size: 276.00105pt x 349.61389pt.
 [1{c:/texlive/2019/texmf-var/fonts/map/pdftex/updmap/pdftex.map} <./TryEps-eps
-converted-to.pdf>] (./SimpleDebug.aux) ) 

My hunch is that the problem is in the difference between the commands, in LaTeXTools it is:

epstopdf --outfile=TryEps-eps-converted-to.pdf TryEps.eps

and in TeXWorks it is:

repstopdf --outfile=TryEps-eps-converted-to.pdf TryEps.eps

When I run these commands in BASH from the folder containing the .eps, they both generate the .pdf.

Any and all insight will be greatly appreciated, this has been haunting me for a few weeks now.

r-stein commented 4 years ago

LaTeXTools just calls the compilation commands and doesn't compile the files itself. You can see the actual commands in the sublime text console View > Show Console. You may try to switch between traditional (texify/latexmk) and basic (pdflatex directly) builder and check whether this already solves your issue

gsakradse commented 4 years ago

I have tried switching the builder from traditional to basic, though with the builder selected as basic in settings the console output still looks like it is calling latexmk.EXE, should it instead be trying to call pdflatex.EXE on that line? The System Check confirms that the Builder Status is basic available.

Here is the console output:

3
Welcome to thread Thread-26
Running "'C:\texlive\2019\bin\win32\latexmk.EXE' -cd -f -pdf -interaction=nonstopmode -synctex=1 -latexoption=--shell-escape SimpleDebug.tex"
Finished normally
0

I get the same error with both settings for builder.

r-stein commented 4 years ago

It seems like you have selected the builder in the build panel. Use C-shift-b to select the builder, this takes precedence over the settings.

gsakradse commented 4 years ago

Well, I have had partial success. XeLaTeX as the builder gives me figure, though it is not calling epstopdf or generating the converted .pdf. So I have more of a workaround than a solution. This is good to know and gets me past the immediate problem, but I am still curious why I am having different behavior with the pdfLaTeX run from TeXWorks vs. LaTeXTools.

r-stein commented 4 years ago

We do have 2 builders (Basic Builder and Traditional Builder) and each of the builder supports 3 engines (pdflatex, xelatex, luatex).

If you use the basic builder you should have the same result* as calling pdflatex directly

* with handling of some problems

gsakradse commented 4 years ago

I'm not quite understanding why when I'm running the basic builder I am getting different behavior than when running XeLaTeX directly. When running basic it is just running pdfLaTeX, is there a way to specify which to choose? Should I just set it up in the script builder?

r-stein commented 4 years ago

I would open the ST console View > Show Console and check the executed commands. The Basic Builder should just call pdflatex with some options.