
tabularx로 생성된 테이블을 가로 중앙에 배치하고 싶습니다. 하지만 tabularx 테이블에는 제거할 수 없는 오른쪽 오프셋이 있습니다.
\begin{table}
\small
\centering
\noindent
\begin{tabularx}{}{@{}X|X|X@{}}\hline
a & b & c \\ \hline
d & e & f
\\\hline
\end{tabularx}
\caption{This table is generated with tabularx. This table is generated with tabularx. This table is generated with tabularx. This table is generated with tabularx. This table is generated with tabularx. This table is generated with tabularx. }
\end{table}
\begin{table}
\small
\centering
\noindent
\begin{tabular}{ccc}\hline
a & b & c \\ \hline
d & e & f
\\\hline
\end{tabular}
\caption{This table is generated with tabular. This table is generated with tabular. This table is generated with tabular. This table is generated with tabular. This table is generated with tabular. This table is generated with tabular.}
\end{table}
tabularx에서 테이블을 수평 중앙에 어떻게 배치할 수 있나요?
답변1
tabularx
-columns 의 너비를 계산하려면 결과 테이블의 너비를 지정해야 합니다 X
. 따라서 다음과 같이 사용하십시오.
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\begin{table}[t]
\small
\centering
\begin{tabularx}{10em}{ @{} X | X | X @{} }
\hline
a & b & c \\
\hline
d & e & f \\
\hline
\end{tabularx}
\caption{This table is generated with \texttt{tabularx}.}
\end{table}
\begin{table}[t]
\small
\centering
\begin{tabular}{ *{3}{c} }
\hline
a & b & c \\
\hline
d & e & f \\
\hline
\end{tabular}
\caption{This table is generated with \texttt{tabular}.}
\end{table}
Some regular text.
\end{document}