是否可以通过设置全局布尔变量来显示或隐藏表的行?
\documentclass{minimal}
% some boolean variable X
\begin{document}
\begin{tabular}{ccc}
A & B & C \\
A & B & C \\
A & B & C \\ %show this row iff X is true
A & B & C \\
A & B & C \\ % show this row iff X is true
\end{tabular}
\end{document}
答案1
etoolbox
为此提供了一个简单的语法\ifbool{FLAG}{IF-TRUE}{IF-FALSE}
::
\documentclass{minimal}
\usepackage{etoolbox}
\newbool{extrarows}
\booltrue{extrarows}
\begin{document}
\begin{tabular}{ccc}
A & B & C \\
A & B & C \\
\ifbool{extrarows}{D & E & F \\}{}
A & B & C \\
\ifbool{extrarows}{D & E & F \\}{}
\end{tabular}
\end{document}