savebox를 사용하여 테이블 저장

savebox를 사용하여 테이블 저장

한 곳에서 정의하고 다른 곳에서 인쇄할 수 있도록 savebox를 사용하여 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}

관련 정보