Longtable에서 \textwidth보다 큰 여러 행에서

Longtable에서 \textwidth보다 큰 여러 행에서

MWE

\documentclass[a4paper,12pt]{book}

\usepackage[left=1.5cm,right=1cm,top=3cm,bottom=1.5cm,marginparwidth=5.5cm,marginparsep=1cm,outer=8cm]{geometry}

\usepackage{array} 
\usepackage{longtable} 
\usepackage{showframe} 
\usepackage{multicol}
\usepackage{multirow}

\begin{document}

textwidth = 2.1cm + 2.8cm + 2.8cm + 2cm = 9.7cm

\begin{longtable}{|p{2.1cm}| p{2.8cm} |p{2.8cm}|p{2cm}|}
\hline
\multicolumn{4}{|c|}{\textbf{Q CODES}} \\
\hline
\textbf{Q CODE} & \multicolumn{3}{c|}{\textbf{EXPLAIN}} \\
\hline
\multirow{6}{*}{QOD} & \multicolumn{3}{l|}{Short Sentence, No Problem ( 9.7cm )}\\
                 & \multicolumn{3}{l|}{Long Sentence, Long Sentence, Long Sentence Problem ( greater than 9.7cm )}\\
                 \cline{2-4}
                 & 0 Holland & 1 English & 2 France\\
                 & 3 Germany & 4 Greece & 5 Italia\\
                 & 6 Japan & 7 Norvia & 8 Russia\\
                 & 9 Espanol  & &\\ 
\hline
\end{longtable}
\end{document}

표시 중, 여기에 이미지 설명을 입력하세요.

내 문제는 여러 행의 긴 테이블에 있는 긴 문장이 다음 줄로 이동하지 않는다는 것입니다. 즉, 행이 보다 큽니다 \textwidth. 와 같은 행 라인에 대해 무엇을 해야 합니까 \textwidth? (어쩌면 대답은 쉬울지도 모릅니다. 하지만 찾지 못했습니다.)

답변1

다음과 같이 여러 열 내에서 parbox를 사용합니다(3개의 열을 추가하면 7.6cm가 됩니다).

 \documentclass[a4paper,12pt]{book}

 \usepackage[left=1.5cm,right=1cm,top=3cm,bottom=1.5cm,marginparwidth=5.5cm,marginparsep=1cm,outer=8cm]{geometry}

\usepackage{array} 
\usepackage{longtable} 
\usepackage{showframe} 
\usepackage{multicol}
\usepackage{multirow}

\begin{document}

textwidth = 2.1cm + 2.8cm + 2.8cm + 2cm = 9.7cm

\begin{longtable}{|p{2.1cm}| p{2.8cm} |p{2.8cm}|p{2cm}|}
\hline
\multicolumn{4}{|c|}{\textbf{Q CODES}} \\
\hline
\textbf{Q CODE} & \multicolumn{3}{c|}{\textbf{EXPLAIN}} \\
\hline
\multirow{6}{*}{QOD} & \multicolumn{3}{l|}{Short Sentence, No Problem ( 9.7cm )}\\
             & \multicolumn{3}{l|}{\parbox{7.6cm}{Long Sentence, Long     Sentence, Long Sentence Problem ( greater than 9.7cm )}}\\
             \cline{2-4}
             & 0 Holland & 1 English & 2 France\\
             & 3 Germany & 4 Greece & 5 Italia\\
             & 6 Japan & 7 Norvia & 8 Russia\\
             & 9 Espanol  & &\\ 
\hline
\end{longtable}
\end{document}

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

관련 정보