[NTG-context] Let chapter start on odd page and make the even page before show an image

Aditya Mahajan adityam at umich.edu
Fri May 29 18:03:43 CEST 2020

On Fri, 29 May 2020, Jan U. Hasecke wrote:

> One and a half question.
> Why did you set \ChapterCounter explizitly and why is \ChapterCounter
> part of the datasetvariable?

\dataset... is a high level interface for collecting two-pass data in ConTeXt. Here is a simple example:



The values of the three dataset variables are:


Now we set the values.



Note that we are using the values stored in different hash-ids before they are defined. ConTeXt stores the values in the `.tuc` file and uses them. This is what is stored in the `.tuc` file:


The magic of loading and reusing them happens behind the scenes, so the user doesn't have to worry about it. See https://wiki.contextgarden.net/System_Macros/Key_Value_Assignments#Multi-pass_data for more details.

Now, suppose you wanted to use the image defined as part of `\startchapter` as the background image of the _current_ page, then you could access the value of the \structureuservariable. For example,




But you want to use the value of the image _before_ the start of the chapter. So, Wolfgang is using the two-pass mechanism to store the value of the image in the database named 'chapter` in the hash-location `\ChapterCounter` and then retrieving it before it is defined!


More information about the ntg-context mailing list