3

The following trivial example illustrates my objective to create a converting operator ptcm (pt to cm). Unfortunately, it produces errors in TeX world as opposed to PS world.

\documentclass{beamer}
\usepackage{pstricks}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{pspicture}
\PreviewBorder=12pt

\SpecialCoor

\begin{document}
\begin{frame}
\begin{pspicture}[showgrid=top](4,4)
\makeatletter
\pstVerb{/ptcm {\pst@number\psunit\space div} bind def}
\makeatother
\psline(!4 12 ptcm sub 0)
\end{pspicture}
\end{frame}
\end{document}

The error messages are:

! Undefined control sequence.
<argument> /ptcm {\pst 
                       @number\psunit \space div} bind def
l.17 \end{frame}

? 
! Emergency stop.
<argument> /ptcm {\pst 
                       @number\psunit \space div} bind def
l.17 \end{frame}

How to create a new converting operator?

5
<argument> /ptcm {\pst 
                       @number\psunit \space div} bind def

shows you that \pst@number has been parsed as \pst @number because @ is not a letter.

Beamer reads frame bodies as a macro argument so you need to put \makeatletter before the frame.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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