ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Grid typesetting: aligning section to top of textarea
@ 2013-05-14  0:51 Sietse Brouwer
  2013-05-14 11:06 ` Wolfgang Schuster
  0 siblings, 1 reply; 2+ messages in thread
From: Sietse Brouwer @ 2013-05-14  0:51 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: text/plain, Size: 2575 bytes --]

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

[-- Attachment #2: mwe-placesubject.pdf --]
[-- Type: application/pdf, Size: 18145 bytes --]

[-- Attachment #3: Type: text/plain, Size: 485 bytes --]

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Grid typesetting: aligning section to top of textarea
  2013-05-14  0:51 Grid typesetting: aligning section to top of textarea Sietse Brouwer
@ 2013-05-14 11:06 ` Wolfgang Schuster
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster @ 2013-05-14 11:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 14.05.2013 um 02:51 schrieb Sietse Brouwer <sbbrouwer@gmail.com>:

> 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.


1. Use the command key to apply the frame to the heading and not textcommand.

2. Apply the style for the title with \setuphead.

3. The location key for \framed doesn’t accept lists (e.g. location={top,hanging}),
   only single arguments are possible.

\define[2]\SubjectCommand
  {\startframed[align=flushleft,location=top]%
   #2
   \stopframed}

\setuphead[subject]
  [header=high,
   page=yes,
   style=AntykwaChapter,
   grid=low,
   alternative=command,
   command=\SubjectCommand]

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-14 11:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-14  0:51 Grid typesetting: aligning section to top of textarea Sietse Brouwer
2013-05-14 11:06 ` Wolfgang Schuster

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).