[Tex/LaTex] texmaker 3.5 miktex portable 2.9 and epstopdf

epstopdfmiktexportabilitytexmaker

I am using TeXMaker 3.5 (same problems in TeXMaker 3.4.1) and MikTeX 2.9. My source is:

\documentclass[10pt,a4paper]{article} 
\usepackage[utf8]{inputenc} 
\usepackage{graphicx} 
\usepackage{epstopdf} 
\begin{document} 
\begin{figure} 
\includegraphics[scale=1]{test.eps} 
\end{figure} 
\end{document} 

But I always get:

Package pdftex.def Error: File `test-eps-converted-to.pdf' not found.

MikTeX is working! The picture also exists and using the command prompt:

G:\LaTeX\sandbox>G:/miktex/miktex/bin/epstopdf --outfile=G:\LaTeX\sandbox\test-eps-converted-to.pdf G:\LaTeX\sandbox\test.eps

produce the pdf from the eps-file. This is my configuration:

 Tools\Latex="\"../miktex/miktex/bin/latex.exe\" -enable-write18 
 -interaction=nonstopmode %.tex"  Tools\Dvi=../miktex/miktex/bin/yap.exe -1 -s @.tex %.dvi 
 Tools\Dvips=\"../miktex/miktex/bin/dvips.exe\" -o %.ps %.dvi 
 Tools\Ps=../gsview/GSviewPortable.exe %.ps 
 Tools\Ps2pdf=\"../miktex/miktex/bin/ps2pdf.exe\" %.ps 
 Tools\Makeindex=\"../miktex/miktex/bin/makeindex.exe\" %.idx 
 Tools\Bibtex=\"../miktex/miktex/bin/bibtex.exe\" %.aux 
 Tools\Pdflatex="\"../miktex/miktex/bin/pdflatex.exe\" -enable-write18
 -interaction=nonstopmode %.tex"  Tools\Pdf=../SumatraPDF/SumatraPDF.exe %.pdf -reuse-instance
 -forward-search %.tex @  Tools\Dvipdf=\"../miktex/miktex/bin/dvipdfm.exe\" %.dvi 
 Tools\Metapost="\"../miktex/miktex/bin/mpost.exe\" --interaction
 nonstopmode " 
 Tools\Ghostscript=\"../miktex/ghostscriptx/bin/gswin64c.exe\" 
 Tools\Asymptote=../Asymptote/asy.exe %.asy 
 Tools\Latexmk="\"G:/miktex/miktex/bin/latexmk.exe\" -e
 \"$pdflatex=q/pdflatex -interaction=nonstopmode/\" -pdf %.tex" 
 Tools\Sweave=../R/bin/R.exe CMD Sweave %.Rnw

Does anyone has an idea how to solve this problem? I have created my portable version here.

Thanks in advance. I tried all possible permutations of --enable-write18, --shell-escape, -enable-write18,….

Best Answer

After (re-)installation of MiKTeX portable and some try&error I found out, that the real answer is … RTFM:

Excerpt from the epstopdf manual:

Note: Usually the conversion program needs the exact location of the image file. Usually the current directory works. Also if the image file is found using \graphicspath, the location is known. However, if the image is somewhere in a directory of environment variable TEXINPUTS, then the package does not know the exact location and the conversion program will not find the image file unless it implements a search using TEXINPUTS (program kpsewhich may be of help in this task).

So, you have the choice between following 3 possibilities:

  1. To the call of pdflatex add the commandline switch --include-directory="G:\LaTeX\sandbox" (Attention! No closing backslash here, or, if the path is without white space, leave out the double quote marks), but included inside of TeXMaker it’s not portable.

  2. Add the command \graphicspath to your TeX file. In a test I had to use slashes instead of the usually in Windows used backslashes. That’s also not portable, but you can easily change it, before you do a new compiling.

    \documentclass[10pt,a4paper]{article} 
    \usepackage[utf8]{inputenc} 
    \usepackage{graphicx} 
    \graphicspath={{G:/LaTeX/sandbox/}}
    \usepackage{epstopdf} 
    \begin{document} 
    \includegraphics[scale=1]{test.eps} 
    \end{document}
    
  3. What I would favour:
    Similar as I already pointed out in Using MikTex Portable, TexMaker, and Asymptote from a USB drive – edit the start file miktex-portable.cmd (make a safety copy first) and add the system variable TEXINPUTS. Note: The way it’s shown here, it works only, if the TEXINPUTS directory is on the same drive as the portable MiKTeX installation, and as far as I see, it’s the only portable way.

    @echo off
    
    set MOBIDRIVE=%~d0
    set TEXINPUTS=%MOBIDRIVE%\LaTeX\sandbox        
    set PATH=%TEXINPUTS%;%PATH%
    
    miktex\bin\miktex-taskbar-icon.exe
    

    Then you can (and should!) use the command line prompt, that you get with right click on the traybar icon. The command line compilation worked fine here in a test. Start TeXMaker from this command prompt or add a line

    start /i /d%MOBIDRIVE%\<path-to-texmaker> texmaker.exe
    

    before the above miktex\bin\miktex-taskbar-icon.exe or create an own startbatch file with the variable TEXINPUTS.

Remark: After I’ve done a test with TeXMaker portable (BTW: that’s actually not fully true!), that I had to download first, I must say, that obviously with TeXMaker this approach of point 3 didn’t work! Only with the \graphicspath version or, if the EPS file was in the same directory like the TEX file, I’ve got a result. (Remark 2: I used some example files of Ghostscript and the example folder as graphics path, everything was on the same drive.)

I leave the not functioning point here, because wieschoo’s answer refers to it.