[OS X TeX] using lengths inside pictures

Alex Scorpan scorpan at gmail.com
Fri Nov 3 08:38:48 EST 2006

>  \begin{picture}(12,3)
>  \put(2,1+\mylength){Hello!}
> \end{picture}

\put needs plain numbers as its arguments in parentheses.  Not  
arithmetic, and certainly not lengths (that have units, like cm).

The quick and very crappy way that I know for feeding some arithmetic  
into {picture} is to highjack the {calc} package.

I'd actually be very interested to hear from the TeXperts on how to  
do this better and more elegantly.  Anyways, my crappy hack is that I  
write something like





If there's any recursion tricks you're trying to implement there, it  
starts to get iffy.  I use


to force the evaluation of gaga at that precise moment.  And, of  
course, any sort of recurrent self-call starts to be beautified by  
\expandafter's...  the horror...


My experience with {picture} tells me that, if it can at all be  
avoided, it is just simpler and better to do all computations off- 
TeX.  If you need to rescale your whole picture, use

	\setlength{\unitlength}{<something else than 1pt>}

before the {picture} env.  Or, when more is needed, abuse the  
{graphicx} package, and do things like

	\rotatebox{45}{\begin{picture}(10,10) .... \end{picture}}

	\scalebox{.4}[.5]{\begin{picture}(10,10) ... \end{picture}}

Notice that (unlike acting on \unitlegth) \scalebox is also going to  
thiken/thin your line widths.


Ah, and, of course, general advice for using {picture}:  If you plan  
to output to pdf or ps, do add

at the beginning of your doc.  It helps with many things, by  
unloading some of the work on pdf or ps.


------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/

More information about the MacOSX-TeX mailing list