긴 문장을 테이블의 여러 줄로 나누기

긴 문장을 테이블의 여러 줄로 나누기

표에 너무 길어서 표가 페이지 밖으로 나가게 만드는 문장이 있습니다. 표의 레이아웃을 망치지 않도록 문장을 여러 줄로 나누려면 어떻게 해야 합니까?

\begin{table}[!htb]
\caption{}
\centering
\begin{tabular}{llll}
\hline
Material & Production & Description & Reference \\
\hline
 & a bene placito a bene placito a bene placito a bene placito &  & \\
\hline
\end{tabular}
\end{table}

미리 감사드립니다.

답변1

p{<width>}긴 문장이 포함된 컬럼에 사용합니다 . 너비는 cm, pt 또는 LaTeX에 유효한 다른 너비일 수 있습니다.

\documentclass{article}

\begin{document}
\begin{table}[!htb]
\caption{}
\centering
\begin{tabular}{lp{4cm}ll}
\hline
Material & Production & Description & Reference \\
\hline
 & a bene placito a bene placito a bene placito a bene placito &  & \\
\hline
\end{tabular}
\end{table}
\end{document}

더 멋진 표 형식을 얻으려면 array및 패키지를 로드하고 대신 및 를 booktabs사용하는 것이 좋습니다 .\toprulemidrulebottomrule\hline

p{}- 열은 기본적으로 양쪽 정렬로 설정되므로 넓은 열을 오른쪽으로 정렬하는 것도 고려해 볼 수 있습니다. 표준 라텍스\raggedright 단어에 하이픈을 넣지 않으므로 텍스트가 매우 불규칙한 경우 불규칙한 열에 하이픈을 넣어야 합니다. 패키지 로드비정형2e서문에서 \RaggedRight대신 명령을 사용하십시오 \raggedright. 귀하의 예에서는 차이가 없지만 긴 단어가 포함된 좁은 열을 시도해 보십시오. 다음은 수정된 MWE입니다.

\documentclass{article}
\usepackage{ragged2e,array,booktabs}

\begin{document}
\begin{table}[!htb]
\caption{}
\centering
\begin{tabular}{l>{\RaggedRight}p{4cm}ll}
\toprule
Material & Production & Description & Reference \\
\midrule
 & a bene placito a bene placito a bene placito a bene placito &  & \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

여기에 이미지 설명을 입력하세요

관련 정보