
한 열에 테이블을 만들어야 합니다. 크기에 맞게 조정해야 합니다. 예를 들어 텍스트가 두 행에 있을 수 있습니다. 테이블 행은 하나의 열에 맞습니다. 하지만 텍스트가 열 너비를 초과합니다. 표 텍스트가 열 너비를 초과하는 대신 다음 행으로 확장되도록 하려면 어떻게 해야 합니까? 최소한의 테스트 코드입니다.
\documentclass[letterpaper,twocolumn,10pt]{article}
\usepackage{graphicx}
\usepackage{array,tabularx}
\usepackage{multirow,booktabs} %for the table
\usepackage{pifont}% cross and match marks. http://ctan.org/pkg/pifont
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\usepackage{array,tabularx}
\begin{document}
\begin{table*} [h!]
%\centering
\caption{Caption for the table.}
\label{tab:table1}
\resizebox{\columnwidth}{!}{
\begin{tabularx} {\columnwidth}{cccccc} %{\columnwidth}{cccccc}
\toprule
& & first col & second col & third col & forth col \\
first row & & \xmark & \xmark & \xmark \\
%\midrule
%prettifies & the & content \\
\bottomrule
\end{tabularx}
}
\end{table*}
\end{document}
답변1
table*
두 개의 열에 걸쳐 있는 테이블을 지정했습니다 . 이는 페이지 상단에만 설정할 수 있습니다. [t]
대신 인수가 있거나 최소한 t
. 그런 다음 테이블에 해당 너비가 있음을 의미하는 tabularx
크기를 지정했습니다 . \columnwidth
이것이 행이 하나의 열인 이유입니다. 텍스트가 더 넓어서 표에 맞지 않습니다. 또한 X
에 지정된 열 지정자를 사용하지 않으므로 tabularx
대신 tabular
. 아래 예에서는 테이블 배치를 더 명확하게 표시하기 위해 일부 lipsum 텍스트를 포함했습니다.
\documentclass[letterpaper,twocolumn,10pt]{article}
\usepackage{graphicx}
\usepackage{array,tabularx}
\usepackage{multirow,booktabs} %for the table
\usepackage{pifont}% cross and match marks. http://ctan.org/pkg/pifont
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\usepackage{array,tabularx}
%%
\usepackage{lipsum}
\begin{document}
\lipsum[1-3]
%%%
\begin{table*} [ht]
\centering
\caption{Caption for the table.}
\label{tab:table1}
% \resizebox{\columnwidth}{!}{
\begin{tabular}{cccccc} %{\columnwidth}{cccccc}
\toprule
& & first col & second col & third col & forth col \\
first row & & \xmark & \xmark & \xmark \\
% \midrule
% prettifies & the & content \\
\bottomrule
\end{tabular}
%}
\end{table*}
\lipsum[4-13]
\end{document}