1

I'm not getting column borders correctly in the following table. I'm using multirow package. Also, I want the '123' in the big cell to be centered, but it is misaligned. I'm not sure how to fix this. Here's what I have:

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

Note that I have no multiple column cells in the table -- only multiple row cells.

4
  • 3
    If you write \multirow{-2} instead of \multirow{-3}, it's correct. The problem with the borders is what? The missing \hline above the first row? Just write it.
    – Bernard
    Commented Oct 5, 2014 at 0:42
  • Thanks. No, not the missing \hline. I'm missing the all of the vertical lines separating the columns except for the leftmost one.
    – bozidarka
    Commented Oct 5, 2014 at 1:20
  • 2
    I don't miss them. Could you provide a minimal (non)working example?
    – Bernard
    Commented Oct 5, 2014 at 1:24
  • 1
    How to make a minimal working example (MWE).
    – cfr
    Commented Oct 5, 2014 at 2:19

2 Answers 2

2

If I understand you correctly, you like to achieve something like this:

enter image description here

For it I just correct errors in your MWE: \hline before tabular, number of rows in 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}

Preview package in preamble I added just to show table alone.

0

For information, here is a way to create that table with {NiceTabular} of nicematrix.

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\begin{NiceTabular}{ccc}[hvlines]
1 & 2                & 3 \\
1 & \Block{2-1}{123} & 3 \\
1 &                  & 3
\end{NiceTabular}

\end{document}

Output of the above code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .