ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Re: Modes & enumerations
       [not found] <56A6293A-C139-4A26-849A-EE5EC55F82D7@gmail.com>
@ 2025-06-05 18:03 ` Aditya Mahajan
  0 siblings, 0 replies; only message in thread
From: Aditya Mahajan @ 2025-06-05 18:03 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, 28 May 2025, Matthias Weber wrote:

> Hello all,
> 
> I would like to typeset a certain enumeration when a corresponding mode is enabled, like so:
> 
> \defineenumeration	[Solution] 
> 				[text={Solution:},
> 				headstyle=bold,
> 				before={\startmode[solution]},
> 				after={\stopmode},
>    				style=normal,
> 				title=no
> 				]
> 
> \starttext
> 
> \enablemode[solution]
> 
> \startSolution
> Enabled
> \stopSolution
> 
> \stoptext
> 
> This works, but when I disable the mode, I get the error message 
> 
> Is there a suitable incantation to make this work?

what I do is the following:

\definebuffer[Solution][local=yes,nested=yes]

\startmode[solution]
\defineenumeration[Solution]
                  [...
                   % do not include \startmode, \stopmode in before 
                   % of after keys
                  ]
\stopmode

This way, by default, \startSolution is a buffer, but it gets redefined as an enumeration is solution mode. 

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-06-05 18:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <56A6293A-C139-4A26-849A-EE5EC55F82D7@gmail.com>
2025-06-05 18:03 ` [NTG-context] Re: Modes & enumerations Aditya Mahajan

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