ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Rik Kabel <ConTeXt@rik.users.panix.com>
To: ntg-context@ntg.nl, Henning Hraban Ramm <texml@fiee.net>
Subject: Re: fancy chapter setup
Date: Sat, 11 Jan 2020 13:49:47 -0500	[thread overview]
Message-ID: <7bf16268-905a-d0ed-2953-e98c24ab02bf@rik.users.panix.com> (raw)
In-Reply-To: <B7B95747-DC0D-4559-8B31-ED0B97353340@fiee.net>


[-- Attachment #1.1: Type: text/plain, Size: 6106 bytes --]

On 1/11/2020 10:04, Henning Hraban Ramm wrote:
> Hi all,
> I’m trying to setup a book layout where each chapter begins with a quote and an image on the left page, followed by title and text start on the right page.
>
> While the quote & image thing works, I can’t get the title on the right page, ConTeXt always puts it right of the image, even if that’s as wide as the text width. \page[right] doesn’t do anything.
> Where’s my mistake?
>
> There are also chapters without that intro, therefore I use \doifnot{\structureuservariable{subtitle}}, but those should also start on a right page. I could also use a different section name. But I don’t think that’s the problem.
>
> (The page number should appear on the right page; it wouldn’t hurt on the left page, but the chapter title should only appear on following pages.)
>
> Best, Hraban
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \define[2]\FancyChapter{%
> \doifnot{\structureuservariable{subtitle}}{}{%
> \startstandardmakeup
>    \framed[
>      width=\textwidth,height=fit,
>      offset=overlay,
>      align=flushleft,
>    ]{%
>      \definedfont[SerifItalic at 16pt]
>      \structureuservariable{subtitle}%
>    }
>    \framed[width=\textwidth]{%
>      \externalfigure[dummy][width=\textwidth]%
>    }
>    %\hfill\vfill\strut % doesn’t help
> \stopstandardmakeup
> }
> \page[right]
> %
> \framed[
>    width=\textwidth,
>    offset=overlay,
>    align=flushleft,
> ]{%
>    \definedfont[Sans at 32pt]%#2
>    \structurevariable{title}%
> }%
> }
>
> \setupheadertexts[][pagenumber][pagenumber][chapter]
> \setuphead[chapter][
>    page=left,
>    number=no,
>    header=high,
>    command=\FancyChapter,
> ]
>
> \starttext
>
> \startchapter[title={My Normal Text}]
>
> \input knuth
>
> \stopchapter
>
> \startchapter[title={My Fancy Story}]
> [subtitle={\quotation{I thought that was real.}}]
>
> \input tufte
>
> \stopchapter
>
> \stoptext
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

For what it is worth, here is how I address this. This lets me place 
epigraphs on the facing verso of a chapter, or under the section title, 
and set lettrines and first line treatment for chapters. I set page 
numbers in a separate overlay to better control the positioning. Perhaps 
a bit overthought, but it works for me ...

    \setupheadertexts [][{\it\getmarking[section]}]
                       [{\it\getmarking[chapter]}][]

    \startsetups section:epigraph
       \doifelsebuffer{SectionEpigraph}
         {\getbuffer  [SectionEpigraph]
          \resetbuffer[SectionEpigraph]}
         {\donothing}
    \stopsetups

    \startsetups chapter:epigraph
       \setupheadertexts [][][][]
       \doifelsebuffer{ChapterEpigraph}
         {\doifoddpageelse
           {\page[left]}
           {\donothing}
          \centerbox{\getbuffer[ChapterEpigraph]}
          \resetbuffer[ChapterEpigraph]
         }
         {\donothing}
       \page[right]
       \setupheadertexts [][{\it\getmarking[section]}]
                         [{\it\getmarking[chapter]}][]
    \stopsetups

    \startsectionblockenvironment[bodypart]
    \setuphead  [chapter][
                           style=\tfc\HeadFont,
                           page=yes,
                           separator=,
                           numbercolor=darkgray,
                           alternative=inmargin,
    before=\directsetup{chapter:epigraph},
    after={\resetshownsynonyms[dictionary]
    \setupsynonyms[dictionary][alternative=first]
    \doifsomething{\structureuservariable{setFirst}}
    {\setfirstline[\structureuservariable{setFirst}]}
    \doif{\structureuservariable{Lettrine}}
                                  {yes}{\setinitial}},
                          ]
    \setuphead  [section][
                           style=\tfb\HeadFont,
    insidesection=\setups{section:epigraph},
                           before={\blank[big]},
                           sectionseparatorset=reddot,
                           numbercolor=darkgray,
                           alternative=inmargin,
                          ]
    \setuphead  [subsection]
                          [
                           style=\tfa\HeadFont,
                           number=no,
                           distance=0pt,
    insidesection=\setups{section:epigraph},
                           before={\blank[big]},
                           alternative=normal,
                           after={\blank[halfline]},
                           numbercolor=,
                           sectionseparatorset=,
                          ]
    \stopsectionblockenvironment

    \definefirstline [5W][alternative=word, n=5,style=smallcaps]% and so
    on as you like
    \definefirstline [1L][alternative=line,     style=smallcaps]

    ...

    \starttext

    ...

    \startbuffer[ChapterEpigraph]

    \startEpigraph% brings in its own formatting

    The stuff of the epigraph

    \stopEpigraph

    \stopbuffer

    \startchapter[reference={cha:blah},
                   list={blah},     % toc
                   marking={blah},  % page heading
                   bookmark={blah}, % pdf bookmark
                   title={blah}]    % chapter head
                  [Lettrine=yes,setFirst=5W]

    ...

    \stopchapter

    \startchapter[reference={cha:more},
                   title={more stuff}]
                   [lettrine=yes]

    ...

    \stopchapter


-- 
Rik Kabel




[-- Attachment #1.2: Type: text/html, Size: 9011 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2020-01-11 18:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-11 15:04 Henning Hraban Ramm
2020-01-11 18:49 ` Rik Kabel [this message]
2020-01-11 19:24   ` Henning Hraban Ramm
2020-01-12 13:40   ` Henning Hraban Ramm
2020-01-12 15:07     ` Henning Hraban Ramm
2020-01-13 18:21       ` Henning Hraban Ramm
2020-01-13 21:48         ` Wolfgang Schuster

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=7bf16268-905a-d0ed-2953-e98c24ab02bf@rik.users.panix.com \
    --to=context@rik.users.panix.com \
    --cc=ntg-context@ntg.nl \
    --cc=texml@fiee.net \
    /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).