ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Using \doifelse to change the itemization symbol in specific cases
@ 2020-04-25 19:24 Kevin Kenan
  2020-04-25 21:11 ` Wolfgang Schuster
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Kenan @ 2020-04-25 19:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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
___________________________________________________________________________________
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] 5+ messages in thread

* Re: Using \doifelse to change the itemization symbol in specific cases
  2020-04-25 19:24 Using \doifelse to change the itemization symbol in specific cases Kevin Kenan
@ 2020-04-25 21:11 ` Wolfgang Schuster
  2020-04-25 21:30   ` Kevin Kenan
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Schuster @ 2020-04-25 21:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Kevin Kenan

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

___________________________________________________________________________________
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] 5+ messages in thread

* Re: Using \doifelse to change the itemization symbol in specific cases
  2020-04-25 21:11 ` Wolfgang Schuster
@ 2020-04-25 21:30   ` Kevin Kenan
  2020-04-25 21:34     ` Wolfgang Schuster
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Kenan @ 2020-04-25 21:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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 <wolfgang.schuster.lists@gmail.com> 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
> 

___________________________________________________________________________________
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] 5+ messages in thread

* Re: Using \doifelse to change the itemization symbol in specific cases
  2020-04-25 21:30   ` Kevin Kenan
@ 2020-04-25 21:34     ` Wolfgang Schuster
  2020-04-25 21:36       ` Kevin Kenan
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Schuster @ 2020-04-25 21:34 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Kevin Kenan

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

___________________________________________________________________________________
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] 5+ messages in thread

* Re: Using \doifelse to change the itemization symbol in specific cases
  2020-04-25 21:34     ` Wolfgang Schuster
@ 2020-04-25 21:36       ` Kevin Kenan
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin Kenan @ 2020-04-25 21:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 266 bytes --]

On Apr 25, 2020, at 2:34 PM, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:
> 
> \starttext
> 
> \startitemize[n]
> \item A
> \txt{k} B
> \noitem
> \item C
> \stopitemize
> 
> \stoptext
> 
> Wolfgang


Nice…so many options. :) 

-kk

[-- Attachment #1.2: Type: text/html, Size: 8247 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 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] 5+ messages in thread

end of thread, other threads:[~2020-04-25 21:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-25 19:24 Using \doifelse to change the itemization symbol in specific cases Kevin Kenan
2020-04-25 21:11 ` Wolfgang Schuster
2020-04-25 21:30   ` Kevin Kenan
2020-04-25 21:34     ` Wolfgang Schuster
2020-04-25 21:36       ` Kevin Kenan

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).