From: Jonathan Nicholl <jonathan.nicholl@kcl.ac.uk>
Subject: Vertical alignment of marginal material
Date: Tue, 24 Feb 2004 01:42:30 +0000 [thread overview]
Message-ID: <B5C1A734-666A-11D8-A5F0-000A956A3A8A@kcl.ac.uk> (raw)
In-Reply-To: <20040223110008.18013.96778.Mailman@ref.ntg.nl>
> Message: 12
> Date: Mon, 23 Feb 2004 10:14:38 +0100
> To: ntg-context@ntg.nl
> From: Hans Hagen <pragma@wxs.nl>
> Subject: Re: [NTG-context] alignment of marginal material
> Reply-To: ntg-context@ntg.nl
>
> 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 cases:
>>
>> \def\hazard#1{%
>> \setbox0=\vbox{#1}%
>> \inleft [low] {%
>> \framed%
>> [height=\ht0,%
>> top=\vss,%
>> bottom=\vss,%
>> frame=off]%
>> {\externalfigure [sharp turn sign]}%
>> }%
>> #1}%
>>
>> If I type something like
>>
>> \hazard{…paragraph text…}
>>
>> this produces what I want. But it breaks down with mathematics.
>>
>> \hazard{%
>> \startformula
>> …mathematics…
>> \stopformula
>> }
>>
>> produces the picture aligned with the bottom of the mathematics.
>>
>> A solution to this problem escapes me. Can anyone suggest an improved
>> macro?
>
> Here is my 10 minute solution ... if i'm in the mood i can make an
> option of it
Maybe other people would like some support for this kind of thing.
Certainly I would find it useful if, when I wrote `\inmargin…'
somewhere inside a paragraph, I could specify an option to determine
the vertical alignment of the marginal material. Suppose `top' aligned
the top of the marginal material with the top of the paragraph, `mid'
the middle of the marginal material with the midpoint of the paragraph,
and `bot' the bottom of the marginal material with the bottom of the
paragraph. That would be good.
> \newcounter\CurrentFigPar
>
> \def\StartFigPar#1%
> {\doglobal\increment\CurrentFigPar
> \placefigure
> [leftmargin,line,none]{}
> {\setbox\scratchbox\hbox{#1}%
>
> \ifnum\MPp{figpar:b:\CurrentFigPar}=\MPp{figpar:e:
> \CurrentFigPar}\relax
> \scratchdimen\MPy{figpar:b:\CurrentFigPar}%
> \advance\scratchdimen-\MPy{figpar:e:\CurrentFigPar}%
> \advance\scratchdimen-\ht\scratchbox
> \advance\scratchdimen\lineheight
> \else
> \scratchdimen\zeropoint
> \fi
> \vbox{\vskip.5\scratchdimen\box\scratchbox}}%
> \indent\hpos{figpar:b:\CurrentFigPar}{\strut}\ignorespaces}
>
> \def\StopFigPar
>
> {\removeunwantedspaces\hpos{figpar:e:\CurrentFigPar}{\strut}\endgraf}
>
> \starttext
>
> \input tufte
>
> \StartFigPar{\externalfigure[cow.pdf][width=1cm]} \input tufte
> \StopFigPar
>
> \input tufte
>
> \stoptext=20
Thank you very much indeed, Hans. This puts cow.pdf in the right place
in the margin. One problem remains. Surrounding a paragraph by
\StartFigPar…\StopFigPar often messes up the inter-paragraph vertical
spacing. In particular, surrounding \startformula…\stopformula by
\StartFigPar…\StopFigPar introduces big spaces above and below the
mathematics.
Is there a simple way to stop this? It would be good if introducing a
few \StartFigPar…\StopFigPar pairs to a document had no effect at all
on the main body of the document, and just put figures in the margin.
-----------------------
Jonathan Nicholl
Department of Philosophy
King's College London
parent reply other threads:[~2004-02-24 1:42 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20040223110008.18013.96778.Mailman@ref.ntg.nl>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B5C1A734-666A-11D8-A5F0-000A956A3A8A@kcl.ac.uk \
--to=jonathan.nicholl@kcl.ac.uk \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).