[texhax] It works: enumerate problem

David Carlisle d.p.carlisle at gmail.com
Fri Oct 13 23:05:41 CEST 2017


On 13 October 2017 at 21:44, Michael Barr <barr at math.mcgill.ca> wrote:
> I was going to post a question, but I tried one last thing and it worked.  In case anyone else ran into this, I thought it would be worth posting it.  Using the enumerate package, I had a list introduced by

I'd say this is (just about) documented behaviour:-)
although one thing the enumerate package doc doesn't say is that for most uses
it's better to use enumitem these days.

but..

> \begin{enumerate}[$T_1$:]\setcounter{enumi}{1}
> I wasn't sure it would work.  But it did, almost, until I got to item 16 (having jumped from \item 8) and it set it as $T_{1}6$, that is the six was not subscripted.  So I tried

1 is replaced by \theenumi but \theenumi expands to 16 so as you say
this is T_16

> \begin{enumerate}[$T_{1}$:]\setcounter{enumi}{1}
> and that didn't work at all.  All the items got set with T_1.

Presumably with a warning "The counter will not be printed."
as a documented feature enumerate skips over any of the special tokens
that are  inside a {} group
so you can hide a in  {sample} i  to make sample i, sample ii rather
than sample i sbmple i


>  I thought I would be reduced to doing it myself.  But on the principle of try anything, I tried, not expecting much
> \begin{enumerate}[$T_\bgroup1\egroup$:]\setcounter{enumi}{1}
> and guess what!

enumerate sees the 1 in that case and tex-primitive subscripts can be
delimited by implicit braces.
Rather than rely on low level subscript weirdness, or for cases where
you need real {}
you could use a definition such as \def\Tsub[#1]{T_{#1}}  then
$\Tsub[1]$
probably works (not tested:-)


David


More information about the texhax mailing list