ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* styling individual parts of ToC entry
@ 2020-09-05  1:35 jbf
  2020-09-05  8:30 ` Henning Hraban Ramm
  2020-09-05  9:16 ` Wolfgang Schuster
  0 siblings, 2 replies; 10+ messages in thread
From: jbf @ 2020-09-05  1:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Now that with Hraban's invaluable assistance I am able to include title, 
subtitle, author as and when necessary in the ToC and put them on the 
same line if I need to, I have two questions that I have not found a 
satisfactory solution to after playing around with various possibilities.

I need:

(1) the author's names lined up vertically throughout the ToC, and

(2) the first part of the entry (e.g. Foreword) to be bold, but the 
author name to be regular text.

An adjusted version of Hraban's setup can show what I have tried by way 
of example:

%----------------

\define[1]\TitleTocEntry{%
   #1\hskip 1cm% title
    \structurelistuservariable{author}%
   }

\setuplist[title][textstyle=bold,
   textcommand=\TitleTocEntry,
]

%---------------

/Question 1:/ /How to get the two author names to line up vertically./ 
Given that I have both a Foreword and a Preface, I am using \title for 
these. And both have separate authors. The titles will be simply 
'Foreword' and 'Preface', obviously.

*Foreword     Author name*

*Preface    Author name*

I am using \hskip 1cm to separate the authors' names from either of 
those two words. But this does not give me the kind of exact positioning 
I need to get the two author names directly underneath each other in the 
list. I have tried various alternatives to \hskip, but none of them can 
give me the correct proportional distance. The distance is obviously 
being controlled by the fact that 'Foreword' is 8 characters and 
'Preface' is 7. Is what I want only obtainable with a table setup?

The issue might or might not be more complicated when I get to main 
chapters, where the author names need to line up with the Foreword and 
Preface author names as well. There will be, e.g.

Chapter One  Title

                        Author name
//

