Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I use pdflatex to compile source files that contain EPS figures as well as PSTricks. My standard way of handling this is to use auto-pst-pdf. I have been using TeXstudio to compile files under Windows with no problem. Recently, I have tried the same under MacTeX 2013 with TeXstudio 2.6.4 with no success and the error message

sh: latex: command not found.

I know that auto-pst-pdf runs latex+dvips+ps2pdf first, but I do not understand why running latex runs into trouble.

By the way, TeXShop runs the file with no problem.

Minimal Example: This code runs fine under windows (with MikTeX) when I use Winedt or Texstudio. It also runs fine with MacTex if I use Texshop, but gives me errors if I run it with texstudio on Mac. It returns a pdf file that instead of the figure has a blank square in it.

\documentclass{article}
\usepackage{graphicx}
\usepackage{microtype}
\usepackage{auto-pst-pdf}
\begin{document}
This is a test. The following figure should be processed OK when PdfLaTeX is run.

\bigskip

\includegraphics[width=5in]{fig4.eps}
\end{document}
share|improve this question
    
Have you set the paths correctly for TeXStudio? Can it compile anything? –  Alan Munn Nov 4 '13 at 4:16
    
@Alan Munn. The path is OK. In fact it compiles the file but figures are substituted by blank squares. My remote guess: auto-pst-pdf internally calls latex, but the path by which it calls latex is not correct? –  per Nov 4 '13 at 4:22
    
Can you try doing which latex in a Terminal window? –  egreg Nov 4 '13 at 7:31
    
@egreg which latex gives /usr/texbin/latex . –  per Nov 4 '13 at 13:29
    
@per Can you add a minimal example? –  egreg Nov 4 '13 at 15:04

3 Answers 3

Make sure you've also installed the pdfcrop package. It installs a small Perl script to crop the generated PDF to its bounding box size, so that it can be included in your main LaTeX document.

share|improve this answer
1  
pdfcrop is installed. That is why Texsop compiles the example with no problem. –  per Nov 5 '13 at 3:07
    
In the compilation command setting for TeXstudio (where you have "latex ...", have you enabled the option -shell-escape? –  LianTze Lim Nov 5 '13 at 3:26
    
-shell-escape option is already there. –  per Nov 5 '13 at 3:41

try

\usepackage[crop=off]{auto-pst-pdf}
share|improve this answer
    
tried, same result. I think the error is in the latex+dvips+ps2pdf step, and most probably in the latex step of it. –  per Nov 5 '13 at 7:29
    
then the paths for the TeX/LaTeX binaries are not correct set in TeXstudio –  Herbert Aug 2 at 21:11

To diagnose your problem, try this with pdflatex -shell-escape filename.tex.

% this input file name is filename.tex
% compile it with pdflatex -shell-escape filename.tex

\documentclass[preview,border=12pt]{standalone}

\usepackage{filecontents}

\begin{filecontents*}{temporary.tex}
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{graphicx}
\newsavebox\IBox
\savebox\IBox{\includegraphics{example-image-a.eps}}
\psset{xunit=\wd\IBox,yunit=\ht\IBox}
\begin{document}
\begin{pspicture}[showgrid=top](1,1)
    \rput[bl](0,0){\usebox\IBox}
\end{pspicture}
\end{document}
\end{filecontents*}

\usepackage{graphicx,pgffor}
\edef\AutoRotateOff{-dAutoRotatePages=/None}

\foreach \compiler/\ext in {latex/tex,dvips/dvi,ps2pdf \AutoRotateOff/ps}{\immediate\write18{\compiler\space temporary.\ext}}

\begin{document}
This is a test. The following figure should be processed OK when PdfLaTeX is run.

\bigskip

\includegraphics{temporary.pdf}% extension is not necessary
\end{document}

If you can get the following, there is a problem with your editor.

enter image description here

share|improve this answer
    
Tried this at the command prompt, works fine with the expected result. Tried with Texshop, again works fine. Tried with texstudio, get the following error messages: sh: latex: command not found sh: dvips: command not found sh: ps2pdf: command not found Process exited normally –  per Nov 9 '13 at 6:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.