\multirow - 长名字破坏/破坏布局

\multirow - 长名字破坏/破坏布局

当我使用这个tabular环境时,不知为何倒数第二行变得乱糟糟的。有人能告诉我如何解决这个问题吗?

\documentclass[11pt, a4paper, fleqn, parskip]{scrartcl}

\usepackage[utf8x]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{mathtools, amssymb}
\usepackage{a4wide}
\usepackage{multirow}

\begin{document}
\begin{tabular}{|c|c|} \hline
    $[a, b] := \{x \in \mathbb{R}: a \leq x \leq b\}$ & kompaktes Intervall \\ \hline
    $(a, b) := \{x \in \mathbb{R}: a < x < b\}$ & offenes, beschr"anktes Intervall \\ \hline
    $[a, b) := \{x \in \mathbb{R}: a \leq x < b\}$ & \multirow{2}{*}{halboffenes, beschr"anktes Intervall} \\
    $(a, b] := \{x \in \mathbb{R}: a < x \leq b\}$ \\ \hline
    $[a, \infty) := \{x \in \mathbb{R}: a \leq x\}$ \\ \multirow{2}{*}{abgeschlossenes, unbeschr"anktes Intervall} \\
    $(-\infty, b] := \{x \in \mathbb{R}: x \leq b\}$ \\ \hline
    $(a, \infty) := \{x \in \mathbb{R}: a < x\}$ & \multirow{2}{*}{offenes, unbeschr"anktes Intervall} \\
    $(-\infty, b) := \{x \in \mathbb{R}: x < b\}$ \\ \hline
\end{tabular}
\end{document}

答案1

您遗漏了包含命令的行下方的一些ampersands ( ) :&multirow

\documentclass[11pt, a4paper, fleqn, parskip]{scrartcl}

\usepackage[utf8x]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{mathtools, amssymb}
\usepackage{a4wide}
\usepackage{multirow}

\begin{document}
\begin{tabular}{|c|c|} \hline
    $[a, b] := \{x \in \mathbb{R}: a \leq x \leq b\}$ & kompaktes Intervall \\ \hline
    $(a, b) := \{x \in \mathbb{R}: a < x < b\}$ & offenes, beschr"anktes Intervall \\ \hline
    $[a, b) := \{x \in \mathbb{R}: a \leq x < b\}$ & \multirow{2}{*}{halboffenes, beschr"anktes Intervall} \\
    $(a, b] := \{x \in \mathbb{R}: a < x \leq b\}$ & \\ \hline  %%<<<here
    $[a, \infty) := \{x \in \mathbb{R}: a \leq x\}$ & \multirow{2}{*}{abgeschlossenes, unbeschr"anktes Intervall}  \\
    $(-\infty, b] := \{x \in \mathbb{R}: x \leq b\}$ & \\ \hline %%<<< here
    $(a, \infty) := \{x \in \mathbb{R}: a < x\}$ & \multirow{2}{*}{offenes, unbeschr"anktes Intervall} \\
    $(-\infty, b) := \{x \in \mathbb{R}: x < b\}$ & \\ \hline %%%<<<<<here
\end{tabular}
\end{document}

在此处输入图片描述

答案2

您的表格中有一些错误,导致表格看起来很糟糕。我建议您始终像我一样在同一列中写“&”符号。这样,您会更容易发现表格中缺少“&”符号。不要忘记为表格写上所有必要的内容&,即使后面有一个空单元格。

软件包a4wide已过期,请勿继续使用。请参阅l2tabu.pdftexdoc l2tabu)了解更多信息。

您将获得线条更好看的表格,查看包装booktabs及其手册(texdoc booktabs)。

更正并漂亮地打印的 MWE:

%http://tex.stackexchange.com/questions/83415/multirow-long-name-breaking-ruining-layout
\documentclass[11pt, a4paper, fleqn, parskip]{scrartcl}

\usepackage[utf8]{inputenc}  % original: utf8x
\usepackage[ngerman]{babel}
\usepackage{mathtools, amssymb}
%\usepackage{a4wide}         % outdated, see l2tabu.pdf
\usepackage{multirow}

\begin{document}
\begin{tabular}{|c|c|} \hline
  $[a, b] := \{x \in \mathbb{R}: a \leq x \leq b\}$ & kompaktes Intervall              \\ \hline
  $(a, b) := \{x \in \mathbb{R}: a < x < b\}$       & offenes, beschränktes Intervall  \\ \hline
  $[a, b) := \{x \in \mathbb{R}: a \leq x < b\}$    & \multirow{2}{*}{halboffenes, beschränktes Intervall} \\
  $(a, b] := \{x \in \mathbb{R}: a < x \leq b\}$    &                                  \\ \hline
  $[a, \infty) := \{x \in \mathbb{R}: a \leq x\}$   & \multirow{2}{*}{abgeschlossenes, unbeschränktes Intervall} \\
  $(-\infty, b] := \{x \in \mathbb{R}: x \leq b\}$  &                                  \\ \hline
  $(a, \infty) := \{x \in \mathbb{R}: a < x\}$      & \multirow{2}{*}{offenes, unbeschränktes Intervall} \\
  $(-\infty, b) := \{x \in \mathbb{R}: x < b\}$     &                                  \\ \hline
\end{tabular}
\end{document}

相关内容