I'm using MiKTeX compiler and Visual Studio Code as my editor. I tried to plot a function using PSTricks but I always get fatal errors even when copying the exact same code as written on my manual book (LaTeX for teachers, Ellipses). So I create a empty document and add some code found on the web ([url="https://tug.org/PSTricks/pst-plot/Examples-exa/fixPoint0.pdf"]this pdf[/url]) to try understand what's going wrong but it fails too. Here's the code I use from the pdf linked before :
Code: Select all
\documentclass[11pt]{article}
% Packages
\usepackage[utf8]{inputenc} % support for accents
\usepackage[T1]{fontenc}
\usepackage[francais]{babel} % doc language
\usepackage{lmodern}
\usepackage[a4paper]{geometry} % marges
\usepackage{amssymb}
\usepackage{amsmath} % Text into equation
\usepackage{pstricks-add}
\begin{document}
\psset{unit=2cm}
\begin{pspicture}(-2.5,-1.5)(2.5,2.5)
\psaxes{->}(0,0)(-2.5,-1.5)(2.5,2.5)
\psplot[linewidth=1.5pt,algebraic]{-2.5}{+2.5}{(2*x+4)/(2+x^2)}
\psline[linestyle=dashed](-1.5,-1.5)(2.5,2.5)
\def\function{ xVal dup add 4 add xVal dup mul 2 add div }%
\pstVerb{ /xVal -1 def }% start value
\multido{\nA=0+1}{10}{%
\psline[linestyle=dotted](! xVal 0 )(! xVal xVal)
\psline[linecolor=red](! xVal xVal )(! xVal \function )
\psline[linecolor=red](! xVal \function )(! \function\space dup)
\pstVerb{ /xVal \function\space def}
}
\end{pspicture}
\end{document}
Code: Select all
Undefined control sequence.
\c@lor@to@ps ->\PSTricks
Undefined control sequence.
\XC@usec@lor ...string \color@ #1#2\endcsname \@@
Thanks !
PS : When I delete everything in the pspicture environment except from the \psaxes line, I got something strange : numbers are displayed but no line nor arrow at all !