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.

If I use the following code, there two different kinds of units. One for the coordinate system used to declare \begin{pspicture} with (0,0) to (20,10), and the centimeter used in 4.2cm.

\begin{pspicture}(0,0)(20,10)
\rput[lt](0.5,9){\psframebox[linewidth=1pt,framearc=0]{\parbox[c]{4.2cm}{\raggedright Text Goes Here...}}}
\end{pspicture}

Can I use a unified dimension for both PSTricks objects and \parbox?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

The pstricks manual says on page 6:

The values of the runit, xunit and yunit parameters are stored in the dimension registers \psunit (also \psrunit), \psxunit and \psyunit.

So you should be able to use:

\parbox[c]{4.2\psxunit}{...}

to get the width of 4.2 in the pstricks coordinate system. However, if you using complex transformations this might not work correctly, I guess. You can set the units using \psset{xunit=1cm} etc.

share|improve this answer

The parbox is a TeX macro and arguments follow the TeX rules for units. Values without a unit are not possible without rewriting the macro. In PSTricks you can mix all kinds of units; \psline(3,4in)(5cm,2) The current default unit is set by \psset{unit=...}, preset to 1cm. And you can you \psTextFrame instead of \rput:

\documentclass{minimal}
\usepackage{pstricks}
\begin{document}

\begin{pspicture}(0,0)(20,10)
\psTextFrame[linewidth=1pt](0.5,8.5)(4.7,9){\parbox[c]{4\psunit}{Text Goes Here...}}
\end{pspicture}

\end{document}
share|improve this answer
    
What is the unit of measure for the parameters specified with \begin{pspicture}(lx,ly)(ux,uy)? It is obvious that this does not - should not - change whenever you reset units using \psset{unit=...} and the like. –  Werner Jul 27 '11 at 19:06
    
I do not understand what you really mean. There is no difference in using the coordinates for lines or for the environment pspicture. Any unit is possible and it is internally converted to pt –  Herbert Jul 27 '11 at 19:39
    
So, when specifying \begin{pspicture}(0,0)(20,10) it internally converted to be equivalent to \begin{pspicture}(0pt,0pt)(20pt,10pt)? –  Werner Jul 27 '11 at 19:41
2  
no, the default unit is cm, so it is converted to (0pt,0pt)(57.64pt,28.82pt) –  Herbert Jul 27 '11 at 19:44
    
That answers my question completely. Thanks! I din't know what the default unit was for the environment coordinates, since I did not notice it in the PStricks documentation. –  Werner Jul 27 '11 at 19:54

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.