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

2020-09-09 Thread jbf


After making silly mistakes, for which I apologize, I finally got the 
ToC to work for frontmatter and chapters, creating new \defineheads as 
required, and including the earlier \ChapterListCommand, with the 
results correctly showing.


To add some named sections with authors, I did the following, using an 
idea Hraban had floated:


 \setupsectionblock
 [bodypart]
 [number=no]

\define[1]\SectionTocEntry{%
  #1\crlf% title
  \structurelistuservariable{author}%
}

\setuplist[section][
  textcommand=\SectionTocEntry,
]

I need to adjust the \setuplist[section] so these section entries move 
across under the Chapter titles (not be left-aligned as they are now 
under Chapter number. The earlier \ChapterListCommand has titles and 
authors moved across 3cm.


I have tried:

\setuplist[section][width=3cm,
  textcommand=\SectionTocEntry,
  ]

The width=3cm is not doing anything, so I've got that wrong. How do I 
move sections across by a specific amount in the TOC?


Julian





On 9/9/20 5:10 pm, Wolfgang Schuster wrote:

jbf schrieb am 09.09.2020 um 08:04:
Have to confess I am still not getting far with the final problem in 
a book that is now fully laid out: frontmatter through to appendices 
is all correct and working, but the Table of Contents not the way I 
need it (as explained earlier and listed in a previous email).


My latest effort focuses on just one item, the Foreword, since if I 
get that right, I can apply the same logic to sections. Chapters are 
already working correctly, thanks to Wolfgang's ChapterListCommand 
and I am assuming I need that for the several frontmatter 'chapters'.


I was earlier using \title for foreword, preface and notes to 
contributors, but have abandoned that as complicating things, and am 
now using \chapter, since it does not produce a numbered item - 
however, it is producing the label 'Chapter' which I don't want for 
these item. You can see below how I tried to avoid that, but it 
failed. My MWE addition to what Wolfgang provided is:


\definehead [foreword] [chapter]

\setuphead [foreword]

\setuplist [foreword]
  [label=foreword,
  alternative=command,
  command=\ChapterListCommand]% definition not included here. It was 
given in an earlier response from Wolfgang.


 And in the frontmatter itself:

\startchapter[foreword][title={\ss Foreword}][author={A. Uthor}]

..


You can set the forword string as labeltext and ignore the title (but 
use a empty argument when set userdata like the author).


\definehead
  [forword] [chapter]

\setuplabeltext
  [en]
  [forword=Forword,
   chapter=Chapter ]

\setuphead
  [forword]
  [frontpartlabel=forword,
   conversion=empty]

\setupsectionblock
  [frontpart]
  [number=yes]

\setuplist
  [forword]
  [label=forword,
   width=2cm]

\setuplist
  [chapter]
  [label=chapter,
   width=2cm]

\starttext

\startfrontmatter

\placelist [chapter,forword]

\startforword [] [author={A. u. thor}] \stopforword

\stopfrontmatter

\startbodymatter

\startchapter [title=Chapter 1] [author={A. u. thor}] \stopchapter

\stopbodymatter

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


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

2020-09-07 Thread jbf




 Forwarded Message 
Subject:Re: [NTG-context] styling individual parts of ToC entry
Date:   Tue, 8 Sep 2020 12:39:05 +1000
From:   jbf 
To: Wolfgang Schuster 



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