横向きのテーブルの問題

横向きのテーブルの問題

横向きのテーブルがありますが、テキストがセル内で適切に折り返されません。これが私のコードです

\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。1 つの (無礼な) 解決策は、この行の 1 つを高くすることです。セルには最大 4 行のテキストが含まれると仮定してmultirow、2 つの新しいコマンドを定義します (便利なテーブル設定用)。

  • \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}

関連情報