I have a latex document with 24 questions labeled with numbers from 1 to 8. I want to give a number x between 1 and 8 to latex in the preamble so that all the questions become commented except the ones numbered by x. Is it possible to do that?
My idea was to write something like:
\def\label{3} %this number says which question is not going to be commented.
\newcommand\qone[1]{\ifstrequal{label}{1}{#1}{}}
\newcommand\qtwo[1]{\ifstrequal{label}{2}{#1}{}}
\newcommand\qthree[1]{\ifstrequal{label}{3}{#1}{}}
\newcommand\qfour[1]{\ifstrequal{label}{4}{#1}{}}
\newcommand\qfive[1]{\ifstrequal{label}{5}{#1}{}}
\newcommand\qsix[1]{\ifstrequal{label}}{6}{#1}{}}
\newcommand\qseven[1]{\ifstrequal{label}{7}{#1}{}}
\newcommand\qeight[1]{\ifstrequal{label}{8}{#1}{}}
and then enclose question 1 in \qone{...}, question 2 in \qtwo{...} and so on. I know that this won't work, but I can't figure how to write it from the etoolbox userguide.
\documentclassand the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem. – Peter Grill Feb 27 '13 at 21:10\ifboolsuggests you're already using theetoolboxpackage you might want\ifnumequal{<num>}{<num>}{<true<}{<false>}. And then there's of course TeX's\ifnum<num>=<num>\relax <true>\else <false>\fi` – cgnieder Feb 27 '13 at 21:29