3

The (!ps) syntax is supposed to expand to a pair of coordinates by executing some raw postscript code. In the following example it works well in argument to \rput but not with \psaxes; why is it so?

\documentclass{article}
\usepackage{pstricks,pst-plot}
\begin{document}
\begin{pspicture}
\rput(! .5 .5 floor){floor level}
% \psaxes(! 0 .5 floor)(! 1 1) % fails with "Runaway argument?"
\psaxes(0,0)(1,1) % no trouble
\end{pspicture}
\end{document}

More generally, is there a documentation giving details about the (!ps) syntax?

4

That is the default behaviour! The coordinares are needed for the labels which are set on TeX level where the PostScript notation is not possible. You can create your own axes macro:

\documentclass{article}
\usepackage{pst-plot}
\def\psAxes(!#1 #2)(!#3 #4){\psline(!#1 0)(!#3 0)\psline(!0 #2)(!0 #4)}
\begin{document}
    \begin{pspicture}
    \rput(!.5 .5 floor){floor level}
    \psAxes(!0 {.5 floor})(!1 1) % fails with "Runaway argument?"
    \end{pspicture}
\end{document}
  • Thanks for the answer but if I use \psaxes instead of two \psline it is precisely to enjoy the automatic labeling. Actually I am not sure to understand the "... the labels which are set on TeX level..." part, because of lack of knowledge of internal TeX mechanism. Do you think that resorting to an auxiliary variable defined with \pstFP* arithmetic macros is the best (easiest) alternative? If so, I would provide it as an answer. – Hugo Raguet Jan 18 '17 at 12:45
  • "on TeX level" means that the labels are set by TeX and not by PostScript. The coordinates defined by (!...) are evaluated when converting the ps output into pdf with ps2pdf or with xdvipdfmx when using xelatex. TeX does nothing with such coordinates. However, you can use any TeX macro to modify the coordinates. – user2478 Jan 18 '17 at 17:13
  • Ok then, I'll accept this as an answer to the explicit question I asked. I wish there were a more elegant way than resorting to TeX arithmetic (or string parsing...). As for the concrete example I proposed, it seems that \pstFPMul{\res}{\val}{1} would perform a rounding towards zero of the expression in \val and store it in \res. This is the floor function if \val is positive. Any simple idea for the general case is welcome. – Hugo Raguet Jan 19 '17 at 10:06

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.