[texhax] [hyperref] Programatically change the name of the \CheckBox?

Heiko Oberdiek heiko.oberdiek at googlemail.com
Tue Nov 25 17:47:56 CET 2014


On 26.11.2014 12:50, Hubert Lam wrote:
> Hi all
> Does anyone know of ways to programmatically changing the name of the
> \CheckBox?

Yes, it is possible.

> i.e. I would like the name of the \CheckBox to advance with the
> \theenumi counter. However, if I use
> \CheckBox[name=Name\theenumi]{}
> Then it fail to compile, resulting in an error about “Use of \pdfmark@
> doesn’t match its definition”.

The definition of `\theenumi` is not appropriate, in contrary
you have a recursion: "label=\protect\CheckBoxes\arabic*."
defines \theenumi. If \theenumi is called within the \CheckBox,
then it calls \CheckBoxes at the start of the label `\theenumi
and expands further another \CheckBox, which again wants to
have \theenumi in its name.

But you can use the counter value `enumi' instead.
However, \value is redefined, thus \countervalue/\thevalue
are using the original \value:





\newcommand{\Placehold}{How are you? }


\begin{enumerate}[label={\protect\CheckBoxes \arabic*.},leftmargin=*]
\item   \psLoop{15}{\Placehold}
        \item   \psLoop{20}{\Placehold}
        \item   \psLoop{10}{\Placehold}
        \item   \psLoop{10}{\Placehold}
        \item   \psLoop{10}{\Placehold}
\item   \psLoop{35}{\Placehold}

Yours sincerely

More information about the texhax mailing list