LaTeX tricks

PSTricks

This package caused me a lot of pain... Altough even the official webpage has a tutorial, it did not work as intended for me.

My problem was that I also wanted to use the function psplot, and I did not realise that I also need to include the pst-plot package. Here is how I finally managed to work it smoothly.

\documentclass[12pt]{article}

\usepackage{pstricks}
\usepackage{pst-pdf}
\usepackage{pst-plot}

\begin{document}

\begin{pspicture}(-1,-1)(5,5)%
\psline{->}(-.5,0)(4.5,0)
\psline{->}(0,-.5)(0,4.5)
\rput[l](4.6,0){$x$}
\rput[b](0,4.6){$y$}
\psplot[linewidth=2pt]{.25}{3.75}{x 2 sub x 2 sub mul .25 sub}
\rput[c](2,3.25){$y=(x-2)^2-0.25$}
\end{pspicture}

\end{document}

Then compile it in this order (see also here)

latex <file.tex>
dvips -Ppdf -o <file-pics.ps> <file.dvi>
#ps2pdf -dAutoRotatePages#/None <file-pics.ps> <file-pics.pdf># for Windows user
ps2pdf -dAutoRotatePages=/None <file-pics.ps> <file-pics.pdf>
pdflatex <file.tex>

Or, if you are also using TexMaker, copy this to User field in the Quick Build tab which you find in the Options, Configure Texmaker menu.

latex %.tex|dvips -Ppdf -o %-pics.ps %.dvi|ps2pdf -dAutoRotatePages#/None %-pics.ps %-pics.pdf|pdflatex %.tex