ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Solved: Book setup with LHS-side quotes before chapters/parts, header/footer issues, TOC, etc.
@ 2021-10-26 11:14 Gerben Wierda via ntg-context
  0 siblings, 0 replies; only message in thread
From: Gerben Wierda via ntg-context @ 2021-10-26 11:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Gerben Wierda


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

Thanks to Wolfgang Schuster and Bruce Horrocks I have now a working solution. I ended up following Bruce’s suggestion of doing a left hand side (LHS) page opposite the first (RHS) chapter or part page differently than using after/before modifications of the \chapter and \part setups as I had been doing years ago (but that book did not have parts and was done in mkii)

The modification of \chapter and \part setups with before= and after= never worked in the \component setup in LMTX. Creating a separate command to run immediately before a \chapter or \part, as suggested by Bruce, was simpler and and turned out to be more robust. So, this single file example also works when \components are used.

The only issues I have now left are very minimal. In the table of contents, the abstract for a part has some extra whitespace above, which the chapter abstracts don’t have. But that is not really a problem. And getting the part title somewhere more centred on its page is also left as an issue for later.

Example file. In a project/component setup: everything before the \starttext goes into the environment file, the rest in the product file.

%%%
%%% Sections that have a LHS preface with a quote
%%%

\startsetups SectionLHSPageSetup
 \page[left]
 \setupheader[state=empty]
 \start
    \startalignment[left,nothyphenated]
    \startnarrower[4*left]
        \tf\it
\stopsetups

\definestartstop [SectionLHSPage]
 [ before={\setups{SectionLHSPageSetup}},
   after={\stopnarrower
    \stopalignment\stop}]

\define[1]\SectionPrequote{\startSectionLHSPage #1\stopSectionLHSPage}

%%%
%%% part is managed here
%%%
\defineconversionset [part] [Romannumerals] [numbers]
\setuplabeltext[en][partlabel=Part~]

\setuphead [part]
  [sectionsegments=part,
   bodypartlabel=partlabel,
   appendixlabel=,
   sectionconversionset=part,
   page=yes,
   header=empty,
   footer=empty,
   placehead=yes]

\definelist[parttext]
\setuplist[parttext][margin=1.3em,pagecommand=\gobbleoneargument]
\define[1]\PartAbstract{\writetolist[parttext]{}{\start\itx#1\stop}}

%%%
%%% chapter is managed here
%%%
\definetext
  [chapterfooter] % name
  [footer]        % vertical location
  [pagenumber]    % content

\setuplabeltext[en][appendixchapterlabel=Appendix~]
\setuphead
  [chapter]
  [page=yes,
   header=empty,
   bodypartlabel=,
   appendixlabel=appendixchapterlabel,
   footer=chapterfooter,
   sectionsegments=chapter,
   before={\blank[force,2*big]},
   after={\blank[3*big]}]

\definelist[chaptertext]
\setuplist[chaptertext][margin=1.3em,pagecommand=\gobbleoneargument]
\define[1]\ChapterAbstract{\writetolist[chaptertext]{}{\start\itx#1\stop}}

\defineresetset [default] [0,0] [1]
\setupcombinedlist [content] [list={part,parttext,chapter,chaptertext}]

\starttext

\startfrontmatter
\completecontent
\SectionPrequote{If you think good architecture is expensive, try bad architecture\crlf
{\tf Brian Foote and Joseph Yoder}}
\startchapter[title={One}]
\dorecurse{7}{\input tufte \par \input knuth}
\stopchapter
\stopfrontmatter

\startbodymatter
\dorecurse{3}{
  \SectionPrequote{The world is not \rationals, it is \reals\crlf {\tf Gerben Wierda}}
  \part{Title title title}
  \PartAbstract{This is a part abstract.}
  \dorecurse{2}{
    \SectionPrequote{If you think good architecture is expensive, try
bad architecture\crlf
{\tf Brian Foote and Joseph Yoder}}
    \startchapter[title={Two}]
    \ChapterAbstract{This is a chapter abstract.}
    \dorecurse{5}{\input tufte \par \input knuth}
    \stopchapter
  }
}
\stopbodymatter
\startappendices
  \defineresetset[default][0,1][1] %% reset , chapter, but not part
  \setuphead[part][number=no]
  \SectionPrequote{The world is not \rationals, it is \reals\crlf {\tf Gerben Wierda}}
  \part{Title title title}
  \PartAbstract{This is a part abstract.}
  \dorecurse{2}{
    \SectionPrequote{If you think good architecture is expensive, try
bad architecture\crlf
{\tf Brian Foote and Joseph Yoder}}
    \startchapter[title={Two}]
    \ChapterAbstract{This is a chapter abstract.}
    \dorecurse{5}{\input tufte \par \input knuth}
    \stopchapter
  }
\stopappendices
\stoptext

In a component setup, a part component may look like this:

\startcomponent p_partone
\product prd_book
\project project_book

\SectionPrequote{The world is not \rationals, it is \reals\crlf
{\tf Gerben Wierda}}
\part{Title title title}
\PartAbstract{This is a part abstract for a normal part.}
\component c_chapter
\component c_chapter
\stopcomponent

and a chapter component like this:

\startcomponent c_chapter
\product prd_book
\project project_book

\starttext

\SectionPrequote{If you think good architecture is expensive, try bad architecture\crlf
{\tf Brian Foote and Joseph Yoder}}
\chapter{An Inconvenient Truth}
\ChapterAbstract{This is a chapter abstract.}

\setupindenting[next]
\placeinitial I{\kap{\bf n the half}} century or so that human kind has had IT,
the IT sector has increasingly wrestled with the fact that IT projects often
fail in one way or another.

\dorecurse{7}{\input tufte \par \input knuth}
\stoptext
\stopcomponent


Gerben Wierda (LinkedIn <https://www.linkedin.com/in/gerbenwierda>)
R&A Enterprise Architecture <https://ea.rna.nl/> (main site)
Book: Chess and the Art of Enterprise Architecture <https://ea.rna.nl/the-book/>
Book: Mastering ArchiMate <https://ea.rna.nl/the-book-edition-iii/>


[-- Attachment #1.2: Type: text/html, Size: 36864 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-26 11:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 11:14 Solved: Book setup with LHS-side quotes before chapters/parts, header/footer issues, TOC, etc Gerben Wierda via ntg-context

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