Re: Starthanging alignment on grid

Wolfgang Schuster <[email protected]> Mon, 29 Jun 2026 19:59:57 +0200
Newsgroups gmane.comp.tex.context
Message-ID <[email protected]>
Am 26.06.2026 um 07:33 schrieb Pablo Rodriguez via ntg-context:
> On 6/26/26 06:11, Aryeh Zapinsky wrote:
>> Thanks! I used \vbox, but yes, that does work.
> 
> Sorry, comparing the results of both `\hbox` and `\vbox` to what I had
> in the first initial, the former option seemed the right one to me: I
> thought the placement with \vbox was wrong (although this was the first
> time I used the Hebrew script in my whole life 😅).
> 
>> Do you know why the box is necessary?
> 
> Since “TeX builds up a page as a nest of boxes within boxes within
> boxes” (“TeX for the Impatient”, p. 17), I guess this is required for
> ConTeXt to know how to snap the actual content to the grid.
> 
> But I discovered the existence of `\snaptogrid` yesterday, so Hans,
> Mikael or Wolfgang (among other wizards) can give a more accurate answer
> to this.

You have to measure the depth of your character and move the graphic 
with outline down with the measured (and scaled) value.

\startuseMPgraphic{letter_w}
   picture q;
   q := outlinetext(\MPstring{hebrew_letter}) scaled 3 ;
   for i within q:
       j := j + 1;
       draw pathpart i withpen pencircle scaled 2;
   endfor;
\stopuseMPgraphic

\starttexdefinition hangingCharacter #1

   \setMPtext{hebrew_letter}{#1}

   \dowithnextbox
     {\verticalbox
        [height=2lh-1sd,
         yoffset=-3\nextboxdp,
         top=\vss]
        {\hbox{\useMPgraphic{letter_w}}}}
     \hbox{#1}

\stoptexdefinition

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________