# PSTricks Failing to Draw

I'm trying to draw a simple graph with PSTricks for a mathematical paper, though I cannot for the life of me manage to do so. The package seems to have been correctly imported as I can run a PSTricks test document I found online. When I attempt to run the document in Texmaker, only a blank box appears. I've used numerous examples to no avail.

\begin{flalign*}
\text{(a) } -4 &&
\end{flalign*}
\begin{align*}
&\left|z\right| = \sqrt{x^2 + y^2} = \sqrt{(-4)^2 + 0^2} = \sqrt{16} = 4& \\
&\tan \theta = \frac{0}{-4} = 0 & \\
&\arctan (0) = 0, \pi& \\
&z = 4(\cos\pi + i\sin\pi)&
\end{align*}
\begin{pspicture}
\psline[linewidth=2pt]{<-}(2,1)
\end{pspicture}


Results in:

Note that the large white space was filled with more equations prior to adding the PSTricks snippet.

I am compiling with XeLaTeX and am trying to view the output PDF. In my testing, I have not been using the terminal for compilation, only Texmaker.

EDIT:

When I add dimensions to the pspicture environment, I get the following:

• give a complete example! As you can see in my example it works with xelatex
– user2478
Aug 31, 2016 at 18:25

without the dimension parameters you'll get an area of 10cm x 10cm. However, you can also draw any line without using the pspicture environment. Then everything refers to the current point:

\listfiles
\documentclass{scrartcl}
\usepackage{amsmath,pstricks}
\begin{document}

\begin{flalign*}
\text{(a) } -4 &&
\end{flalign*}
\begin{align*}
&\left|z\right| = \sqrt{x^2 + y^2} = \sqrt{(-4)^2 + 0^2} = \sqrt{16} = 4& \\
&\tan \theta = \frac{0}{-4} = 0 & \\
&\arctan (0) = 0, \pi& \\
&z = 4(\cos\pi + i\sin\pi)&
\end{align*}
\psline[linewidth=2pt]{<-}(2,1)

\end{document}


Either add dimensions to the pspicture environment:

\documentclass{article}
\usepackage{amsmath}
\usepackage{pstricks}

\begin{document}
%
\begin{flalign*}
\text{(a) } -4 &&
\end{flalign*}
\begin{align*}
&\left|z\right| = \sqrt{x^2 + y^2} = \sqrt{(-4)^2 + 0^2} = \sqrt{16} = 4& \\
&\tan \theta = \frac{0}{-4} = 0 & \\
&\arctan (0) = 0, \pi& \\
&z = 4(\cos\pi + i\sin\pi)&
\end{align*}
\begin{pspicture}(0,0)(2,1)%
\psline[linewidth=2pt]{<-}(2,1)
\end{pspicture}

\end{document}


or load auto-pst-pdf, use the postscript environment and compile with pdflatex (don't forget the -shell-escape switch under TeX Live or MacTeX, --enable-write18 under MiKTeX)

\begin{postscript}%
\psline[linewidth=2pt]{<-}(2,1)
\end{postscript}


• I added an edit so you can see what I get when I attempt to add dimension to the pspicture environment. Aug 31, 2016 at 13:03
• I don't understand: the image corresponds to a pspicture with dimensions? Your code has none. Aug 31, 2016 at 13:21
• I ran the exact code you posted in your answer in Texmaker using the quickbuild (set to LaTeX + dvips + ps2pdf + View PDF) option, yet I still get nothing. I end up with exactly what you have in your answer's image, just without the arrow. No errors are given in the console. Aug 31, 2016 at 16:24