以下代码产生错误:Incomplete \if; all text was ignored after line.
我尝试在每个\\
的末尾添加if (...\eval{#1+#2}}}} \\%)
。但这只在我的桌子上增加了一条线。
\begin{table}[H]
\tiny
\centering
\def\arraystretch{2}
\setlength{\tabcolsep}{5.2pt}
\caption{xxxxx}
\ExplSyntaxOn
\DeclareExpandableDocumentCommand{\eval}{m}{\int_eval:n {#1}}
\ExplSyntaxOff
\newcommand*{\drawtable}[5]{%
\if a#5%
\multicolumn{1}{c}{\multirow{1}{*}{#1}} & \multicolumn{1}{c}{\multirow{1}{*}{#2}} & \multicolumn{1}{c}{\multirow{1}{*}{\textbf{\eval{#1+#2}}}}%
\else\if b#5%
\multicolumn{1}{c}{\multirow{1}{*}{#3}} & \multicolumn{1}{c}{\multirow{1}{*}{#4}} & \multicolumn{1}{c}{\multirow{1}{*}{\textbf{\eval{#3+#4}}}}%
\fi\fi%
}%
\begin{tabular}{ccccccccccccccccccccccccc}
\multicolumn{1}{c}{\multirow{1}{*}{}} &
\multicolumn{1}{c}{\multirow{1}{*}{}} &
\multicolumn{3}{c}{\multirow{1}{*}{\textbf{xxxxx}}} & \\ \hline
\multicolumn{1}{c}{\multirow{1}{*}{}} &
\multicolumn{1}{c}{\multirow{1}{*}{}} &
\multicolumn{2}{c}{\multirow{1}{*}{\textbf{yyy}}} & \\ \cline{3-4}
\multicolumn{1}{c}{\multirow{1}{*}{}} &
\multicolumn{1}{c}{\multirow{1}{*}{}} &
\multicolumn{1}{c}{\multirow{1}{*}{\textbf{aa}}} &
\multicolumn{1}{c}{\multirow{1}{*}{\textbf{bb}}} &
\multicolumn{1}{c}{\multirow{1}{*}{\textbf{ccc}}} & \\ \hline
\multicolumn{1}{c}{\multirow{2}{*}{\textbf{rr}}} &
\multicolumn{1}{c}{\multirow{1}{*}{\textbf{N.}}} &
\drawtable{18}{8}{4}{7}{a}
& \\
\multicolumn{1}{c}{\multirow{1}{*}{}} &
\multicolumn{1}{c}{\multirow{1}{*}{\textbf{N.}}} &
\drawtable{18}{8}{4}{7}{b}
& \\ \hline
\end{tabular}
\end{table}