옆 테이블 문제

옆 테이블 문제

옆으로 향한 표가 있는데 텍스트가 셀 내부에서 제대로 줄 바꿈되지 않습니다. 여기 내 코드가 있습니다.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[margin=2.5cm,a4paper]{geometry}

\usepackage[frenchb]{babel}
\usepackage{rotating,multirow}
\begin{document}

\begin{sidewaystable}
  \centering\small
  \renewcommand{\arraystretch}{1.5}

  \begin{tabular}{|c|c|c|c|c|p{5cm}|p{5cm}|p{5.5cm}|}
  \hline
    \multicolumn{8}{|c|}{\textbf{ANALYSE DE RISQUE}}\\
  \hline
    \multicolumn{8}{|c|}{\textbf{Poste de travail ou machine:}}\\
  \hline
    \multicolumn{4}{|c|}{\textbf{Risque}} & \textbf{Indice} &  \textbf{Situation Dangereuse} &  \textbf{Conséquence} &  \textbf{Mesure Corrective}\\
   \hline
%%%%%%%%%%%%%%%%%%% Part to duplicate if needed %%%%%%%%%%%
   \multicolumn{4}{|c|}{Heavy weight of mother roller} & \multirow{ 2}{*}{} &  \multirow{ 2}{5cm}{The heavy mother coil is lifted to a high level and has the possibility of falling.} &  \multirow{ 2}{5cm}{The operator working in the moving range may be hited or crushed by the falling mother coil. } &   \multirow{ 2}{5.5cm}{Install a laser sensor to detect the operator moving around the crane and lower the mother coil if it detects someone is approaching this area.}\\
   \cline{1-4}
   G:1 & F:1 & O:1 & P:1 & & & & \\
   \hline
%%%%%%%%%%%%%%%%%%% Part to duplicate if needed %%%%%%%%%%%
   \multicolumn{4}{|c|}{} & \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &   \multirow{ 2}{*}{}\\
   \cline{1-4}
   G: & F: & O: & P: & & & & \\
   \hline
%%%%%%%%%%%%%%%%%%% Part to duplicate if needed %%%%%%%%%%%
   \multicolumn{4}{|c|}{} & \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &   \multirow{ 2}{*}{}\\
   \cline{1-4}
   G: & F: & O: & P: & & & & \\
   \hline
%%%%%%%%%%%%%%%%%%% Part to duplicate if needed %%%%%%%%%%%
   \multicolumn{4}{|c|}{} & \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &   \multirow{ 2}{*}{}\\
   \cline{1-4}
   G: & F: & O: & P: & & & & \\
   \hline
   %%%%%%%%%%%%%%%%%%% Part to duplicate if needed %%%%%%%%%%%
   \multicolumn{4}{|c|}{} & \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &   \multirow{ 2}{*}{}\\
   \cline{1-4}
   G: & F: & O: & P: & & & & \\
   \hline
   %%%%%%%%%%%%%%%%%%% Part to duplicate if needed %%%%%%%%%%%
   \multicolumn{4}{|c|}{} & \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &  \multirow{ 2}{*}{} &   \multirow{ 2}{*}{}\\
   \cline{1-4}
   G: & F: & O: & P: & & & & \\
   \hline
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \end{tabular}

\end{sidewaystable}  
\end{document}

그리고 나는 이것을 얻습니다 여기에 이미지 설명을 입력하세요 너비는 여러 줄로 정의했기 때문에 괜찮은데 높이가 변경되지 않는 이유는 무엇입니까? 건배

답변1

나는 당신이 다음과 같은 테이블 모양을 좋아한다고 생각합니다.

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

문제는 다중 행 셀의 텍스트 높이가 에 걸쳐 있는 행의 높이보다 크다는 것입니다 multirow. 하나의 (무례한) 해결책은 이 행 중 하나를 더 높게 만드는 것입니다. multirow셀에 최대 4줄의 텍스트가 있다고 가정하고 두 개의 새로운 명령을 정의합니다(편리한 테이블 설정을 위해).

  • \newcommand\mch[1]{\multicolumn{4}{@{\rule[-1.2em]{0pt}{3.2em}}|c|}{#1}}multirow, 셀 의 4줄 텍스트 금액에 대해 더 높은 행에 사용됩니다 (전체 코드 참조).

  • \newcommand\mrh[2][0ex]{\multirow{2}*[#1]{\begin{minipage}{\hsize}#2\end{minipage}}}multirow, 환경 에서 텍스트를 수동으로 조정할 수 있습니다.

테이블의 관련 부분에 대한 전체 코드:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[margin=2.5cm,a4paper]{geometry}

\usepackage[frenchb]{babel}
\usepackage{makecell,multirow}
\usepackage{rotating}


\newcommand\mch[1]{\multicolumn{4}{@{\rule[-1.2em]{0pt}{3.2em}}|c|}{#1}}
\newcommand\mrh[2][0ex]{\multirow{2}*[#1]{\begin{minipage}{\hsize}#2\end{minipage}}}
\begin{document}

\begin{sidewaystable}
  \centering\small
  \renewcommand{\arraystretch}{1.5}

  \begin{tabular}{|c|c|c|c|c|p{5cm}|p{5cm}|p{5.5cm}|}
  \hline
    \multicolumn{8}{|c|}{\textbf{ANALYSE DE RISQUE}}\\
  \hline
    \multicolumn{8}{|c|}{\textbf{Poste de travail ou machine:}}\\
  \hline
    \multicolumn{4}{|c|}{\textbf{Risque}} & \textbf{Indice} &  \textbf{Situation Dangereuse} &  \textbf{Conséquence} &  \textbf{Mesure Corrective}\\
   \hline
%%%%%%%%%%%%%%%%%%% Part to duplicate if needed %%%%%%%%%%%
\mch{Heavy weight of mother roller}
    &   \mrh{} 
        &   \mrh[1.5ex]{The heavy mother coil is lifted to a high level and has the possibility of falling.}
            &   \mrh[1.5ex]{The operator working in the moving range may be hited or crushed by the falling mother coil. }
                &   \mrh[1ex]{
                Install a laser sensor to detect the operator moving around the crane and lower the mother coil if it detects someone is approaching this area.
                         }
                         \\
   \cline{1-4}
   G:1 & F:1 & O:1 & P:1 & & & & \\
   \hline
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \end{tabular}

관련 정보