2

I am new to PStricks and Tex in general and no matter what I do, I get the same error message running a very simple code like the following:

\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{pst-all}
\usepackage{graphics}
% !TeX program = xelatex
\begin{document}
    \begin{pspicture}(2,2)(5,5)
        \psline(0,0)(1,1)
    \end{pspicture}
\end{document}

These are the error messages I get:

! Undefined control sequence.
<recently read> \c@lor@to@ps 

l.12 ^^I^^I\psline(
            0,0)(1,1)
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

And:

! Package inputenc Error: inputenc is not designed for xetex or luatex.
(inputenc)          only UTF-8 supported.

I don't understand what the error is since I run the document with XeTex and use TexStudio (if that is of any importance). Thank you for your help :)

Troy
  • 13,741
Bucephalus
  • 21
  • 4
  • Welcome to TeX SX! Which engine do you use to compile? – Bernard Jan 06 '18 at 21:17
  • I compile with XeLaTex. – Bucephalus Jan 06 '18 at 21:21
  • 2
    Then you don't have to load inputenc. Is your document utf8 encoded? – Bernard Jan 06 '18 at 21:23
  • No, I don't think it is. – Bucephalus Jan 06 '18 at 21:31
  • you say you get one error or the other, which do you get? You should get the \c@lor@to@ps error if you use pdflatex instead of latex or xelatex, and you get the inputenc error if you use xelatex when using inputenc. If you are using xelatex the file must be utf8 encoded – David Carlisle Jan 06 '18 at 21:35
  • Well you should: xelatexand lualatex require it, and even for (pdf)latex, it is strongly recommended nowadays. It's the only encoding with ascii working on all platforms, and most modern editors use it. – Bernard Jan 06 '18 at 21:37
  • Delete the line with inputenc and it will work with xelatex –  Jan 06 '18 at 21:38
  • @David Carlisle: I actually get both errors when using XeLaTex, I should have used "and" instead of "or". Should I put \usepackage[utf8] instead? – Bucephalus Jan 06 '18 at 22:20
  • With xelatex, you don't have to declare any encoding – but your code has to be in utf8. – Bernard Jan 06 '18 at 22:33
  • no you need to delete the inputenc line (inputenc may not be used with xetex) and make sure your file is in utf-8 (all xetex files have to be in utf-8) – David Carlisle Jan 06 '18 at 23:05

0 Answers0