Re: [NTG-context] fancy chapter setup

2020-01-13 Thread Wolfgang Schuster

Henning Hraban Ramm schrieb am 13.01.2020 um 19:21:

Am 2020-01-12 um 16:07 schrieb Henning Hraban Ramm :

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:

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

Finally I used the after parameter and needed to define different section 
commands for chapters with and without epigraph (i.e. starting on a left or 
right page). When I had that distinction and the \page command in my setup, the 
header text changed too early.


\definedataset[chapter]

\startsetups[chapter:leftpage]

    \page[left]

    \doglobal\increment\ChapterData

    \doifsomething{\datasetvariable{chapter}{\ChapterData}{subtitle}}
    {
    \starttabulate
    \NC Title    \EQ 
\datasetvariable{chapter}{\ChapterData}{title} \NC\NR
    \NC Subtitle \EQ 
\datasetvariable{chapter}{\ChapterData}{subtitle} \NC\NR

    \stoptabulate
    }

    \page[right]

\stopsetups

\startsetups[chapter:savedata]

    \setdataset
    [chapter]
    [\ChapterData]
    [   title=\structurevariable{title},
 subtitle=\structureuservariable{subtitle}]

\stopsetups

\setuphead
  [chapter]
  [page=,
   beforesection=\directsetup{chapter:leftpage},
   insidesection=\directsetup{chapter:savedata}]

\setuppagenumbering[alternative=doublesided]

\starttext

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

\startchapter[title={My Fancy Story}][subtitle={I thought that was real.}]
\input tufte
\stopchapter

\startchapter[title={Another Fancy Story}][subtitle={Never mind the 
bollocks.}]

\input zapf
\stopchapter

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

\stoptext

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] fancy chapter setup

2020-01-13 Thread Henning Hraban Ramm

> Am 2020-01-12 um 16:07 schrieb Henning Hraban Ramm :
> 
> 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:
> 
> That’s possible, but ugly. I would really like to set those quotes and image 
> names in the chapter command.

Finally I used the after parameter and needed to define different section 
commands for chapters with and without epigraph (i.e. starting on a left or 
right page). When I had that distinction and the \page command in my setup, the 
header text changed too early.

Best, Hraban
___
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
___


Re: [NTG-context] fancy chapter setup

2020-01-12 Thread Henning Hraban Ramm
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


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


Re: [NTG-context] fancy chapter setup

2020-01-12 Thread Henning Hraban Ramm

> Am 2020-01-11 um 19:49 schrieb Rik Kabel :
> 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 ...

Here’s my approach. Right/left stuff and placement is good, but I get always 
the extra contents of the previous chapter, i.e. “Another Fancy Story” gets the 
subtitle/quote from “My Fancy Story”, while “My Fancy Story” doesn’t show 
anything.
Is that why you used buffers?
Since I only need two user settings (image name and quote), only one in the 
example, I’d like to avoid a buffer for every chapter.

\startsetups FancyChapter
  \setupheadertexts[][][][]
  \doifnot{\structureuservariable{subtitle}}{}{
\doifoddpageelse
  {\page[left]}
  {\donothing}
{\definedfont[SerifItalic at 16pt]\structureuservariable{subtitle}\par}
\externalfigure[dummy][width=\textwidth]
  }
  \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

\startchapter[title={My Fancy Story}]
[subtitle={\quotation{I thought that was real.}}]
\input tufte
\stopchapter

\startchapter[title={Another Fancy Story}]
[subtitle={\quotation{Never mind the bollocks.}}]
\input zapf
\stopchapter

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

\stoptext


Best, Hraban
___
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
___


Re: [NTG-context] fancy chapter setup

2020-01-11 Thread Henning Hraban Ramm

> Am 2020-01-11 um 19:49 schrieb Rik Kabel :
> 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 …

Thank you, looks interesting. I’ll try to adapt that before=\directsetup 
approach to my project.

Best, Hraban

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


Re: [NTG-context] fancy chapter setup

2020-01-11 Thread Rik Kabel

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 

[NTG-context] fancy chapter setup

2020-01-11 Thread Henning Hraban Ramm
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
%%
___
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
___