Tag equation in ConTeXt with arbitrary text
You can setup a dummy conversion. But you need a new one for every new tag:
\starttext
\def\mytagforformulaA#1{testtesttest}
\defineconversion[dummyA][\mytagforformulaA]
\setupformulae[numberconversion=dummyA]
\placeformula[test1]
\startformula E = mc^2 \stopformula
This is my reference: \in{formula}[test1].
\def\mytagforformulaB#1{blublubblu}
\defineconversion[dummyB][\mytagforformulaB]
\setupformulae[numberconversion=dummyB]
\placeformula[test2]
\startformula E = mc^2 \stopformula
This is my reference: \in{formula}[test2].
This is my reference from 1: \in{formula}[test1].
\stoptext
As others have pointed out there is no clean solution right now. However, since you say that it is okay if you cannot refer to the formula, you can abuse the suffix mechanism:
\defineformula[tag][numbersegments=2]
\starttext
\placeformula[test1]
\startformula E = mc^2 \stopformula
\placeformula[test2]{ABC}
\starttagformula E = mc^2 \stoptagformula
\placeformula[test3]
\startformula E = mc^2 \stopformula
We can still refer to other formulas: \in[test1] and \in[test3], but not the
tagged formula: \in[test2].
\stoptext
Note that \placeformula{suffix}
changes the equation number to n.suffix
, where n
is the current equation number. The setup:
\defineformula[tag][numbersegments=2]
ensures that in tagformula
s, only the second segment of this number (i.e., only the suffix
) is shown).
Thanks to @Metafox for suggesting a simplification to my earlier hackish answer.
You can assign tags with \placefomula
and change the appearance with \setupformulas
:
\setupformulas[numberconversion=Character]
\starttext
\placeformula[formulalabel]
\startformula
1+1=2
\stopformula
You can refer to the formula like this: \in[formulalabel]
\stoptext