多行:缺少列邊框

多行:缺少列邊框

我在下表中沒有正確獲得列邊框。我正在使用multirow包。另外,我希望大單元格中的“123”居中,但它未對齊。我不知道如何解決這個問題。這是我所擁有的:

    \begin{table} 
    \centering
      \hline
      \begin{tabular}{|c|c|c|} 
      1 & 2 & 3& \\ \hline
      1 & & 3 &\\  \cline{1-1}\cline{3-3}
      1 & \multirow{-3}{*}{123} & 3& \\ \hline
    \end{tabular} 
    \end{table}

請注意,我的表中沒有多個列單元格——只有多個行單元格。

答案1

如果我理解正確的話,你希望實現這樣的目標:

在此輸入影像描述

為此,我只是更正了 MWE 中的錯誤:\hline在表格之前,行數multirow

\documentclass[11pt]{article}
\usepackage{multirow}

\usepackage[active,floats,tightpage]{preview}
\setlength\PreviewBorder{1em}

\begin{document}
    \begin{table}\centering
      \begin{tabular}{|c|c|c|}
      \hline
      1 & 2 & 3     \\      \hline
      1 &   & 3     \\      \cline{1-1}\cline{3-3}
      1 & \multirow{-2}{*}{123}
            & 3     \\      \hline
    \end{tabular}
    \end{table}
\end{document}

我在序言中添加的預覽包只是為了單獨顯示表格。

相關內容