Using \doifelse to change the itemization symbol in specific cases
I’m trying to create a conditional that changes the symbol used for certain item numbers. Here’s my code that doesn’t work. \define[1]\StepsCommand{\doifelse{#1}{2}{k}{#1}\ignorespaces} \defineitemgroup[Steps] \setupitemgroup[Steps][each][n,packed] \setupitemgroup[Steps][each][left=\StepsCommand] \starttext \startSteps \item A \item B % the item number should be replaced with 'k' \item C \stopSteps \stoptext The second item “B” should have the letter ‘k’ instead of the number “2.” Is this possible? Thanks, -kk
Kevin Kenan schrieb am 25.04.2020 um 21:24:
I’m trying to create a conditional that changes the symbol used for certain item numbers. Here’s my code that doesn’t work.
\define[1]\StepsCommand{\doifelse{#1}{2}{k}{#1}\ignorespaces} \defineitemgroup[Steps] \setupitemgroup[Steps][each][n,packed] \setupitemgroup[Steps][each][left=\StepsCommand]
\starttext \startSteps \item A \item B % the item number should be replaced with 'k' \item C \stopSteps \stoptext
The second item “B” should have the letter ‘k’ instead of the number “2.” Is this possible?
You can set custom symbols for individual items with \txt but this won't increment the item counter. To continue the counter and replace some symbol you have to create your own number conversion. \defineconversion [kevin] [1,k,3,4,5,6,7,8,9] \starttext \startitemize[n] \item A \txt{k} B \item C \stopitemize \blank[2*line] \startitemize[kevin] \item A \item B \item C \stopitemize \stoptext Wolfgang
Ah…thanks for the pointer to \definecoversion. Looks promising. I had also tried: \defineitemgroup[Steps] \setupitemgroup[Steps][each][n,packed] \starttext \startSteps \item A \sym{k} B\incrementnumber[itemgroup:Steps] \item C \stopSteps \stoptext Which is similar to your \txt solution and increments the counter. Thanks again for the help. -kk
On Apr 25, 2020, at 2:11 PM, Wolfgang Schuster
wrote: Kevin Kenan schrieb am 25.04.2020 um 21:24:
I’m trying to create a conditional that changes the symbol used for certain item numbers. Here’s my code that doesn’t work. \define[1]\StepsCommand{\doifelse{#1}{2}{k}{#1}\ignorespaces} \defineitemgroup[Steps] \setupitemgroup[Steps][each][n,packed] \setupitemgroup[Steps][each][left=\StepsCommand] \starttext \startSteps \item A \item B % the item number should be replaced with 'k' \item C \stopSteps \stoptext The second item “B” should have the letter ‘k’ instead of the number “2.” Is this possible?
You can set custom symbols for individual items with \txt but this won't increment the item counter. To continue the counter and replace some symbol you have to create your own number conversion.
\defineconversion [kevin] [1,k,3,4,5,6,7,8,9]
\starttext
\startitemize[n] \item A \txt{k} B \item C \stopitemize
\blank[2*line]
\startitemize[kevin] \item A \item B \item C \stopitemize
\stoptext
Wolfgang
Kevin Kenan schrieb am 25.04.2020 um 23:30:
Ah…thanks for the pointer to \definecoversion. Looks promising.
I had also tried:
\defineitemgroup[Steps] \setupitemgroup[Steps][each][n,packed]
\starttext \startSteps \item A \sym{k} B\incrementnumber[itemgroup:Steps] \item C \stopSteps \stoptext
Which is similar to your \txt solution and increments the counter.
\starttext \startitemize[n] \item A \txt{k} B \noitem \item C \stopitemize \stoptext Wolfgang
participants (2)
-
Kevin Kenan
-
Wolfgang Schuster