
我想使用保存箱來保存 tabularx,這樣我就可以在一個地方定義它並在另一個地方列印它。雖然下面的程式碼適用於列表,但我無法使其適用於表格。有什麼辦法可以實現這一點嗎?下面的程式碼給了我一個「不在外部標準模式」錯誤。
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\newsavebox{\mybox}
\begin{lrbox}{\mybox}
\begin{table}
\begin{tabularx}{\textwidth}{|l|ll|}
x & y & z\\\hline
\end{tabularx}
\end{table}
\end{lrbox}
\usebox{\mybox}
\end{document}
答案1
您無法將浮動環境保存在框中,但可以儲存tabularx
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\newsavebox{\mybox}
\begin{lrbox}{\mybox}
\begin{tabularx}{\textwidth}{|l|ll|}
x & y & z\\\hline
\end{tabularx}
\end{lrbox}
\begin{table}
\usebox{\mybox}
\end{table}
\end{document}