多行单元格中有多个段落?

多行单元格中有多个段落?

我正在尝试在多行单元格内写入多个段落,但我不知道该怎么做!我尝试了很多方法,但都不起作用。首先,我将向您展示我想要得到的结果:

明智表

使用下一个文件,我得到了下一个表:

    \documentclass[a4paper,12pt]{article}
    \usepackage[latin1]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage[spanish]{babel}
    \usepackage{amsmath}
    \usepackage{amssymb,amsfonts,textcomp}
    \usepackage{array}
    \usepackage{multirow}
    \usepackage{hhline}
    \usepackage[left=1.5cm,top=2.5cm,right=2.5cm,bottom=2.5cm]{geometry}

    \begin{document}

    \begin{center}
    \begin{tabular}{|b{6cm}|m{0.3cm}|m{10.2cm}|}
    \hline
    A & B & \multirow{3}{*}{\parbox{10.2cm}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer sit amet tincidunt ante, suscipit consectetur urna. Maecenas cursus libero turpis, fermentum aliquet metus malesuada et. Pellentesque auctor tellus nibh, et dignissim urna dictum ut. Nam posuere nulla odio, posuere convallis massa facilisis sit amet.}
    \parbox{10.2cm}{Proin sed nisl tellus. Ut dapibus imperdiet dignissim. Integer rhoncus fringilla ipsum, non fringilla ipsum imperdiet non. Curabitur nisl felis, imperdiet a vestibulum vel, consectetur hendrerit tortor. Etiam metus nisi, hendrerit eget metus at, luctus posuere massa. Sed non lorem lobortis odio eleifend ultrices quis sed arcu. Aenean quam lectus, ornare ut risus ac, rutrum mattis.}} \\ \cline{1-2}
    C & D & \\ \cline{1-2}
    E & F & \\ \hline
    G & H & I \\ \hline
    \end{tabular}
    \end{center}

    \end{document}

获取表

我不得不说我尝试过

    \p
    \par

以及所有这些选项...但我已经筋疲力尽了!

谁能告诉我正确的解决方案?

谢谢。

答案1

您应该能够使用空白行来表示段落中断,但不幸的是\multirow目前不允许\par(看起来像一个容易修复的错误)但在这里几乎总是您可以使用它\endgraf作为替代命令而不受限制\par

在此处输入图片描述

    \documentclass[a4paper,12pt]{article}
    \usepackage[latin1]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage[spanish]{babel}
    \usepackage{amsmath}
    \usepackage{amssymb,amsfonts,textcomp}
    \usepackage{array}
    \usepackage{multirow}
    \usepackage{hhline}
    \usepackage[left=1.5cm,top=2.5cm,right=2.5cm,bottom=2.5cm]{geometry}

    \begin{document}

    \begin{center}
%multirow manual page 14
   \newcommand{\mystrut}{\rule[-40pt]{0pt}{100pt}}


    \begin{tabular}{|b{6cm}|m{0.3cm}|m{10.2cm}|}
      \hline
      A\mystrut & B & \multirow{3}{=}{\setlength\parskip{\baselineskip}%
Lorem ipsum dolor sit amet, consectetur
              adipiscing elit. Integer sit amet tincidunt ante,
              suscipit consectetur urna. Maecenas cursus libero
              turpis, fermentum aliquet metus malesuada
              et. Pellentesque auctor tellus nibh, et dignissim urna
              dictum ut. Nam posuere nulla odio, posuere convallis
              massa facilisis sit amet.
\endgraf
    Proin sed nisl tellus. Ut dapibus imperdiet dignissim. Integer
              rhoncus fringilla ipsum, non fringilla ipsum imperdiet
              non. Curabitur nisl felis, imperdiet a vestibulum vel,
              consectetur hendrerit tortor. Etiam metus nisi,
              hendrerit eget metus at, luctus posuere massa. Sed non
              lorem lobortis odio eleifend ultrices quis sed
              arcu. Aenean quam lectus, ornare ut risus ac, rutrum
              mattis}
 \\ \cline{1-2}
    C\mystrut & D & \\ \cline{1-2}
    E\mystrut & F & \\ \hline
    G & H & I \\ \hline
    \end{tabular}
    \end{center}

    \end{document}

答案2

与 OP 的序言相同。诀窍是调整\\[xcm]参数 x 并使用 p{} 进行列指定。

\begin{document}
\begin{center}
\begin{tabular}{|b{6cm}|p{0.3cm}|p{10.2cm}|}    \hline
A & B & \multirow{3}{*}{\parbox[t]{10.2cm}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer sit amet tincidunt ante, suscipit consectetur urna. Maecenas cursus libero turpis, fermentum aliquet metus malesuada et. Pellentesque auctor tellus nibh, et dignissim urna dictum ut. Nam posuere nulla odio, posuere convallis massa facilisis sit amet.}}\\ [2cm]
& &\multirow{3}{*}{\parbox[t][5cm]{10.2cm}{\vspace{0.5cm} Proin sed nisl tellus. Ut dapibus imperdiet dignissim. Integer rhoncus fringilla ipsum, non fringilla ipsum imperdiet non. Curabitur nisl felis, imperdiet a vestibulum vel, consectetur hendrerit tortor. Etiam metus nisi, hendrerit eget metus at, luctus posuere massa. Sed non lorem lobortis odio eleifend ultrices quis sed arcu. Aenean quam lectus, ornare ut risus ac, rutrum mattis.}} \\  \cline{1-2}
C & D & \\ [2cm] \cline{1-2}
E & F & \\  [2cm] \hline
G & H & I \\ \hline
\end{tabular}
\end{center}
\end{document}

在此处输入图片描述

答案3

这也许不是最优雅的解决方案,但它确实有效。对于第二段,我添加了 \\[\baselineskip]。您必须手动调整行高。我认为这是多行的一个普遍问题,至少我不知道有更好的解决方案。

\documentclass[a4paper,12pt]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[spanish]{babel}
\usepackage{amsmath}
\usepackage{amssymb,amsfonts,textcomp}
\usepackage{array}
\usepackage{multirow}
\usepackage{hhline}
\usepackage[left=1.5cm,top=2.5cm,right=2.5cm,bottom=2.5cm]{geometry}
\begin{document}

\begin{center}
\begin{tabular}{|b{6cm}|m{0.3cm}|m{10.2cm}|}
\hline
A & B & \multirow{3}{10.2cm}{\parbox[t]{10.2cm}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer sit amet tincidunt ante, suscipit consectetur urna. 
Maecenas cursus libero turpis, fermentum aliquet metus malesuada et. Pellentesque auctor tellus nibh, et dignissim urna dictum ut. 
Nam posuere nulla odio, posuere convallis massa facilisis sit amet.\\[\baselineskip] 
Proin sed nisl tellus. Ut dapibus imperdiet dignissim. Integer rhoncus fringilla ipsum, non fringilla ipsum imperdiet non. Curabitur nisl felis, 
imperdiet a vestibulum vel, consectetur hendrerit tortor. Etiam metus nisi, hendrerit eget metus at, luctus posuere massa. Sed non lorem lobortis 
odio eleifend ultrices quis sed arcu. Aenean quam lectus, ornare ut risus ac, rutrum mattis.}} \\[4\baselineskip]
\cline{1-2}
C & D & \\[4\baselineskip] 
\cline{1-2}
E & F & \\[4\baselineskip] 
\hline
G & H & I \\\hline
\end{tabular}
\end{center}

\end{document}

相关内容