Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In order to be more noticeable, I present my comment as a new question here.

Background:

\uput with the following syntax

enter image description here

accept 5 arguments. I have tested the last four arguments that they can be represented in RPN. The first argument is the only one cannot be represented in RPN.

Question:

Why can the first argument of \uput not be represented in RPN? Is it a bug? You can try \uput{! 2 sqrt}[!0]{!0}(!0 0){Hello World} to put Hello World \sqrt{2} unit length away to the right of the origin (0,0), but it fails.

share|improve this question
    
This isn't an issue about RPN. You're trying to pass postscript code through the arguments. I haven't played too much with \uput. As I get a chance today, I'll look at this. –  A.Ellett May 6 '13 at 19:17
    
@A.Ellett: So the first argument cannot accept RPN expression? –  In PSTricks we trust May 6 '13 at 19:26
    
Postscript is written in RPN. After an initial look at pstricks.tex, it looks like \uput isn't designed to accept Postscript arguments. –  A.Ellett May 6 '13 at 19:49
    
@A.Ellett: Can you guess the reason why it was designed without supporting RPN for the first argument? You can make your comment as your answer. –  In PSTricks we trust May 6 '13 at 19:56
    
@A.Ellett: you do not understand the meaning and definition of the different arguments. \uput understands PS arguments. –  Herbert May 12 '13 at 5:53

2 Answers 2

up vote 4 down vote accepted

For the newest pstricks package, the labelsep of \uput can accept RPN expression (without unit) and it takes the active unit.

\documentclass[pstricks,border=12pt]{standalone}
\SpecialCoor
\begin{document}
\begin{pspicture}[showgrid](-1,-1)(3,3)
    \pscircle(1,1){!2 sqrt}
    \uput{!2 sqrt}[45](1,1){\qdisk(0,0){2pt}}
\end{pspicture}
\end{document}

enter image description here

share|improve this answer

This isn't an issue about RPN or not. This is about the ability to pass Postscript commands through \uput. This doesn't seem to work. I'm drawing a complete blank why. Someone better acquainted with the internals of pstricks can explain that.

But, I'm assuming that you want to be able to make some kind of contextually dependent decisions on how text is placed (if not, then just write the actual values in). You can use a bit of expl3 magic to get this done as in the following code:

\documentclass{article}
%..%
\usepackage{xparse}
\ExplSyntaxOn
\DeclareDocumentCommand{\fpsqrt}{ m }
    {
        \fp_eval:n {  #1 ^ ( 1 / 2 ) }        
    }
\ExplSyntaxOff
%..%
\usepackage{pstricks}
\psset{unit=0.5cm}
\pagestyle{empty}
\begin{document}

$\sqrt{2}=\fpsqrt{2}$

\begin{pspicture}[showgrid=true](-10,-10)(10,10)
    \uput{ \fpsqrt{2} }[0]{30}( 0, 0){Hello World}
\end{pspicture}

\end{document}

This results in

enter image description here

share|improve this answer
    
I usually use fp package. So I can summarize that it is a bug in PSTricks. :-) –  In PSTricks we trust May 6 '13 at 20:50
    
I didn't recommend fp only because the documentation is so poor. –  A.Ellett May 6 '13 at 20:52
    
But its syntax is more beautiful. :D –  In PSTricks we trust May 6 '13 at 20:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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