* ToC as itemize
@ 2018-05-03 14:13 Henning Hraban Ramm
2018-06-10 9:55 ` Henning Hraban Ramm
0 siblings, 1 reply; 4+ messages in thread
From: Henning Hraban Ramm @ 2018-05-03 14:13 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1: Type: text/plain, Size: 1325 bytes --]
Hi again,
Alan Bowen invented this interesting setup where the table of contents is to be included in an itemize.
E.g.
Foreword ........ I
1. Smth unrelated .. II
2. Author: Title ... 1
3. Author: Title ... 5
etc.
Only 2. and 3. come from a "list" of chapters, other entries are added manually.
The attached not-really-minimal working example also handles the author setup – IRL we use a lot of user variables for metadata that needs different representation in ToC and titling.
This is the core code:
\define[1]\ChapterTocEntry{%
\startitem
\structurelistuservariable{author}:
#1\leaderfill\currentlistentrypagenumber
\stopitem
}
\definelist[chapter][%
alternative=b,
interaction=all,
criterium=all,
textcommand=\ChapterTocEntry,
pagecommand=\gobbleoneargument,
]
\startContentsList
%\sym{}Preface\leaderfill\at{Preface} % Preface unnumbered
\startitem Test entry\leaderfill 123 \stopitem
\placelist[chapter][criterium=all]
\stopContentsList
The actual problem:
The chapter list entries don’t adhere to the formatting of the itemize.
I guess there’s some expansion problem, due to the \startitem inside if the textcommand?
Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD
[-- Attachment #2: toctest.tex --]
[-- Type: application/octet-stream, Size: 1484 bytes --]
%
\def\leaderfill{\leaders\hbox to 1em{\hss. \hss}\hfill}
\defineitemgroup[ContentsList]
\setupitemgroup[ContentsList][each]
[broad,packed,autointro,repeat][]
\setupitemgroup[ContentsList][1][n][margin=1pc]
\define[2]\ChapterTitle{%
% simplified
\reference[\namedstructurevariable{chapter}{reference}]{\strut}%
\structurevariable{title} {\tfx by \structureuservariable{author}}
}
\define[1]\ChapterTocEntry{% #1 is not used
\startitem[continue,packed,joinedup]%
% simplified, IRL we use several user variables
\structurelistuservariable{author}:
#1%\namedstructurelistvariable{chapter}{title}??
\leaderfill\color[blue]{\currentlistentrypagenumber}
\stopitem%
}
\setuphead[chapter][
style=\rm,
command=\ChapterTitle,
]
\definelist[chapter][%
alternative=b,
interaction=all,
criterium=all,
textcommand=\ChapterTocEntry,
numbercommand=\gobbleoneargument,
pagecommand=\gobbleoneargument,
]
\starttext
\startContentsList
%\sym{}Preface\leaderfill\at{Preface} % Preface unnumbered
\startitem
Test entry\leaderfill 123
\stopitem
\startitem
Test entry\leaderfill 124
\stopitem
\placelist[chapter][criterium=all]
\stopContentsList
\startchapter[title=First,reference=tufte1][author=Edward Tufte]
\input tufte
\stopchapter
\startchapter[title=Second,reference=knuth][author=Donald Knuth]
\input knuth
\stopchapter
\startchapter[title=Third,reference=tufte2][author=Edward Tufte]
\input tufte
\stopchapter
\stoptext
[-- Attachment #3: Type: text/plain, Size: 492 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] 4+ messages in thread
* Re: ToC as itemize
2018-05-03 14:13 ToC as itemize Henning Hraban Ramm
@ 2018-06-10 9:55 ` Henning Hraban Ramm
2018-06-10 11:35 ` Hans Hagen
0 siblings, 1 reply; 4+ messages in thread
From: Henning Hraban Ramm @ 2018-06-10 9:55 UTC (permalink / raw)
To: mailing list for ConTeXt users
Might there be a solution to this problem?
I.e. how to insert ToC entries in an itemize?
Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD
Am 2018-05-03 um 16:13 schrieb Henning Hraban Ramm <texml@fiee.net>:
> Hi again,
> Alan Bowen invented this interesting setup where the table of contents is to be included in an itemize.
> E.g.
>
> Foreword ........ I
> 1. Smth unrelated .. II
> 2. Author: Title ... 1
> 3. Author: Title ... 5
>
> etc.
> Only 2. and 3. come from a "list" of chapters, other entries are added manually.
>
>
> The attached not-really-minimal working example also handles the author setup – IRL we use a lot of user variables for metadata that needs different representation in ToC and titling.
>
> This is the core code:
>
> \define[1]\ChapterTocEntry{%
> \startitem
> \structurelistuservariable{author}:
> #1\leaderfill\currentlistentrypagenumber
> \stopitem
> }
>
> \definelist[chapter][%
> alternative=b,
> interaction=all,
> criterium=all,
> textcommand=\ChapterTocEntry,
> pagecommand=\gobbleoneargument,
> ]
>
> \startContentsList
> %\sym{}Preface\leaderfill\at{Preface} % Preface unnumbered
>
> \startitem Test entry\leaderfill 123 \stopitem
>
> \placelist[chapter][criterium=all]
>
> \stopContentsList
>
>
> The actual problem:
> The chapter list entries don’t adhere to the formatting of the itemize.
> I guess there’s some expansion problem, due to the \startitem inside if the textcommand?
>
>
> Greetlings, Hraban
> ---
> https://www.fiee.net
> http://wiki.contextgarden.net
> GPG Key ID 1C9B22FD
>
> <toctest.tex>___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
___________________________________________________________________________________
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] 4+ messages in thread
* Re: ToC as itemize
2018-06-10 9:55 ` Henning Hraban Ramm
@ 2018-06-10 11:35 ` Hans Hagen
2018-06-10 12:03 ` Henning Hraban Ramm
0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2018-06-10 11:35 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 6/10/2018 11:55 AM, Henning Hraban Ramm wrote:
> Might there be a solution to this problem?
>
> I.e. how to insert ToC entries in an itemize?
Well, don't expect a solution without a MWE ... anyway
\starttext
\define[3]\ChapterTocEntry{%
\startitem
\structurelistuservariable{author}: #1/#2/#3
\stopitem
}
\definelist[chapter][%
alternative=command,
interaction=all,
criterium=all,
before=,
after=,
command=\ChapterTocEntry]
\startitemize
\placelist[chapter]
\stopitemize
\chapter{one}
\chapter{two}
\chapter{three}
\stoptext
> Greetlings, Hraban
> ---
> https://www.fiee.net
> http://wiki.contextgarden.net
> https://www.dreiviertelhaus.de
> GPG Key ID 1C9B22FD
>
> Am 2018-05-03 um 16:13 schrieb Henning Hraban Ramm <texml@fiee.net>:
>
>> Hi again,
>> Alan Bowen invented this interesting setup where the table of contents is to be included in an itemize.
>> E.g.
>>
>> Foreword ........ I
>> 1. Smth unrelated .. II
>> 2. Author: Title ... 1
>> 3. Author: Title ... 5
>>
>> etc.
>> Only 2. and 3. come from a "list" of chapters, other entries are added manually.
>>
>>
>> The attached not-really-minimal working example also handles the author setup – IRL we use a lot of user variables for metadata that needs different representation in ToC and titling.
>>
>> This is the core code:
>>
>> \define[1]\ChapterTocEntry{%
>> \startitem
>> \structurelistuservariable{author}:
>> #1\leaderfill\currentlistentrypagenumber
>> \stopitem
>> }
>>
>> \definelist[chapter][%
>> alternative=b,
>> interaction=all,
>> criterium=all,
>> textcommand=\ChapterTocEntry,
>> pagecommand=\gobbleoneargument,
>> ]
>>
>> \startContentsList
>> %\sym{}Preface\leaderfill\at{Preface} % Preface unnumbered
>>
>> \startitem Test entry\leaderfill 123 \stopitem
>>
>> \placelist[chapter][criterium=all]
>>
>> \stopContentsList
>>
>>
>> The actual problem:
>> The chapter list entries don’t adhere to the formatting of the itemize.
>> I guess there’s some expansion problem, due to the \startitem inside if the textcommand?
>>
>>
>> Greetlings, Hraban
>> ---
>> https://www.fiee.net
>> http://wiki.contextgarden.net
>> GPG Key ID 1C9B22FD
>>
>> <toctest.tex>___________________________________________________________________________________
>> 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
>> ___________________________________________________________________________________
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>
--
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 4+ messages in thread
* Re: ToC as itemize
2018-06-10 11:35 ` Hans Hagen
@ 2018-06-10 12:03 ` Henning Hraban Ramm
0 siblings, 0 replies; 4+ messages in thread
From: Henning Hraban Ramm @ 2018-06-10 12:03 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1: Type: text/plain, Size: 1097 bytes --]
Am 2018-06-10 um 13:35 schrieb Hans Hagen <j.hagen@xs4all.nl>:
> On 6/10/2018 11:55 AM, Henning Hraban Ramm wrote:
>> Might there be a solution to this problem?
>> I.e. how to insert ToC entries in an itemize?
>
> Well, don't expect a solution without a MWE ... anyway
The MWE was in my first mail (May 3rd).
Thank you anyway!
>
> \starttext
>
> \define[3]\ChapterTocEntry{%
> \startitem
> \structurelistuservariable{author}: #1/#2/#3
> \stopitem
> }
>
> \definelist[chapter][%
> alternative=command,
> interaction=all,
> criterium=all,
> before=,
> after=,
> command=\ChapterTocEntry]
So I was missing alternative=command.
If you consider my attached MWE one problem remains:
The usual space between items is missing between the last manual item and the ToC list:
...
\startitem Test entry \stopitem
%\blank[1em]
\placelist[chapter]
...
I can fix it with the blank, but I’d like to understand.
Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD
[-- Attachment #2: toctest.tex --]
[-- Type: application/octet-stream, Size: 1498 bytes --]
%
\def\leaderfill{\leaders\hbox to 1em{\hss. \hss}\hfill}
\defineitemgroup[ContentsList]
\setupitemgroup[ContentsList][each]
[broad,packed,autointro,repeat][]
\setupitemgroup[ContentsList][1][n][margin=1pc]
\define[2]\ChapterTitle{%
% simplified
\reference[\namedstructurevariable{chapter}{reference}]{\strut}%
\structurevariable{title} {\tfx by \structureuservariable{author}}
}
\define[3]\ChapterTocEntry{% parameters are not used
\startitem%
% simplified, IRL we use several user variables
\structurelistuservariable{author}: #2
%#1/#2/#3 = chapter no./title/pagina
%\namedstructurelistvariable{chapter}{title}??
\leaderfill\color[blue]{\currentlistentrypagenumber}
\stopitem%
}
\setuphead[chapter][
style=\rm,
command=\ChapterTitle,
]
\definelist[chapter][%
alternative=command,
interaction=all,
criterium=all,
command=\ChapterTocEntry,
before=,
after=,
]
\starttext
\startContentsList
%\sym{}Preface\leaderfill\at{Preface} % Preface unnumbered
\startitem
Test entry\leaderfill 123
\stopitem
\startitem
Test entry\leaderfill 124
\stopitem
%\blank[1em]
\placelist[chapter]
\startitem
Test entry\leaderfill 125
\stopitem
\stopContentsList
\startchapter[title=First,reference=tufte1][author=Edward Tufte]
\input tufte
\stopchapter
\startchapter[title=Second,reference=knuth][author=Donald Knuth]
\input knuth
\stopchapter
\startchapter[title=Third,reference=tufte2][author=Edward Tufte]
\input tufte
\stopchapter
\stoptext
[-- Attachment #3: Type: text/plain, Size: 492 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] 4+ messages in thread
end of thread, other threads:[~2018-06-10 12:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-03 14:13 ToC as itemize Henning Hraban Ramm
2018-06-10 9:55 ` Henning Hraban Ramm
2018-06-10 11:35 ` Hans Hagen
2018-06-10 12:03 ` Henning Hraban Ramm
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).