[NTG-context] Grid typesetting: aligning section to top of textarea

Sietse Brouwer sbbrouwer at gmail.com
Tue May 14 02:51:52 CEST 2013


Dear list,

I am making a foray into grid typesetting, and would like to align the
top of my (possibly multi-line) section titles with the top of the
textarea. I thought I could do that with
\setuphead[subject][grid={broad,high}], but this is not working. I
have tried nearly every other combination of grid keywords, and then
tried them again with the subject wrapped in a framed.

The "It's in the details" manual didn't provide help. I found an old
e-mail by Honza, but that never got a reply.
http://www.pragma-ade.com/general/manuals/details.pdf
http://www.mail-archive.com/ntg-context@ntg.nl/msg58456.html

I put an MWE below, and I have attached its output. If anybody has any
clues for me, (or 'not currently available, you can stop trying'), I
would be most grateful.

Cheers,

Sietse

\setuppapersize[A5]

%% Activate grid
\setuplayout
   [grid=yes,
    width=middle, topspace=2\lineheight, height=31\lineheight,
    header=2\lineheight, footer=0\lineheight,]

\setupbodyfont[schola,13pt]
\definefont[AntykwaChapter][antykwatorunskaregular at 18pt]%

%% If wrapping the subject in a framed is needed, this command does it
\def\subjectcommand#1{%
    \framed[
        frame=on,
        framecolor=blue,
        width=\textwidth,
        align=flushleft,
        offset=none,
        %% strut=no does not work
        %% so cancel out lineheight-fontsize diff with -toffset
        toffset=-4.5pt,
        %% This *should* mean:
        %% * take topmost line in framed as reference line
        %% * align top of reference line with external baseline.
        %% but grid=yes may disable that.
        location={top, hanging},
    ]{\AntykwaChapter #1}}

%% The head-specific grid setup comes here
\setuphead[subject]
   [header=high,   % no header; extend textarea into header area
    page=yes,
    %% Take the box, assume it is a snug fit of its contents, and align
    %% its top with the grid line above it?
    %% Seems to do nothing
    %% A tweak like '-3pt' ditto
    grid={fit,high},
    textcommand=\subjectcommand,
    % textstyle=\AntykwaChapter,
]

\showframe
\showgrid
\showstruts

%% Example text
\starttext

\subject{The hoard of the gibbelins}

The Gibbelins eat, as is well known, nothing less good than man.

\startsubject[
        title={How Nyth would have worked his art upon the gnoles},
        marking=How Nuth would have worked his art,
    ]

Despite the advertisements of rival firms, it is probable that every
tradesman knows that nobody in business at the present time has a
position equal to that of Mr. Nuth.
\stopsubject

\stoptext
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mwe-placesubject.pdf
Type: application/pdf
Size: 18145 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20130514/d348f3ee/attachment.pdf>


More information about the ntg-context mailing list