
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 tex error > runaway error: end of file encountered mtx-context | fatal error: return code: 1 Is there a suitable incantation to make this work? Thanks for all the help, Matthias

On 5/29/25 03:26, Matthias Weber wrote:
[...] Is there a suitable incantation to make this work?
Hi Matthias, I guess that this is only a workaround: \defineenumeration [Solving] [text={Solution:}, headstyle=bold, style=normal, title=no ] \protected\def\Solution#1{% \ifmode{solution}\startSolving #1\stopSolving\fi} \starttext \enablemode[solution] Just whatever. \Solution{Enabled} \stoptext But it might help. Cheers, Pablo

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
participants (3)
-
Aditya Mahajan
-
Matthias Weber
-
Pablo Rodriguez