Dnia Sat, Oct 25, 2008 at 02:58:24AM +0200, Diego Depaoli napisał(a):
2008/10/23 Wolfgang Schuster :
\def\ItemNumber#1%
{\expandafter\doItemNumber#1..\relax}
\def\doItemNumber#1.#2.#3\relax
{\doifelsenothing{#2}
{#1}
{#2}}
\definereferenceformat[initem][left=\ItemNumber]
Since I don't speak that language, someone could explain why this code
doesn't work when I put a stopper in subitemization?
The standard dot isn't a stopper itself?
This code seems to work (approximately) like this: it expands the "full"
reference, which is:
<number> <dot> <number> <dot>
and selects "everything from the first dot up to the second one (w/o the
dots themselves). So I consider it to be a bit dirty hack (sorry,
Wolfgang;)), in a sense that it is not very flexible.
If your stopper is, say ")" (and the second one, say, "]", so you have
references in a strange form like "1)2]"), you might want to say
something like
\def\doItemNumber #1)#2]#3\relax
(the space after \doItemNumber is gobbled by TeX, so it might be present
here or not, it is a matter of taste only).
If you have different stoppers, another approach might be reasonable. I
can see two possibilities:
1. Get to know _where_ ConTeXt really keeps the relevant info about
labels; if the info about the values (w/o stoppers) is preserved, we are
saved, if not, we've got a problem;
2. so in the latter case we have to (?) use this kind of hacky solution,
which might be something like this (assuming that \stopper and \stopperr
are the first- and second level stoppers respectively):
\edef\sometemporarymacroname{%
\def\noexpand\doItemNumber ##1\stopper ##2\stopperr ##3\relax
{\noexpand\doifelsenothing{##2}
{##1}
{##2}}%
}%
\sometemporarymacroname
(I'm not sure whether the last percentage sign is needed, but a good
rule of thumb is to put them everywhere after <closing brace> <newline>,
so that the newlines don't get translated into spaces.)
I'm not sure whether this works, though, *please* check it and tell me
(maybe I'm doing some stupid error, please the TeX gurus correct me if
yes). I hope this is ok, though, because then it my first post to this
list containing actually an _answer_ and not a _question_:))).
Cheers
--
Diego Depaoli
Greets
--
Marcin Borkowski (http://mbork.pl)
Kim jest ta, co wyłania się z pustyni,
Idzie wsparta na swoim Oblubieńcu?