Assigning a variable to the list argument in \setupsection
Greetings, I would like to use a variable for the value of the list argument in, e.g., the \startsection command. If you compile my little example you will see that the first 'literal' assignment works, while the second 'variable' assignment does not. What am I missing here? Cheers, Michael \starttext \placecontent \setvariables[TOC][list=Second Section] \startsection [title={First}, list={First Section}] This is the first section. \stopsection \startsection [title={Second}, list={\getvariable{TOC}{list}}] This is the \getvariable{TOC}{list} \stopsection \stoptext
On Thu, 14 Apr 2016 09:46:34 +0200
Michael Guravage
I would like to use a variable for the value of the list argument in, e.g., the \startsection command. If you compile my little example you will see that the first 'literal' assignment works, while the second 'variable' assignment does not. What am I missing here?
Cheers,
Michael
\starttext
\placecontent
\setvariables[TOC][list=Second Section]
\startsection [title={First}, list={First Section}] This is the first section. \stopsection
\startsection [title={Second}, list={\getvariable{TOC}{list}}]
I suspect issues with the order of expansion because it works with \expanded{\startsection [title={Second}, list={\getvariable{TOC}{list}}]} Marco
Michael Guravage mailto:guravage@gmail.com 14. April 2016 um 09:46 Greetings,
I would like to use a variable for the value of the list argument in, e.g., the \startsection command. If you compile my little example you will see that the first 'literal' assignment works, while the second 'variable' assignment does not. What am I missing here?
ConTeXt saves by default the list entries without expanding them which means you get "\getvariable{TOC}{list}" as entry in the table of contents for your section section entry but at this moment you haven’t set a value for this variable. To get the content of the variable in the list entry you have to expand the argument of the list key, one way is the use of the \expanded command as shown by Marco but you also let ConTeXt do this for you (no need for \expanded{…}) when you add \setuphead[section][expansion=yes] at the begin of your document. Wolfgang
participants (3)
-
Marco Patzer
-
Michael Guravage
-
Wolfgang Schuster