/Question 2:/ /How to independently get Foreword and Preface to be bold, 
but the authors' names to be regular./ \setuplist offers me options like 
textstyle, pagestyle, numberstyle, but they apply to everything (both 
Foreword/Preface and Authors' name are bold). I thought perhaps I could 
control it from within the document, e.g.

\starttitle[title={\ss\bf Foreword}][author={A. Uthor}]

But that does the same - both Foreword and A. Uthor end up bold. And 
besides, I also want to style the ToC independently of the heads if I can.

The wiki and various manuals do offer various tips on modifying the ToC, 
but I cannot find anything regarding the two questions above - not yet, 
anyway. If someone knows where, please point me to it.

Julian


[-- Attachment #1.2: Type: text/html, Size: 3238 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] 10+ messages in thread

* Re: styling individual parts of ToC entry
  2020-09-05  1:35 styling individual parts of ToC entry jbf
@ 2020-09-05  8:30 ` Henning Hraban Ramm
  2020-09-05  9:16 ` Wolfgang Schuster
  1 sibling, 0 replies; 10+ messages in thread
From: Henning Hraban Ramm @ 2020-09-05  8:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> Am 05.09.2020 um 03:35 schrieb jbf <roma83537@gmail.com>:
> 
> (1) the author's names lined up vertically throughout the ToC, and 

That would require to typeset the ToC as a table/tabulate; I remember that was hard to do, and I can’t remember in which product I used it, so I can’t look it up.

Maybe an \inframed of your desired width would be a solution?

e.g.
\inframed[width=5cm,frame=off,style=boldface,align=flushleft]{#1}%
\hskip 1cm%
\inframed[width=5cm,frame=off,align=flushleft]{\structurelistuservariable{author}}

(Untested)

> (2) the first part of the entry (e.g. Foreword) to be bold, but the author name to be regular text.

If you need different styles within your textcommand (\TitleTocEntry), just set them there, i.e. \bold{#1} or {\bf #1}. Or as options of \inframed, as above.


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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: styling individual parts of ToC entry
  2020-09-05  1:35 styling individual parts of ToC entry jbf
  2020-09-05  8:30 ` Henning Hraban Ramm
@ 2020-09-05  9:16 ` Wolfgang Schuster
  2020-09-06  0:03   ` jbf
  1 sibling, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2020-09-05  9:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users

jbf schrieb am 05.09.2020 um 03:35:
> Now that with Hraban's invaluable assistance I am able to include title, 
> subtitle, author as and when necessary in the ToC and put them on the 
> same line if I need to, I have two questions that I have not found a 
> satisfactory solution to after playing around with various possibilities.
> 
> I need:
> 
> (1) the author's names lined up vertically throughout the ToC, and
> 
> (2) the first part of the entry (e.g. Foreword) to be bold, but the 
> author name to be regular text.
> 
> An adjusted version of Hraban's setup can show what I have tried by way 
> of example:
> 
> %----------------
> 
> \define[1]\TitleTocEntry{%
>    #1\hskip 1cm% title
>     \structurelistuservariable{author}%
>    }
> 
> \setuplist[title][textstyle=bold,
>    textcommand=\TitleTocEntry,
> ]
> 
> %---------------
> 
> /Question 1:/ /How to get the two author names to line up vertically./ 
> Given that I have both a Foreword and a Preface, I am using \title for 
> these. And both have separate authors. The titles will be simply 
> 'Foreword' and 'Preface', obviously.
> 
> *Foreword     Author name*
> 
> *Preface    Author name*
> 
> I am using \hskip 1cm to separate the authors' names from either of 
> those two words. But this does not give me the kind of exact positioning 
> I need to get the two author names directly underneath each other in the 
> list. I have tried various alternatives to \hskip, but none of them can 
> give me the correct proportional distance. The distance is obviously 
> being controlled by the fact that 'Foreword' is 8 characters and 
> 'Preface' is 7. Is what I want only obtainable with a table setup?
> 
> The issue might or might not be more complicated when I get to main 
> chapters, where the author names need to line up with the Foreword and 
> Preface author names as well. There will be, e.g.
> 
> Chapter One  Title
> 
>                         Author name
> //
> 
> /Question 2:/ /How to independently get Foreword and Preface to be bold, 
> but the authors' names to be regular./ \setuplist offers me options like 
> textstyle, pagestyle, numberstyle, but they apply to everything (both 
> Foreword/Preface and Authors' name are bold). I thought perhaps I could 
> control it from within the document, e.g.
> 
> \starttitle[title={\ss\bf Foreword}][author={A. Uthor}]
> 
> But that does the same - both Foreword and A. Uthor end up bold. And 
> besides, I also want to style the ToC independently of the heads if I can.
> 
> The wiki and various manuals do offer various tips on modifying the ToC, 
> but I cannot find anything regarding the two questions above - not yet, 
> anyway. If someone knows where, please point me to it.

\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{year}}
          {\crlf{\bf\structurelistuservariable{author}}}%
        \hfill\currentlistentrypagenumber % pagenumber
      \egroup
    \egroup}

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

\setuplabeltext
   [en]
   [chapter=Chapter ]

\starttext

\completecontent

\startchapter [title={Chapter title}] [author={Author 
Name},year={1980--2000}]
\unknown
\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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: styling individual parts of ToC entry
  2020-09-05  9:16 ` Wolfgang Schuster
@ 2020-09-06  0:03   ` jbf
  2020-09-06  7:36     ` Wolfgang Schuster
  0 siblings, 1 reply; 10+ messages in thread
From: jbf @ 2020-09-06  0:03 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: ntg >> mailing list for ConTeXt users

Thanks Wolfgang, while I don't pretend to fully understand the setup you 
have provided (but am working on doing so!), of course it provides the 
correct result for a chapter that has a title, an author, and a year.

My ever-so-complicated book (and its authors!) however, throws one small 
further complication into the mix.

Where a chapter does not have a year-range, and I either omit that 
declaration, or I leave the curly brackets empty (e.g. year={}), then I 
find that the author name also does not appear in the ToC. What 
adjustment to the \ChapterListCommand do I need to make to accommodate 
the following? Possibly an \else statement, but not sure how to include 
that:

\startchapter [title={Chapter title}] [author={Author Name}]

Julian



On 5/9/20 7:16 pm, Wolfgang Schuster wrote:
> jbf schrieb am 05.09.2020 um 03:35:
>> Now that with Hraban's invaluable assistance I am able to include 
>> title, subtitle, author as and when necessary in the ToC and put them 
>> on the same line if I need to, I have two questions that I have not 
>> found a satisfactory solution to after playing around with various 
>> possibilities.
>>
>> I need:
>>
>> (1) the author's names lined up vertically throughout the ToC, and
>>
>> (2) the first part of the entry (e.g. Foreword) to be bold, but the 
>> author name to be regular text.
>>
>> An adjusted version of Hraban's setup can show what I have tried by 
>> way of example:
>>
>> %----------------
>>
>> \define[1]\TitleTocEntry{%
>>    #1\hskip 1cm% title
>>     \structurelistuservariable{author}%
>>    }
>>
>> \setuplist[title][textstyle=bold,
>>    textcommand=\TitleTocEntry,
>> ]
>>
>> %---------------
>>
>> /Question 1:/ /How to get the two author names to line up 
>> vertically./ Given that I have both a Foreword and a Preface, I am 
>> using \title for these. And both have separate authors. The titles 
>> will be simply 'Foreword' and 'Preface', obviously.
>>
>> *Foreword     Author name*
>>
>> *Preface    Author name*
>>
>> I am using \hskip 1cm to separate the authors' names from either of 
>> those two words. But this does not give me the kind of exact 
>> positioning I need to get the two author names directly underneath 
>> each other in the list. I have tried various alternatives to \hskip, 
>> but none of them can give me the correct proportional distance. The 
>> distance is obviously being controlled by the fact that 'Foreword' is 
>> 8 characters and 'Preface' is 7. Is what I want only obtainable with 
>> a table setup?
>>
>> The issue might or might not be more complicated when I get to main 
>> chapters, where the author names need to line up with the Foreword 
>> and Preface author names as well. There will be, e.g.
>>
>> Chapter One  Title
>>
>>                         Author name
>> //
>>
>> /Question 2:/ /How to independently get Foreword and Preface to be 
>> bold, but the authors' names to be regular./ \setuplist offers me 
>> options like textstyle, pagestyle, numberstyle, but they apply to 
>> everything (both Foreword/Preface and Authors' name are bold). I 
>> thought perhaps I could control it from within the document, e.g.
>>
>> \starttitle[title={\ss\bf Foreword}][author={A. Uthor}]
>>
>> But that does the same - both Foreword and A. Uthor end up bold. And 
>> besides, I also want to style the ToC independently of the heads if I 
>> can.
>>
>> The wiki and various manuals do offer various tips on modifying the 
>> ToC, but I cannot find anything regarding the two questions above - 
>> not yet, anyway. If someone knows where, please point me to it.
>
> \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{year}}
>          {\crlf{\bf\structurelistuservariable{author}}}%
>        \hfill\currentlistentrypagenumber % pagenumber
>      \egroup
>    \egroup}
>
> \setuplist
>   [chapter]
>   [label=chapter,
>    alternative=command,
>    command=\ChapterListCommand]
>
> \setuplabeltext
>   [en]
>   [chapter=Chapter ]
>
> \starttext
>
> \completecontent
>
> \startchapter [title={Chapter title}] [author={Author 
> Name},year={1980--2000}]
> \unknown
> \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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: styling individual parts of ToC entry
  2020-09-06  0:03   ` jbf
@ 2020-09-06  7:36     ` Wolfgang Schuster
  2020-09-06 23:31       ` jbf
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2020-09-06  7:36 UTC (permalink / raw)
  To: jbf; +Cc: ntg >> mailing list for ConTeXt users

jbf schrieb am 06.09.2020 um 02:03:
> Thanks Wolfgang, while I don't pretend to fully understand the setup you 
> have provided (but am working on doing so!), of course it provides the 
> correct result for a chapter that has a title, an author, and a year.
> 
> My ever-so-complicated book (and its authors!) however, throws one small 
> further complication into the mix.
> 
> Where a chapter does not have a year-range, and I either omit that 
> declaration, or I leave the curly brackets empty (e.g. year={}), then I 
> find that the author name also does not appear in the ToC. What 
> adjustment to the \ChapterListCommand do I need to make to accommodate 
> the following? Possibly an \else statement, but not sure how to include 
> that:
> 
> \startchapter [title={Chapter title}] [author={Author Name}]

I forgot to change the argument for the check off the author entry, this 
should fix it.

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

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: styling individual parts of ToC entry
  2020-09-06  7:36     ` Wolfgang Schuster
@ 2020-09-06 23:31       ` jbf
  2020-09-07  6:57         ` Wolfgang Schuster
  0 siblings, 1 reply; 10+ messages in thread
From: jbf @ 2020-09-06 23:31 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users


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

Yes, Wolfgang, that corrects the minor problem of including the author 
name correctly, even when there is no year range. Thank you.

But since I use \title, not \chapter, for the frontmatter items, ( 
Foreword, Preface, A note on Contributors), the ChapterListCommand 
clearly does not apply, so currently my ToC looks as follows (leaving 
out the pg numbers which correctly align right):


                     Foreword

                     A. Uthor

                            Preface

                     A. Uthor

                             A note on contributors

Chapter One        Year range

                    A. Uthor


What I want is for 'Foreword', 'Preface' and 'A note on Contributors' to 
align flushleft with Chapter One, but with author names still where they 
should be (Foreword and Preface have authors, 'A note...' does not have 
an author).

So I tried creating a TitleListCommand which copies the 
ChapterListCommand. But where I run into difficulties then is with a new 
lot of \setuplist to accommodate that. There are three different labels 
involved (Foreword, Preface, and A note on Contributors).

And why is it that even with the current setup, 'Foreword' has aligned 
with author name, not with 'Preface' and 'A note...'? All three are 
\title, after all.

All in all this is a most complicated ToC! What I need is for the ToC to 
look like I show it below, and you will note the additional complication 
of Chapter Two which does not have an author, but instead it is the 
SECTIONS in the Chapter that have authors!

I'm sure if I can get on top of all this somehow, no future ToC is ever 
going to cause me problems! The body of the book is all looking good, 
all 300 pages of it. It is just the automatically produced ToC that is 
causing the headaches.

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                   "


So what I have below as an MWE is fundamentally what you gave me (I have 
left out the correctly working ChapterListCommand), altered for \title, 
but I haven't got the setups below correct because I don't know how to 
do it. I have replaced unknowns with a question mark!

And at the moment I have nothing for the 'sections' with authors I need 
for Chapter Two. I assume I would set up a third definition called 
\SectionListCommand. Sections will have different labels too - one will 
be called 'Context', the other 'Reflection'.

\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{\structurelistuservariable{author}}}%
        \hfill\currentlistentrypagenumber % pagenumber
      \egroup
    \egroup}

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

\setuplist
   [title]
   [label=?,
   alternative=command,
    command=\TitleListCommand]

\setuplabeltext
   [en]
   [chapter={\bf Chapter }]

\setuplabeltext
   [en]
   [title={\bf ? }] %There needs to be three different labels

....

Julian
On 6/9/20 5:36 pm, Wolfgang Schuster wrote:
> jbf schrieb am 06.09.2020 um 02:03:
>> Thanks Wolfgang, while I don't pretend to fully understand the setup 
>> you have provided (but am working on doing so!), of course it 
>> provides the correct result for a chapter that has a title, an 
>> author, and a year.
>>
>> My ever-so-complicated book (and its authors!) however, throws one 
>> small further complication into the mix.
>>
>> Where a chapter does not have a year-range, and I either omit that 
>> declaration, or I leave the curly brackets empty (e.g. year={}), then 
>> I find that the author name also does not appear in the ToC. What 
>> adjustment to the \ChapterListCommand do I need to make to 
>> accommodate the following? Possibly an \else statement, but not sure 
>> how to include that:
>>
>> \startchapter [title={Chapter title}] [author={Author Name}]
>
> I forgot to change the argument for the check off the author entry, 
> this should fix it.
>
> \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}
>
> Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 8278 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] 10+ messages in thread

