3

I'm trying to make a command that formats the alternatives of a test. Can I put an ampersand after each alternative? (I call my tabular command out of this command, and I want to put each alternative in a different cell).

\def\tabiiiii#1\\ %
{%
    \def\tempa{#1}%
    \ifx\tempa\endtabi%
        \endtab%
    \else%
        \if\relax\detokenize{#1}\relax%
        \else%
            \stepcounter{alternatives}\thealternatives)~~\@ifnextchar {_}{}#1%
            &% HOW TO WORK IT OUT?
        \fi%
        \stepcounter{countk}%
        \the\value{countk}%
        \ifnum\the\value{countk}<3%
        \else%
        \newline\newline\newline\newline%
        \fi%
        \expandafter\tabiiiii%
    \fi%
}%
Tobi
  • 56,353
Fabricio Pio
  • 1,021
  • Do you want to print it? If yes, use \&. – Sigur Aug 17 '13 at 23:55
  • I want to put a & for tabular environment jump to another cell, not just print a & in my text. – Fabricio Pio Aug 18 '13 at 00:04
  • 4
    You can't start a conditional in one cell ending it in another. The usual work around is to build the row in a control sequence and then deliver it. – egreg Aug 18 '13 at 08:47
  • See http://tex.stackexchange.com/questions/7590/how-to-programmatically-make-tabular-rows-using-whiledo/7594#7594 for details on how this might be done. – Steven B. Segletes Sep 04 '13 at 14:45

0 Answers0