author in ToC and other design complications
Very much at the conclusion of a complicated book where most if not all issues in the body of the text are resolved, but now comes the really difficult part: the Table of Contents. Here is what I am currently using (but it does not produce what I have been asked for, which is explained below this MWE): %------------------------------ \setuphead [subject] [incrementnumber=list] \setuphead [title] [incrementnumber=list] \setupcombinedlist [content] [list={chapter,title,section,subsection}]\switchtobodyfont[10.5pt] \setuplist[chapter][style=normal,alternative=b, before=] And then I place the ToC using: \definehead [tochead] [title] \starttochead[title={Contents}] \placecombinedlist[content] \stoptochead %----------------------------- The last bit ensures that I get the word 'Contents' as the toc title, and avoid then getting 'contents' listed as an item with its page number. And if I want a relatively straightforward Table of Contents, then this mostly works, giving me (e.g.): Foreword iii One Chapter title 1 Two Chapter title 10 etc. Of course, I would prefer it to say 'Chapter One' not just 'One', so that is a minor problem I still have to resolve. But in fact, the publisher wants something quite different and I really do not know how to go about it. I did look at 'Author in ToC' in the wiki, but that referred me to a somewhat complicated Proceedings style, and given that my Chapters are all set up anyway, I just couldn't follow that. Am hoping there is some other way I can achieve the design that follows: Foreword Author's name iii Chapter One Chapter title Author's name 1 Chapter Two 1820-1880 Chapter title Author's name 10 I need to add that the current setup to obtain Chapter Two is with \setuplabeltext[chapter={{Chapter },{:1820-1880}}] which gives me Chapter Two:1820-1880 I had thought that maybe I could get the author with something like \starttitle[title={\ss Foreword}][author={Author Name}] Foreword content.... \stoptitle But that does not produce any author name in the ToC, and in fact the Author's name in the Chapter opening page is simply placed manually as a right-aligned item in the position where I want it, nothing to do with the setup for \chapter (or \title in this case). Given the above complicated design (or so it seems to me) will I have to just set the ToC up manually with a table, or can it be achieved otherwise? Julian
Am 04.09.2020 um 06:44 schrieb jbf
: Of course, I would prefer it to say 'Chapter One' not just 'One', so that is a minor problem I still have to resolve. But in fact, the publisher wants something quite different and I really do not know how to go about it. I did look at 'Author in ToC' in the wiki, but that referred me to a somewhat complicated Proceedings style, and given that my Chapters are all set up anyway, I just couldn't follow that. Am hoping there is some other way I can achieve the design that follows:
Foreword Author's name iii
Chapter One Chapter title
Author's name 1
Chapter Two 1820-1880
Chapter title
Author's name 10
I just replaced the according section https://wiki.contextgarden.net/Table_of_Contents#Author_in_ToC for you. Hraban
Thanks, and I am sure that this entry into the wiki will be also helpful for others. For me it will be step by step, and using your information I can now at least get an author's name into the toc! But that's about all. Just know that when you say (in the new wiki addition) 'check on \rawstructurelistuservariable' that link simply tells me 'There is currently no text in this page'. That leaves someone like me without a lot of the long-gained knowledge that others have, quite lost :-) But I took your example and adjusted it for, say, a chapter which has just a title (no subtitle) and an author, and added, below what I already have in the preamble: \define[1]\ChapterTocEntry{% \structurelistuservariable{author}\crlf% #1\crlf% title %\structurelistuservariable{subtitle}}% } \setuplist[chapter][ textcommand=\ChapterTocEntry, ] So, in other words I swapped the word 'section' in your example with 'chapter'. That now gives me in the ToC, something like the following: One Author name Title pg no. Which is pretty much what I am after. Hooray! But how do I get that in reverse? And how do I get the word 'chapter' to also appear in front of 'One'? You see what I mean by needing step-by-step. Maybe there are not too many nearly 75+-year-olds still surviving Covid and working with ConTeXt! But I don't give up too easily, so let me just get this next step right with a bit of help. Julian n 4/9/20 5:38 pm, Henning Hraban Ramm wrote:
Am 04.09.2020 um 06:44 schrieb jbf
: Of course, I would prefer it to say 'Chapter One' not just 'One', so that is a minor problem I still have to resolve. But in fact, the publisher wants something quite different and I really do not know how to go about it. I did look at 'Author in ToC' in the wiki, but that referred me to a somewhat complicated Proceedings style, and given that my Chapters are all set up anyway, I just couldn't follow that. Am hoping there is some other way I can achieve the design that follows:
Foreword Author's name iii
Chapter One Chapter title
Author's name 1
Chapter Two 1820-1880
Chapter title
Author's name 10 I just replaced the according section https://wiki.contextgarden.net/Table_of_Contents#Author_in_ToC for you.
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 ___________________________________________________________________________________
Am 04.09.2020 um 12:08 schrieb jbf
: Thanks, and I am sure that this entry into the wiki will be also helpful for others. For me it will be step by step, and using your information I can now at least get an author's name into the toc! But that's about all.
And that’s what the wiki entry is about and what I can tell.
Just know that when you say (in the new wiki addition) 'check on \rawstructurelistuservariable' that link simply tells me 'There is currently no text in this page'. That leaves someone like me without a lot of the long-gained knowledge that others have, quite lost :-)
Sorry that the command is still undocumented but I thought the example would be clear enough: You can’t check (i.e. use \doifnot) on \structurelistuservariable because that always contains at least some invisible tokens, you must use \rawstructurelistuservariable instead. But if all of your chapters have the author set, you don’t need that check.
But I took your example and adjusted it for, say, a chapter which has just a title (no subtitle) and an author, and added, below what I already have in the preamble:
\define[1]\ChapterTocEntry{% \structurelistuservariable{author}\crlf% #1\crlf% title %\structurelistuservariable{subtitle}}% }
\setuplist[chapter][ textcommand=\ChapterTocEntry, ]
So, in other words I swapped the word 'section' in your example with 'chapter'. That now gives me in the ToC, something like the following:
One Author name
Title pg no.
Which is pretty much what I am after. Hooray! But how do I get that in reverse?
Have another look at your \ChapterTocEntry: you call the author by \structurelistuservariable{author} and set the title as #1 in the next line. Just adapt this to your needs.
And how do I get the word 'chapter' to also appear in front of 'One'?
Try \labeltext{chapter} in the right place. Good luck & have fun! Hraban
participants (2)
-
Henning Hraban Ramm
-
jbf