* Re: styling individual parts of ToC entry
  2020-09-06 23:31       ` jbf
@ 2020-09-07  6:57         ` Wolfgang Schuster
  2020-09-09  6:04           ` jbf
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2020-09-07  6:57 UTC (permalink / raw)
  To: jbf; +Cc: mailing list for ConTeXt users

jbf schrieb am 07.09.2020 um 01:31:
>
> Yes, Wolfgang, that corrects the minor problem of including the author 
> name correctly, even when there is no year range. Thank you.
>
> But since I use \title, not \chapter, for the frontmatter items, ( 
> Foreword, Preface, A note on Contributors), the ChapterListCommand 
> clearly does not apply, so currently my ToC looks as follows (leaving 
> out the pg numbers which correctly align right):
>
>
>                      Foreword
>                      A. Uthor
>                             Preface
>                      A. Uthor
>                              A note on contributors
> Chapter One        Year range
>                     A. Uthor
>
> What I want is for 'Foreword', 'Preface' and 'A note on Contributors' 
> to align flushleft with Chapter One, but with author names still where 
> they should be (Foreword and Preface have authors, 'A note...' does 
> not have an author).
>
> So I tried creating a TitleListCommand which copies the 
> ChapterListCommand. But where I run into difficulties then is with a 
> new lot of \setuplist to accommodate that. There are three different 
> labels involved (Foreword, Preface, and A note on Contributors).
>
> And why is it that even with the current setup, 'Foreword' has aligned 
> with author name, not with 'Preface' and 'A note...'? All three are 
> \title, after all.
>
> All in all this is a most complicated ToC! What I need is for the ToC 
> to look like I show it below, and you will note the additional 
> complication of Chapter Two which does not have an author, but instead 
> it is the SECTIONS in the Chapter that have authors!
>
> I'm sure if I can get on top of all this somehow, no future ToC is 
> ever going to cause me problems! The body of the book is all looking 
> good, all 300 pages of it. It is just the automatically produced ToC 
> that is causing the headaches.
>
> 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                   "
>
> So what I have below as an MWE is fundamentally what you gave me (I 
> have left out the correctly working ChapterListCommand), altered for 
> \title, but I haven't got the setups below correct because I don't 
> know how to do it. I have replaced unknowns with a question mark!
>
> And at the moment I have nothing for the 'sections' with authors I 
> need for Chapter Two. I assume I would set up a third definition 
> called \SectionListCommand. Sections will have different labels too - 
> one will be called 'Context', the other 'Reflection'.
>
> \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{\structurelistuservariable{author}}}%
>        \hfill\currentlistentrypagenumber % pagenumber
>      \egroup
>    \egroup}
>
> \setuplist
>   [chapter]
>   [label=chapter,
>   alternative=command,
>    command=\ChapterListCommand]
>
> \setuplist
>   [title]
>   [label=?,
>   alternative=command,
>    command=\TitleListCommand]
>
> \setuplabeltext
>   [en]
>   [chapter={\bf Chapter }]
>
> \setuplabeltext
>   [en]
>   [title={\bf ? }] %There needs to be three different labels

You need extra headings for the forward and preface

     \definehead [forward] [chapter]
     \definehead [preface] [chapter]

to have full control about their layout.

I can provide you a solution for your problems but you have to create a 
complete minimal example (including forward and preface titles) first.

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: styling individual parts of ToC entry
  2020-09-07  6:57         ` Wolfgang Schuster
