[texhax] Combining symbols [picture, axis_height]

Uwe Lück uwe.lueck at web.de
Mon Feb 9 13:33:22 CET 2009


At 20:32 29.12.08, John Palmer wrote:
>On Monday 29 December 2008 03:54:11 Daniel Freedman wrote:
> > position a bullet over the arrowhead
>
>I have done this sort of thing by using \raisebox for vertical and \kern for
>horizontal movement, but there must be a more robust and elegant way, so I'll
>be interested in other replies !

At 15:58 04.01.09, John Palmer wrote:
>I was in a picture environment, drawing a map, and wanted to put symbols 
>centred on specified coordinates, so usually needed a shift leftwards and 
>downwards from the default position.

This led me to think about vertical placement of labels near marks of 
certain points in the plain, and I wondered how \makebox(0,0) has been used 
to obtain this. A main application may be labelling the "tic" marks of the 
vertical axis of a diagram.

I am curious about general conventions here, while I haven't tried to draw 
x-y-diagrams so far. (You can adapt your field of research to your 
graphical abilities, cf. 
http://www.webdesign-bu.de/uwe_lueck/writings.html). The PS-Tricks people 
may have clear convictions about this.

\makebox(0,0){foo} (LaTeX picture environment) centers `foo' essentially by 
\vbox{\vss\hbox{foo}\vss}. With \put(<x>,<y>){\makebox(0,0){foo}}, <y> is 
half between top and bottom of `f' (their y-coordinates).

So consider alignment of `b' and `p' in 
\put(<x>,<y>){\makebox(0,0){b\quad}\_\makebox(0,0){\quad p}}. Tops of `b' 
and `p' are aligned, likewise their bottoms, half in between the horizontal 
stroke. This horizontal stroke may be a tic mark on the vertical axis of an 
x-y-diagram.

I think this is ridiculous, `b' and `p' should share a common baseline. I 
think that the label for a mark at vertical position <y> should have its 
*axis* at <y>, not half between its top and bottom. *axis* is here the 
vertical position of *fraction strokes* (those horizontal lines between 
numerators and denominators). I feel that this is the natural vertical 
"center" of a line.

To keep some touch with reality, I would like to consider the case that the 
vertical axis of a diagram refers to an amount of *water*, in terms of g 
(grams) as well as in terms of ml (1/1000 litres). Due to different \dp and 
\hp (while there sums are the same), the names nad numbers of the units 
would have different base lines.

Therefore I thought that vertical centering of `foo' around (<x>,<y>) 
should be just \put(<x>,<y>){$\lower\axisheight\hbox{foo}$}, with 
\def\axisheight{\fontdimen22\textfont2\relax}. I would replace \makebox(0,0) by

     \newcommand*{\piczzbox}[1]{%
         $\m at th\raisebox{-\fontdimen22\textfont2}[\z@][\z@]%
                        {\hb at xt@\z@{\hss#1\hss}}$}

Complete example:

     \setlength{\unitlength}{1in}
     \begin{picture}(5,4)
       \put(2,2){\makebox(0,0){b\quad}\_\makebox(0,0){\quad p}}
       \put(4,2){\piczzbox{b\quad}\_\piczzbox{\quad p}}
     \end{picture}

Opinions? Or is this well-known? Of course the question may rise rarely, 
axis tics usually are numbered, labels usually have same \dp and \ht.

Cheers,

     Uwe.



More information about the texhax mailing list