2

I feel "uncomfortable" with the existing constants below (which are already defined in PSTricks)

Euler = 2.718281828
Pi = 3.141592654

because I think using e and π is much more natural.

My question is : How can I use unicode characters as identifiers in PostScript? Is it impossible?

\documentclass[pstricks,border=12pt]{standalone}

\usepackage{pst-plot}
\pstVerb
{
    /e {2.718281828} def 
    /π {3.141592654} def 
}

\def\f{ln(e^x)+π}

\begin{document}
\begin{pspicture}[algebraic](0,-2)(5,5)
    \psplot{0}{4}{\f}
\end{pspicture}
\end{document}
2

I think the answer is no, you can't do this. According to page 25 of the Postscript Language Reference Manual

There are three encodings for the PostScript language: ASCII, binary token, and binary object sequence.

  • Sorry, Is π (ALT+227) ASCII? – kiss my armpit Jul 14 '14 at 19:53
  • @Pleasedon'ttouch --- I don't think so. – Ian Thompson Jul 14 '14 at 19:59
  • 1
    @Pleasedon'ttouch Alt 247 is presumably some input convention in your system but pi is unicode U+03C0 (decimal 960) which isn't in the 0-127 ASCII range. – David Carlisle Jul 14 '14 at 20:18

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.