when I run \hline in the true-branch of a \ifthenelse
inside a tabular (\Constructor is called in a tabular-environment[1])
\newcommand*{\Constructor}[8][xxx]{%
\ifthenelse{1=1}{\hline}{}
}
(macro is simplified)
then I get this error:
! Misplaced \noalign.
\hline ->\noalign
{\ifnum 0=`}\fi \hrule \@height \arrayrulewidth \futurelet...
\\Constructor ...line \ifthenelse {1=1}{\hline }{}
It works fine if I just do "\hline" unconditionally in \Constructor.
[1]: this is the tabular-environment:
\begin{tabular}{|p{2.5cm}|p{4.5cm}|p{3.5cm}|p{3.5cm}|p{3.5cm}|p{3.5cm}|p{3.5cm}|}
\hline
\multirow{2}*{Method} & \multirow{2}*{Description} & \multicolumn{3}{c}{Parameters}\vline &
\multirow{2}*{Return value} & \multirow{2}*{Comments} \\
\cline{3-5} & & in & out & in+out & & \\
\hline
=> \Constructor is called here
thanks,
--
Felix Natter
Linux from *scratch* (www.gnu.org/software/emacs)
E-Mail: fna...@gmx.net
It would much easier to help you if you would sent a complete minimal
document that shows your problem instead of some scraps of code.
Ulrike Fischer
yep, here it is:
\documentclass{article}
\usepackage{ifthen}
\begin{document}
\newcommand*{\mytabrow}[2]{%
#1 & #2 \\
\ifthenelse{1=1}{\hline}{}
}
\begin{tabular}{c|c}
first column & second column \\
\mytabrow{one}{two}
\end{tabular}
\end{document}
thanks,
--
Felix Natter
I love secs... for programming
\newcommand*{\mytabrow}[2]{%
#1 & #2
\ifthenelse{1=2}{\\\hline}{\\}%
}
--
Morten Høgholm.
Beware of my cheesy address!
>>
>> It would much easier to help you if you would sent a complete minimal
>> document that shows your problem instead of some scraps of code.
>
> yep, here it is:
>
> \documentclass{article}
>
> \usepackage{ifthen}
>
> \begin{document}
>
> \newcommand*{\mytabrow}[2]{%
> #1 & #2 \\
> \ifthenelse{1=1}{\hline}{}
> }
>
> \begin{tabular}{c|c}
> first column & second column \\
> \mytabrow{one}{two}
> \end{tabular}
>
> \end{document}
Morton did give you the right advice. Roughly the rule is:
Don't start if-then-else-clauses with \hline (or \multicolumn). Both
commands can be used only at some places in the tabular (they want to
be directly after a \\, \hline or &) and get confused by the macro and
the ifthen-command.
Ulrike Fischer