34

表形式で複数行内の行を分割する方法がわかりません。2行の高さのセルが1つあり、その中に長いテキストがある表を作成する必要がありますが、行が途切れず、テキストが左側の別のセルと重なっています。

助言がありますか?

コードのサンプル:

\begin{center}
    \begin{tabular}{|p{1cm}|p{2.5cm}|p{2cm}|p{2cm}|p{2cm}|p{2cm}|}
    \hline
    \multirow{2}{*}{Long text to break} % HERE IS A PROBLEM
        & Thing  & \multicolumn{2}{|c|}{Thing 2} & \multicolumn{2}{|c|}{Thing 3}    
    \\ \cline{2-6}
        & sth 1 & sth 1 & sth 2 & sth 1  & sth 2 \\ \hline
\hline
\end{tabular}
\end{center}
4

5 に答える 5

39

p列と\parboxまた動作します:

\usepackage{multirow}

\begin{document}
\begin{center}
\begin{tabular}{|p{1.5cm}|l|l|l|l|l|}
    \hline
    \multirow{2}{*}{\parbox{1.5cm}{Long text to break}}
    & Thing  & \multicolumn{2}{|c|}{Thing 2} & \multicolumn{2}{|c|}{Thing 3} \\
    \cline{2-6}
    & sth 1 & sth 1 & sth 2 & sth 1  & sth 2 \\ 
    \hline
    \hline
\end{tabular}
\end{center}
\end{document}

ラテックスドキュメントのparbox

于 2012-03-27T12:38:07.477 に答える
15

あなたはそれを試すことができますminipage

\begin{center}
\begin{tabular}{|l|l|l|l|l|l|}
    \hline
    \multirow{2}{*}{\begin{minipage}{0.5in}Long text to break\end{minipage}}
    & Thing  & \multicolumn{2}{|c|}{Thing 2} & \multicolumn{2}{|c|}{Thing 3} \\
    \cline{2-6}
    & sth 1 & sth 1 & sth 2 & sth 1  & sth 2 \\ 
    \hline
    \hline
\end{tabular}
\end{center}

ただし、特定のケースでは、無駄なスペースが多すぎるため、他の列の制限を緩めることをお勧めします。eachp{}を使用すると、他の列が特定の幅になるため、最初の列に十分なスペースがありません。

コンパイルしたとき、次のコードは見栄えがするように見えました。

\begin{center}
\begin{tabular}{|l|l|l|l|l|l|}
    \hline
    \multirow{2}{*}{Long text to break}
    & Thing  & \multicolumn{2}{|c|}{Thing 2} & \multicolumn{2}{|c|}{Thing 3} \\
    \cline{2-6}
    & sth 1 & sth 1 & sth 2 & sth 1  & sth 2 \\
    \hline
    \hline
\end{tabular}
\end{center}
于 2010-10-21T21:01:22.737 に答える
7

私にとっては、「multirow」の組み込みコマンドを使用して機能しました-{*}は「{width}」です

于 2013-05-06T14:11:28.757 に答える