[NTG-context] alignment of marginal material

Hans Hagen ntg-context@ntg.nl
Mon, 23 Feb 2004 10:14:38 +0100

At 21:40 22/02/2004, Jonathan Nicholl wrote:
>I am trying to write a macro which places a picture in the margin. I would=
>like the centre of the picture to be aligned vertically with the centre of=
>the paragraph in which I call the macro. The following works in simple=
>\def\hazard#1{%                         The argument is the text of the=20
>         \setbox0=3D\vbox{#1}%             I do this to work out the height=
> of the paragraph
>         \inleft [low] {%
>                 \framed%
>                         [height=3D\ht0,%  This makes the height of the=20
> frame equal to the height of the paragraph
>                         top=3D\vss,%
>                         bottom=3D\vss,%   These two lines centre the=20
> picture in the frame
>                         frame=3Doff]%
>                         {\externalfigure [sharp turn sign]}%
>                 }%
>         #1}%                                            It goes wrong if=
> you replace #1 with \box0
>If I type something like
>\hazard{=85paragraph text=85}
>this produces what I want. But it breaks down with mathematics.
>         \startformula
>                 =85mathematics=85
>         \stopformula
>produces the picture aligned with the bottom of the mathematics.
>A solution to this problem escapes me. Can anyone suggest an improved=

Here is my 10 minute solution ... if i'm in the mood i can make an option=20
of it





\input tufte

\StartFigPar{\externalfigure[cow.pdf][width=3D1cm]} \input tufte \StopFigPar

\input tufte