1

I want to compile this. PSTricks image but it does not work in LaTeX. It was exported from Inkscape I have tried to compile it by doing this:

\documentclass{article}
\usepackage{tikz}
\usepackage{pstricks}
\usepackage{graphicx}    
\begin{document}    
\begin{figure}[ht]
\input{Figures/drawing.tex}
\caption{Figure example}
\end{figure}
\end{document}

But it shows a lot of errors. Can someone give me a hand with that?

11
  • We don't know the error and we don't know what code caused the error. How much help would you be able to give somebody in that case? The code you provide here should allow us to reproduce the error and you should include the exact text of the error message. (Your question should not depend on the content of an external link which will render it meaningless when that link changes.) – cfr Oct 2 '16 at 1:36
  • @cfr, the error is this: Undefined control sequence. }. For many lines in the image.tex file – Erincon Oct 2 '16 at 1:42
  • Oh, that's a helpful error. It tells you which control sequence is undefined. (You've left this bit out, but it is there.) So just load the relevant package or define whatever you've forgotten. – cfr Oct 2 '16 at 1:45
  • Well, I do not know exactly what I've forgotten because I've followed tutorials but they don't add something new in the lines I've pasted above. Maybe is something wrong with the image.tex code? – Erincon Oct 2 '16 at 1:56
  • The point is: the message tells you what is undefined but you've not told us that bit. So you know but we can only guess - and it could be almost anything, really, aside from the cs's defined by LaTeX, the packages you've loaded and TeX itself. That leaves a whole world of undefined things. Which particular one or ones are included in image.tex? We don't know. But the error message has told YOU. Trust it. Whatever it says is undefined probably is. – cfr Oct 2 '16 at 3:17
1

You run the document with pdflatex, but it must be run with xelatex or the sequence latex->dvips->ps2pdf.

If you really need pdflatex then use

\documentclass{article}
\usepackage{auto-pst-pdf}
\ifpdf
  \usepackage{tikz}
\else
  \usepackage{pstricks}
\fi
\usepackage{graphicx}    
\begin{document}    
    \begin{figure}[ht]
        \input{Figures/drawing.tex}
        \caption{Figure example}
    \end{figure}

\end{document}

and run pdflatex --shell-escape <filename> Then you'll get the image, too.

enter image description here

3
  • Which editor are you using? – user2478 Oct 2 '16 at 19:15
  • 1
    Sorry for delete my comment. Error: Package auto-pst-pdf Error: . Or turn off auto-pst-pdf.}. I am using TexStudio running on Ubuntu 16 – Erincon Oct 2 '16 at 19:18
  • In TeXstudio you can choose with options->configure->build or setting the standard compiler to whatever you like. And dont't forget to add the option --shell-escape for the compiler. – user2478 Oct 2 '16 at 19:47
1

I put the drawing.tex in the same directory in which the following input file exists.

\documentclass{article}
\usepackage{pstricks}  
\begin{document}    
\begin{figure}[ht]
\input{drawing.tex}
\caption{Figure example}
\end{figure}
\end{document}

enter image description here

1
  • Changing the compiler from PdfLaTex to XeLaTex worked perfectly – Erincon Oct 3 '16 at 0:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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