I am writing a questionnaire. It lists 16 software features, and the participants should answer things like "I find this feature: Very important - Somewhat important - Not at all important" once for each feature.
The wording of the features and of each question changes a lot while we are working on the questionnaire, so it would be insane to format everything per hand and include the changes over and over. Instead, I created a command called \featureanswers which takes one argument (the feature description) and prints the questions about the features. I use this command with a pgffor loop to create the questionnaire.
Now, my boss decided that we have to change the numbering. Because Feature 7 and Feature 8 are mutually exclusive, they should be numbered Feature 7a and Feature 7b instead. I can't find a good solution for this case. I tried writing a nested loop, but only succeeded in writing one which expects the same number of elements for each run of the inner loop.
Any ideas how I can handle that automatically? I know I can split it to two loops (before and after 7) and print 7a and 7b on their own, but I would like a more elegant solution, which can handle future changes to the other features.
This is the code for the current version. It assumes all features are the same (no 7a and 7b).
\documentclass[a4paper,12pt]{article}
\usepackage{pgffor}
\usepackage{amssymb}
\def\allfeatures{\fone,\ftwo,\fthree,\ffour,\ffive,\fsix,\fseven,\feight,\fnine,\ften,\feleven,\ftwelve,\fthirteen,\ffourteen,\ffifteen,\fsixteen}
\def\fone{redacted}
\def\ftwo{redacted}
\def\fthree{redacted}
\def\ffour{redacted}
\def\ffive{redacted}
\def\fsix{redacted}
\def\fseven{redacted}
\def\feight{redacted }
\def\fnine{redacted}
\def\ften{redacted}
\def\feleven{redacted}
\def\ftwelve{redacted}
\def\fthirteen{redacted}
\def\ffourteen{redacted}
\def\ffifteen{redacted}
\def\fsixteen{redacted}
\newcounter{featurecounter}
\setcounter{featurecounter}{0}
\newcommand{\featureanswers}[1]
{
\stepcounter{featurecounter}
\vspace{18pt}
{\bf Feature} \arabic{featurecounter} {#1}
\begin{enumerate}
\parbox{8cm}{\item I can envision a way this feature will be implemented.}
\begin{tabular}{c c c c c}
really well & & unsure & & not at all \\
$\square$ & $\square$ & $\square$ & $\square$ & $\square$ \\
\end{tabular}
\parbox{4.5cm}{\item I think this feature is: }
\begin{tabular}{c c c c c}
very important & & slightly important & & not important \\
$\square$ & $\square$ & $\square$ & $\square$ & $\square$ \\
\end{tabular}
\end{enumerate}
}
\begin{document}
\foreach \featureB in \allfeatures{
\featureanswers{\featureB}
}
\end{document}



a,bquestion? – Peter Grill Mar 8 '12 at 19:30