[texhax] How to structure conditionals?

Chris Bergstresser chris at subtlety.com
Sun Oct 23 08:47:26 CEST 2005


Hi all --

    I'm using TeX to create a survey for a psychology experiment, which 
means I have a several different conditions.  For example, one version 
of the survey might have the following:

1) Do you like to eat beets?
2) Do you like to drink milk?
3) Can you dance the rumba?

     While another version of the questionnaire might have the following:

1) Do you like to eat potatoes?
2) Do you like to drink milk?
3) Can you dance a polka?

     In other words, each question comes in a couple different 
varieties.  To produce different versions of the questionnaire, I'd like 
to specify (at the beginning of the file) something simple, which tells 
TeX "when you're in the first question, use the second question 
conclusion; when you're in the second question, use the second question 
conclusion; when you're in the third question, use the first question 
conclusion".

I've gotten as far as this:

\newcommand{\question}[3]{
    \samepage{}
    \thequestionnum) #1 #2
    \addtocounter{questionnum}{1}
}
\newcounter{questionnum}
\addtocounter{questionnum}{1}

    But I can't for the life of me figure out how to put in a 
conditional, either checking a defined string at the beginning (e.g. 
"221" for second conclusion, second conclusion, first conclusion) or 
using some combination of \ifthenelse and \include to break apart 
problem.  Any ideas?  Pointers where to start?

-- Chris



More information about the texhax mailing list