@ 2020-09-09  6:04           ` jbf
  2020-09-09  7:10             ` Wolfgang Schuster
  0 siblings, 1 reply; 10+ messages in thread
From: jbf @ 2020-09-09  6:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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

..........

Of course, even if it did work, given the ChapterListCommand, it would 
probably put the author on a line below Foreword, instead of on the same 
line. There are four different components in the ToC, all needing to be 
arranged a bit differently, which is why I haven't got my head around 
what I need to do. They are:

(1) Foreword    author name

(2) Chapter no.   Title

                                   author name

(3) Chapter no.   Title 1

                             Title 2 or subtitle

                                   author name

(4) Chapter no.   Title

                            Section

                                   author name

Julian




On 7/9/20 4:57 pm, Wolfgang Schuster wrote:
> jbf schrieb am 07.09.2020 um 01:31:
>>
>> Yes, Wolfgang, that corrects the minor problem of including the 
>> author name correctly, even when there is no year range. Thank you.
>>
>> But since I use \title, not \chapter, for the frontmatter items, ( 
>> Foreword, Preface, A note on Contributors), the ChapterListCommand 
>> clearly does not apply, so currently my ToC looks as follows (leaving 
>> out the pg numbers which correctly align right):
>>
>>
>>                      Foreword
>>                      A. Uthor
>>                             Preface
>>                      A. Uthor
>>                              A note on contributors
>> Chapter One        Year range
>>                     A. Uthor
>>
>> What I want is for 'Foreword', 'Preface' and 'A note on Contributors' 
>> to align flushleft with Chapter One, but with author names still 
>> where they should be (Foreword and Preface have authors, 'A note...' 
>> does not have an author).
>>
>> So I tried creating a TitleListCommand which copies the 
>> ChapterListCommand. But where I run into difficulties then is with a 
>> new lot of \setuplist to accommodate that. There are three different 
>> labels involved (Foreword, Preface, and A note on Contributors).
>>
>> And why is it that even with the current setup, 'Foreword' has 
>> aligned with author name, not with 'Preface' and 'A note...'? All 
>> three are \title, after all.
>>
>> All in all this is a most complicated ToC! What I need is for the ToC 
>> to look like I show it below, and you will note the additional 
>> complication of Chapter Two which does not have an author, but 
>> instead it is the SECTIONS in the Chapter that have authors!
>>
>> I'm sure if I can get on top of all this somehow, no future ToC is 
>> ever going to cause me problems! The body of the book is all looking 
>> good, all 300 pages of it. It is just the automatically produced ToC 
>> that is causing the headaches.
>>
>> 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           "
>>
>> So what I have below as an MWE is fundamentally what you gave me (I 
>> have left out the correctly working ChapterListCommand), altered for 
>> \title, but I haven't got the setups below correct because I don't 
>> know how to do it. I have replaced unknowns with a question mark!
>>
>> And at the moment I have nothing for the 'sections' with authors I 
>> need for Chapter Two. I assume I would set up a third definition 
>> called \SectionListCommand. Sections will have different labels too - 
>> one will be called 'Context', the other 'Reflection'.
>>
>> \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{\structurelistuservariable{author}}}%
>>        \hfill\currentlistentrypagenumber % pagenumber
>>      \egroup
>>    \egroup}
>>
>> \setuplist
>>   [chapter]
>>   [label=chapter,
>>   alternative=command,
>>    command=\ChapterListCommand]
>>
>> \setuplist
>>   [title]
>>   [label=?,
>>   alternative=command,
>>    command=\TitleListCommand]
>>
>> \setuplabeltext
>>   [en]
>>   [chapter={\bf Chapter }]
>>
>> \setuplabeltext
>>   [en]
>>   [title={\bf ? }] %There needs to be three different labels
>
> You need extra headings for the forward and preface
>
>     \definehead [forward] [chapter]
>     \definehead [preface] [chapter]
>
> to have full control about their layout.
>
> I can provide you a solution for your problems but you have to create 
> a complete minimal example (including forward and preface titles) first.
>
> 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: styling individual parts of ToC entry
  2020-09-09  6:04           ` jbf
@ 2020-09-09  7:10             ` Wolfgang Schuster
  2020-09-09  9:39               ` jbf
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2020-09-09  7:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: styling individual parts of ToC entry
  2020-09-09  7:10             ` Wolfgang Schuster
