2

I am getting error with this code:

\documentclass[12pt]{article}
\usepackage{ucs}
\usepackage[utf8x]{inputenc} 
\usepackage[ukrainian]{babel}
\usepackage{fontenc}
\usepackage{inputenc}
\usepackage{calc}
\usepackage{pstcol}
\usepackage{pstricks,pst-plot}
\usepackage{pst-text}
\usepackage{pst-char}
\psset{xunit=0.7cm,yunit=5cm}
\begin{document}

\begin{pspicture}(-7.5,-0.4)(7.5,1.2)
\psaxes[Ox=0,Oy=0,Dx=1,Dy=0.2,linecolor=black]{->}(0,0)(-7,-0.3)(7,1.1)
\end{pspicture}

\end{document}

Code error:

! Undefined control sequence.
<recently read> \c@lor@to@ps
l.17 \end
{pspicture}

Help me please. Whats wrong? P.S. Sorry for my bad english

  • Did you compile it with pdflatex? You must compile it with latex->dvips->ps2pdf sequence – kiss my armpit Mar 26 '14 at 7:02
4

You are trying to generate postscript picture directly from {pdf|lua}latex, it cannot be done this way. Use \usepackage{auto-pst-pdf} and run one the following commands (in depends on the TeX distribution you are using):

lualatex --shell-escape your-file.tex
lualatex --enable-write18 your-file.tex

The next option is to use a sequence of tools latex->dvips->ps2pdf->pdfcrop plus loading PDF file using the \includegraphics command from the graphicx package. I enclose your example rewritten for the first method and a preview of your sample picture.

\documentclass[12pt]{article}
\pagestyle{empty}
\usepackage{auto-pst-pdf}
\usepackage{ucs}
\usepackage[utf8x]{inputenc} 
\usepackage[ukrainian]{babel}
\usepackage{fontenc}
\usepackage{inputenc}
\usepackage{calc}
\usepackage{pstcol}
\usepackage{pstricks,pst-plot}
\usepackage{pst-text}
\usepackage{pst-char}
\psset{xunit=0.7cm,yunit=5cm}
\begin{document}
\begin{pspicture}(-7.5,-0.4)(7.5,1.2)
\psaxes[Ox=0,Oy=0,Dx=1,Dy=0.2,linecolor=black]{->}(0,0)(-7,-0.3)(7,1.1)
\end{pspicture}
\end{document}

mwe

| improve this answer | |
  • 2
    With xelatex you do not need any additional package or an editional conversion! – user2478 Mar 26 '14 at 10:21
  • @Herbert Thank you for letting me know. I have deleted xe in the post. – Malipivo Mar 26 '14 at 10:46

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