[NTG-context] Fwd: Re: styling individual parts of ToC entry

jbf roma83537 at gmail.com
Tue Sep 8 04:42:38 CEST 2020




-------- Forwarded Message --------
Subject: 	Re: [NTG-context] styling individual parts of ToC entry
Date: 	Tue, 8 Sep 2020 12:39:05 +1000
From: 	jbf <roma83537 at gmail.com>
To: 	Wolfgang Schuster <wolfgang.schuster.lists at gmail.com>



Wolfgang, I have tried an MWE below but I think I am hopelessly lost at 
this point. It is not producing anything like what I want.

But at least let me indicate what I have tried:

(1) I have defined two different 'title' items (Foreword and Preface 
unnumbered) since both of these require an author name of the kind 
produced by the \ChapterListCommand. Do I also need a \TitleListCommand 
for these? The \ChapterListCommand seems to call in a chapter number, 
and I don't want one in the Frontmatter items like foreword and preface. 
I didn't know how to adjust that definition to leave out the number. I 
did try a renamed copy of it, leaving out the line: \hbox to 
3cm{\currentlistsymbol\hss}, but that made no difference.

(2) And since I also need some sections with an author (but the chapter 
they are in has no author), I defined a 'mysection', though I have only 
tried to 'call in' the Foreword so far in the text below, to see if that 
at least worked - but it doesn't.

(3) I also assumed that having defined foreword, preface and mysection, 
they would need to be in a \setupcombinedlist.

(4) And finally, I thought I would then need a \setuplist and 
\setuplabeltext for Foreword (as indeed I might for the other two as 
well, but to start with, I wanted to get one of them working at least).

MWE:

\definehead [foreword] [title]
\definehead [preface] [title]
\definehead [mysection] [section]

\setupcombinedlist[chapter,foreword,preface,mysection,section, subsection]

\define[3]\ChapterListCommand
   {\hbox\bgroup
      \hbox to 3cm{\currentlistsymbol\hss}% number + labeltext
      \vtop\bgroup
        \hsize\dimexpr\makeupwidth-3cm\relax
        \doifsomething{\rawstructurelistuservariable{year}}
          {{\it\structurelistuservariable{year}}\crlf}%
        \currentlistentrytitle % title
        \doifsomething{\rawstructurelistuservariable{author}}
          {\crlf{\bf\structurelistuservariable{author}}}%
        \hfill\currentlistentrypagenumber % pagenumber
      \egroup
    \egroup}

    \define[3]\TitleListCommand
   {\hbox\bgroup
      \hbox to 3cm{\currentlistsymbol\hss}% number + labeltext
      \vtop\bgroup
        \hsize\dimexpr\makeupwidth-3cm\relax
        \doifsomething{\rawstructurelistuservariable{year}}
          {{\it\structurelistuservariable{year}}\crlf}%
        \currentlistentrytitle % title
        \doifsomething{\rawstructurelistuservariable{author}}
          {\crlf{\bf\structurelistuservariable{author}}}%
        \hfill\currentlistentrypagenumber % pagenumber
      \egroup
    \egroup}

\definehead [foreword] [title]
\definehead [preface] [title]
\definehead [mysection] [section]

\setupcombinedlist[chapter,foreword,preface,mysection,section, subsection]

\setuplist
   [chapter]
   [label=chapter,
    alternative=command,
    command=\ChapterListCommand]

\setuplabeltext
   [en]
   [chapter=Chapter ]

\setuplist
   [foreword]
   [label=foreword,
   alternative=command,
    command=\TitleListCommand]

\setuplabeltext
   [en]
   [title=Foreword ]

\starttext

\completecontent
\starttitle [title={Foreword}] [author={Author Name}]
\unknown
\stoptitle
\startchapter
\startchapter [title={Chapter title}] [author={Author 
Name},year={1980--2000}]
\unknown
\stopchapter

\stoptext

%%%

Let me remind you of what I am trying to achieve. If I can grasp some 
basic principles about this layout, I can experiment further.

Foreword                    A. Uthor                     pg no.
   
Preface                     A. Uthor                     "

A note on Contributors                                   "

Chapter One                 Chapter Title

                             A. Uthor                     "

Chapter Two                 Chapter title

A section                   Context

                             A. Uthor                     "

  
Another section             Reflection

                             A. Author                    "


Julian

On 7/9/20 4:57 pm, Wolfgang Schuster wrote:
> \definehead [forward] [chapter]
>     \definehead [preface] [chapter] 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20200908/ab30be51/attachment.htm>


More information about the ntg-context mailing list