Now, my second issue with user variables: """ \define[1]\ChapterTocEntry{% \doifnotempty{\structureuservariable{author}}{\structureuservariable{author}\crlf }% #1% \doifnotempty{\structureuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}} \setuplist[chapter][textcommand=\ChapterTocEntry] \starttext \completelist[chapter][criterium=all] \startchapter[ title={The Use of Typefaces}][% author={Hermann Zapf}, subtitle={Ein zapfiges Zitat}] \input zapf \stopchapter \startchapter[ title={Sheep and Goats}][% author={Siegfried Tufte}, subtitle={Tofte Tufte-Zitat}] \input tufte \stopchapter \stoptext """ I’m trying to get author and subtitle into the ToC (while in the content, subtitle goes to the margin and author to the end of the chapter). But in this example, both are empty (but not empty enough for doifnotempty), while in my actual project I always get author and subtitle from the first chapter. I guess this is an expansion problem? Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
Some hint on that would be nice.
Is it maybe related to the "Registers and getparameters" problem?
I tried a few things WRT expansion, but it seems like I didn’t find the right command in the right place.
Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD
Am 2018-01-14 um 21:44 schrieb Henning Hraban Ramm
Now, my second issue with user variables:
""" \define[1]\ChapterTocEntry{% \doifnotempty{\structureuservariable{author}}{\structureuservariable{author}\crlf }% #1% \doifnotempty{\structureuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}
\setuplist[chapter][textcommand=\ChapterTocEntry]
\starttext \completelist[chapter][criterium=all]
\startchapter[ title={The Use of Typefaces}][% author={Hermann Zapf}, subtitle={Ein zapfiges Zitat}]
\input zapf
\stopchapter
\startchapter[ title={Sheep and Goats}][% author={Siegfried Tufte}, subtitle={Tofte Tufte-Zitat}]
\input tufte
\stopchapter
\stoptext """
I’m trying to get author and subtitle into the ToC (while in the content, subtitle goes to the margin and author to the end of the chapter). But in this example, both are empty (but not empty enough for doifnotempty), while in my actual project I always get author and subtitle from the first chapter. I guess this is an expansion problem?
Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
Henning Hraban Ramm mailto:texml@fiee.net 14. Januar 2018 um 21:44 Now, my second issue with user variables:
""" \define[1]\ChapterTocEntry{% \doifnotempty{\structureuservariable{author}}{\structureuservariable{author}\crlf }% #1% \doifnotempty{\structureuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}} To access the variables in a list you have to use the \structurelistuservariable command.
Wolfgang
Am 2018-01-23 um 21:24 schrieb Wolfgang Schuster
Henning Hraban Ramm 14. Januar 2018 um 21:44 Now, my second issue with user variables:
""" \define[1]\ChapterTocEntry{% \doifnotempty{\structureuservariable{author}}{\structureuservariable{author}\crlf }% #1% \doifnotempty{\structureuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}} To access the variables in a list you have to use the \structurelistuservariable command.
Thank you, now I have: \define[1]\ChapterTocEntry{% \doifnotempty{\structurelistuservariable{author}}{\structureuservariable{author}\crlf }% #1% \doifnotempty{\structurelistuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}} But author/subtitle still don’t show up in the ToC. Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
Henning Hraban Ramm mailto:texml@fiee.net 24. Januar 2018 um 08:51
Thank you, now I have:
\define[1]\ChapterTocEntry{% \doifnotempty{\structurelistuservariable{author}}{\structureuservariable{author}\crlf }% #1% \doifnotempty{\structurelistuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}
But author/subtitle still don’t show up in the ToC.
You’re still using the wrong command to print the variables. \setuplist --> \structurelistuservariable \setuphead --> \structureuservariable Wolfgang
Am 2018-01-24 um 16:42 schrieb Wolfgang Schuster
Henning Hraban Ramm 24. Januar 2018 um 08:51
Thank you, now I have:
\define[1]\ChapterTocEntry{% \doifnotempty{\structurelistuservariable{author}}{\structureuservariable{author}\crlf }% #1% \doifnotempty{\structurelistuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}
But author/subtitle still don’t show up in the ToC.
You’re still using the wrong command to print the variables.
\setuplist --> \structurelistuservariable \setuphead --> \structureuservariable
Aaargh, I’m blind, sorry, I changed only half of the occurrencies. Everything’s ok now, _if_ author and subtitle are defined. But \structurelistuservariable{something} seems to be never empty in the sense of \ifempty - I get those \crlf also for chapters without i.e. where I didn’t define those or set them to {}. Greetlings, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
Henning Hraban Ramm mailto:texml@fiee.net 24. Januar 2018 um 08:51
Thank you, now I have:
\define[1]\ChapterTocEntry{% \doifnotempty{\structurelistuservariable{author}}{\structureuservariable{author}\crlf }% #1% \doifnotempty{\structurelistuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}
But author/subtitle still don’t show up in the ToC. Use the \doiftext check or replace \structurelistuservariable (which is never empty because it is tagged) with \rawstructurelistuservariable (which isn’t tagged and contains only the content of the variable).
\define[3]\SectionListCommand {\doiftextelse{\structurelistuservariable{test}}{YES}{NO}% \endgraf} % \define[3]\SectionListCommand % {\doifsomethingelse{\rawstructurelistuservariable{test}}{YES}{NO}% % \endgraf} \setuplist[section][alternative=command,command=\SectionListCommand] \starttext \placelist[section] \startsection[title=X][test=A] \stopsection \startsection[title=Y] \stopsection \startsection[title=Z][test=B] \stopsection \stoptext Wolfgang
Am 2018-01-24 um 19:18 schrieb Wolfgang Schuster
Henning Hraban Ramm 24. Januar 2018 um 08:51
Thank you, now I have:
\define[1]\ChapterTocEntry{% \doifnotempty{\structurelistuservariable{author}}{\structureuservariable{author}\crlf }% #1% \doifnotempty{\structurelistuservariable{subtitle}}{\crlf\structureuservariable{subtitle}}}
But author/subtitle still don’t show up in the ToC. Use the \doiftext check or replace \structurelistuservariable (which is never empty because it is tagged) with \rawstructurelistuservariable (which isn’t tagged and contains only the content of the variable).
Thank you so much! You saved my day/night/toc ;) Grüßlinge, Hraban --- http://www.fiee.net http://wiki.contextgarden.net GPG Key ID 1C9B22FD
participants (2)
-
Henning Hraban Ramm
-
Wolfgang Schuster