[NTG-context] fancy chapter setup

Henning Hraban Ramm texml at fiee.net
Sun Jan 12 16:07:48 CET 2020


Since the structureuservariables of a section aren’t defined in that section’s "before", I would need a macro or buffer to define the contents of that epigraph page, like this:


\def\PreImg{Dummy}

\startsetups FancyChapter
  \setupheadertexts[][][][]
  \doifelsebuffer{Quote}{
    \doifoddpageelse
      {\page[left]}
      {\donothing}
    {\definedfont[SerifItalic at 16pt]\quotation{\getbuffer[Quote]}\par}
    \externalfigure[\PreImg][width=\textwidth]
    \resetbuffer[Quote]
  }{}
  \page[right]
\stopsetups

\setupheadertexts[][pagenumber][pagenumber][chapter]
\setuphead[chapter][
  page=yes,
  before={\directsetup{FancyChapter}},
]

\setuppagenumbering[alternative=doublesided]

\starttext

\completecontent

\startchapter[title={My Normal Text}]
\input knuth
\stopchapter

\def\PreImg{Real}
\startbuffer[Quote]
I thought that was real.
\stopbuffer

\startchapter[title={My Fancy Story}]
\input tufte
\stopchapter

\def\PreImg{Love}
\startbuffer[Quote]
All you need is love.
\stopbuffer

\startchapter[title={Another Fancy Story}]
\input zapf
\stopchapter

\startchapter[title={Another Normal Text}]
\input knuth
\stopchapter

\stoptext


That’s possible, but ugly. I would really like to set those quotes and image names in the chapter command.

Best, Hraban




More information about the ntg-context mailing list