我尝试将表定义为一个新环境。
\newenvironment{scaledtable}[1]{%
\begin{table}[h]
\caption{xxx}
\label{tab:xxx}
\begin{center}
\begin{tabular}{rcrrrrrrrrrrrrcc}
}{
\hline
\end{tabular}
\end{center}
\end{table}}我的问题是我不能使用scalebox{}。如果我把结束括号放在环境的结束定义中,latex就不能再分配括号了。我也不能使用PStricks,因为use。
发布于 2010-05-02 04:12:31
使用\lrbox临时存储表,然后对其进行缩放
\newsavebox{\scaledtablebox}
\newcommand*{\scaledtablefactor}{1}
\newenvironment{scaledtable}[1]{%
\renewcommand*{\scaledtablefactor}{#1}%
\begin{table}[h]%
\caption{xxx}%
\label{tab:xxx}%
%
\begin{lrbox}{\scaledtablebox}%
\begin{tabular}{ll}%
}{%
\hline%
\end{tabular}%
\end{lrbox}%
%
\begin{center}%
\scalebox{\scaledtablefactor}{\usebox{\scaledtablebox}}%
\end{center}%
\end{table}%
}工作方式如下(0.5是比例因子):
\begin{scaledtable}{0.5}
Hello & World! \\
\end{scaledtable}https://stackoverflow.com/questions/2750098
复制相似问题