@ 2020-09-09  9:39               ` jbf
  0 siblings, 0 replies; 10+ messages in thread
From: jbf @ 2020-09-09  9:39 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: ntg >> mailing list for ConTeXt users

Thanks. Just two clarifications (also noting that I altered 'forword' in 
yours to 'foreword' in mine in every instance, just to get the spelling 
right):

1. Compiling your example just as it is below produces a result like:

[foreword: – – 2]Chapter 1 Chapter 1
                                            A. u. thor                  3

We obviously should not be getting [foreword: --2] in our result, nor a 
doubling up of Chapter 1

2. Where do I stand now with the earlier definition  (I mean the 
\define[3]\ChapterListCommand. Is that still used? Including its 
\setuplist part? What you have just given me now makes no reference to 
\ChapterListCommand, so perhaps it is no longer relevant?

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-09-09  9:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-05  1:35 styling individual parts of ToC entry jbf
2020-09-05  8:30 ` Henning Hraban Ramm
2020-09-05  9:16 ` Wolfgang Schuster
2020-09-06  0:03   ` jbf
2020-09-06  7:36     ` Wolfgang Schuster
2020-09-06 23:31       ` jbf
2020-09-07  6:57         ` Wolfgang Schuster
2020-09-09  6:04           ` jbf
2020-09-09  7:10             ` Wolfgang Schuster
2020-09-09  9:39               ` jbf

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