# Example from PSTricks manual not rendering

Can you set me straight in the very first attempt to use PSTricks drawing features please? The ultimate goal is to draw a triangle with the vertices angles marked on the inside with \alpha, \beta, and \gamma and sides marked with a, b, and c on the outside.

I've started by copying a sample from PSTricks user manual page 70 and wrapping it in a \pspicture:

\documentclass[10pt,letterpaper]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{pstricks}
\begin{document}

\pspicture(0,0)(5,5)
\pspolygon(0,0)(4,3)(4,0)
\pcline[offset=12pt]{|-|}(0,0)(4,3)
\ncput*[nrot=:U]{Length}
\endpspicture

\end{document}


Doing this in Texmaker, I fcompile using latex --> dvips --> ps2pdf. latex-build ends with the errors:

Line 13 ! ! Undefined control sequence.<recently read> \pcline \pcline
Line 14 ! Undefined control sequence. 3 \ncput


The rendered file displays a triangle drawn correctly, but overlaid along the adjucent cathetus with the following text:

12 [offset=12pt]—-—(0,0)(4,3) 3 *[nrot=:U]Length


To use \pcline and \ncput you must include the pst-node package. Also, the 1 etc. are left from some line numbers in the code example.

A minimal examples, which should work is:

\documentclass{article}
\usepackage{pstricks, pst-node}
\begin{document}
\begin{pspicture}(0,0)(5,5)
\pspolygon(0,0)(4,3)(4,0)
\pcline[offset=12pt]{|-|}(0,0)(4,3)
\ncput*[nrot=:U]{Length}
\end{pspicture}
\end{document}

• Actually, the 1-2-3 are a copy-paste error from Acrobat Reader, which is throwing exceptions on this box every time I copy something to the clipboard.
– ajeh
Nov 26 '13 at 15:43
• @ajeh Well, that is exactly what Christoph is saying! Nov 26 '13 at 15:49

Its very easy to generate these codes automatically by drawing the figures using Latex Draw. You can get this amazing free software at this link: http://latexdraw.sourceforge.net/

I am providing a sample of the tex codes required in your case. I have used Latexdraw to generate the PStricks codes:

\documentclass[10pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{auto-pst-pdf}
\usepackage{pst-pdf}
\begin{document}
\begin{figure}[h]
\begin{center}
\psscalebox{0.5 0.5} % Change this value to rescale the drawing.
{
\begin{pspicture}(0,-2.4629033)(10.920668,2.4629033)
\pspolygon[linecolor=black, linewidth=0.04](2.938693,2.4370966)(0.038692933,-1.6629033)(10.838693,-1.6629033)
\rput[bl](2.838693,1.7370967){\huge{$\alpha$}}
\rput[bl](0.6386929,-1.5629034){\huge{$\beta$}}
\rput[bl](9.238693,-1.5629034){\huge{$\gamma$}}
\rput[bl](4.638693,-2.4629033){\huge{$a$}}
\rput[bl](6.538693,0.83709663){\huge{$b$}}
\rput[bl](0.73869294,0.43709663){\huge{$c$}}
\end{pspicture}
}
\end{center}
\caption{Required triangle}\label{t1}
\end{figure}
\end{document}


The output is :