ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Cc: ntg-context@ntg.nl
Subject: Re: Aligning hboxes on top instead of on baseline
Date: Tue, 14 Nov 2000 12:34:05 +0100	[thread overview]
Message-ID: <3.0.6.32.20001114123405.01fac320@pop.wxs.nl> (raw)
In-Reply-To: <3A1106CA.C659E643@pobox.com>

At 10:32 AM 11/14/00 +0100, Berend de Boer wrote:
>Hello All,
>
>I want to `align' text on the top of their boxes instead of using the
>baselineskip or whatever is causing the problem.
>
>I've defined a chapter that puts its number in the right margin.
>However, the number is much larger than the chapter title. TeX aligns
>these on the bottom of the text, so the number `pushes' the chapter
>title down. But I want them aligned at the top, so the number should
>stick out to the bottom.
>
>Is this possible to do independent of the body font and the selected
>number font size?  I've done things like this by manual shifting things
>down until it looked good, but perhaps their is a more elegant solution.
>
>
>Demo:
>
>-------------------------------
>% interface=en
>
>\setupbodyfont
>  [ber,pos,ss]
>
>% put chapter title above paragraph, number in right margin
>\def\myhead#1#2%
>  {\doifsomething{#1}%
>     {\rlap{\hskip\tekstbreedte\hskip\rechtermargeafstand#1}}%
>   #2}

\inrightmargin takes care of a 'unbiased' placement in the right margin,
which saves you some hard coded values,  

\def\myhead#1#2%
  {\setbox0=\ruledhbox{#1}%
   \setbox2=\ruledhbox{#2}%
   \setbox0=\hbox{\lower\ht0\hbox{\raise\ht2\box0}}%
   \ht0=\ht2 \dp0=0pt
   \hbox{\box2\inrightmargin{\box0}}}

The lower and raise commands make sure that the number hangs, and the ht/dp
assignment obscures the number, 
of course you need to remove the 'ruled' after you see what happens. 

Hans
-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------


  reply	other threads:[~2000-11-14 11:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-14  9:32 Berend de Boer
2000-11-14 11:34 ` Hans Hagen [this message]
2000-11-14 13:01   ` Berend de Boer
2000-11-14 13:55     ` Hans Hagen

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=3.0.6.32.20001114123405.01fac320@pop.wxs.nl \
    --to=pragma@wxs.nl \
    --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).