[NTG-context] One-off theorem titles

Wolfgang Schuster schuster.wolfgang at googlemail.com
Thu Mar 3 15:18:58 CET 2011


Am 03.03.2011 um 09:05 schrieb S Barmeier:

> \startenumeration[text={Yoneda Lemma},location= ... ]

Enumeration don’t support key-val-input for the commands and environments
(although it isn’t hard to add it). The both arguments are “[reference]”
and “{title}”.

Besides the already presented solution here is one which use the annotation
module (local replacement of the enumeration text doesn’t work because
\setupenumerations resets the counter):

\usemodule[annotation]

% solution 1

%\defineenumeration
%  [thelemma]
%  [ location=serried,
%        text=Lemma,
%       width=broad]
%
%\define[2]\LemmaCommand
%  {\doiftext
%    {\placeannotationtitle}
%    {\setupenumerations[thelemma][text=\placeannotationtitle]}%
%   \startthelemma#2\stopthelemma}

\defineenumeration
  [thelemma]
  [ location=serried,
        text=\placeannotationtitle,
       width=broad]

\define[2]\LemmaCommand
  {\doiftextelse{\placeannotationtitle}
    {}
    {\def\placeannotationtitle{Lemma}}%
   \startthelemma#2\stopthelemma}

\defineannotation
  [lemma]
  [alternative=command,
       command=\LemmaCommand]

% solution 2

%\defineenumeration
%  [theproclaim]
%  [ location=serried,
%        text=Proclaim,
%       width=broad]
%
%\define[2]\ProclaimCommand
%  {\doiftext
%    {\placeannotationtext}
%    {\setupenumerations[theproclaim][text=\placeannotationtext]}%
%   \starttheproclaim#2\stoptheproclaim}

\defineenumeration
  [theproclaim]
  [ location=serried,
        text=\placeannotationtext,
       width=broad]

\define[2]\ProclaimCommand
  {\doiftextelse{\placeannotationtext}
    {}
    {\def\placeannotationtext{Proclaim}}%
   \starttheproclaim#2\stoptheproclaim}

\defineannotation
  [proclaim]
  [alternative=command,
       command=\ProclaimCommand]

\starttext

\startlemma
…
\stoplemma

\startlemma{Another Lemma}
…
\stoplemma

\blank[2*line]

\startproclaim
…
\stopproclaim

\startproclaim[text={Another Proclaim}]
…
\stopproclaim

\stoptext

Wolfgang



More information about the ntg-context mailing list