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

Hubert Lam hubert at lamfamily.info
Wed Nov 26 12:50:01 CET 2014


Hi all

Does anyone know of ways to programmatically changing the name of the \CheckBox?

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".

Attached PDF contains the LAYOUT, but with the checkbox names not advancing programmatically, thus once you tick a box, the others are also ticked.

Example that compiles (but once a CheckBox is ticked, it's ticked for every single box!)

------
\documentclass[a4paper,12pt]{article}
\usepackage{calc}
\usepackage{enumitem,pstricks-add}
\usepackage[ps2pdf]{hyperref}
\usepackage[margin=1in]{geometry}

\begin{document}

\newcommand{\Checks}{
\begin{Form}
\CheckBox[name=7N]{}
\CheckBox[name=7R]{}
\CheckBox[name=7T]{}
\CheckBox[name=7H]{}
\CheckBox[name=7S]{}
\end{Form}
}

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

\newcommand{\CheckBoxes}{
\begin{minipage}{\widthof{\Checks}}
    \Checks
\end{minipage}
}

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


Example that does NOT compile:

\CheckBox[name=7N\theenumi]{}
\CheckBox[name=7R\theenumi]{}
\CheckBox[name=7T\theenumi]{}
\CheckBox[name=7H\theenumi]{}
\CheckBox[name=7S\theenumi]{}



Thanks in advance!

Hubert

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20141126/ac1b674d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: checkbox.pdf
Type: application/pdf
Size: 13510 bytes
Desc: checkbox.pdf
URL: <http://tug.org/pipermail/texhax/attachments/20141126/ac1b674d/attachment-0001.pdf>


More information about the texhax mailing list