0

I have a table where the first vertical line is longer than the rest. This whole table was a rushjob so I might have missed something obvious.

I suspect this has something to do with my use of multirow but I haven't been able to resolve the issue. I have tried using the solutions from Too long vertical lines in table but nothing seems to work. Does anyone have a good clue about what might be causing this and what I can do to fix it?

Code:

\begin{table}[th]
\centering
    \captionsetup{justification=centering}
    \caption{Table showing the Bp length of primer set 1, 2 and 3 after restriction cutting with HindIII.}
    \begin{tabular}{c|c|c}
    Set \textnumero & Calculations & \textbf{Bp} \\
    \hline
    \multirow{4}{*}{Set 1} & \footnotesize{$R-\text{Res}+1$} & \multirow{2}{*}{$512$}\\
     & $23642-23131+1$ & \\
    \cline{2-3}
     & \footnotesize{$\text{Res}-F$} & \multirow{2}{*}{$4049$}\\
     & $23131-19082$ & \\
    \hline
    \multirow{6}{*}{Set 2}& \footnotesize{$R-\text{Res}_2+1$} & \multirow{2}{*}{$2185$} \\
     & $27342-25158+1$ & \\
    \cline{2-3}
     & \footnotesize{$\text{Res}_2-\text{Res}_1$} & \multirow{2}{*}{$2027$} \\
     & $25158-23131$ & \\
    \cline{2-3}
     & \footnotesize{$\text{Res}-F$} & \multirow{2}{*}{$146$}\\
     & $23131-22985$ & \\
    \hline
    \multirow{8}{*}{Set 3} & \footnotesize{$R-\text{Res}_3+1$} & \multirow{2}{*}{$2465$} \\
     & $40049-37585+1$ & \\
    \cline{2-3}
     & \footnotesize{$\text{Res}_3-\text{Res}_2$} & \multirow{2}{*}{$125$} \\
     & $37585-37460$ & \\
    \cline{2-3}
     & \footnotesize{$\text{Res}_2-\text{Res}_1$} & \multirow{2}{*}{$564$} \\
     & $37460-36896$ & \\
    \cline{2-3}
     & \footnotesize{$\text{Res}-F$} & \multirow{2}{*}{$1442$}\\
     & $36896-35454$ & \\
    \label{bp:HindIII}
    \end{tabular}
\end{table}

When compiled:

Table

The left vertical line stretches a bit further than the right.

JamesT
  • 3,169
Teodor
  • 1
  • 1
    Welcome to TeX:SE! In last row of table you have \label{bp:HindIII}˙which should not be inside table. Move it immediately after\caption{...}`! – Zarko Oct 07 '22 at 13:17

2 Answers2

2

Let me convert my comment to an answer:

  • In last row of table you have \label{bp:HindIII} which should not be inside tabular. Move it immediately after \caption{...}
  • Code for your table can be shorter with use tabularray package:
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{amsmath, booktabs}
\DeclareMathOperator{\Res}{Res}
\usepackage{caption}
    \captionsetup{justification=centerlast}

\begin{document} \begin{table}[ht] \centering \caption{Table showing the Bp length of primer set 1, 2 and 3 after restriction cutting with HindIII.} \label{bp:HindIII} \begin{tblr}{colspec={c|Q[c,mode=math]|Q[c,mode=math]}, row{1} = {mode=text, c}, cell{even}{2} = {font=\footnotesize, c}, } Set \textnumero & Calculations & \textbf{Bp} \ \midrule \SetCell[r=4]{c} Set 1 & R-\Res+1 & \SetCell[r=2]{c} 512 \ & 23642-23131+1 & \ \midrule & \Res-F & \SetCell[r=2]{c} 4049 \ & 23131-19082 & \ \midrule \SetCell[r=6]{c} Set 2 & R-\Res_2+1 & \SetCell[r=2]{c} 2185 \ & 27342-25158+1 & \ \midrule & \Res_2-\Res_1 & \SetCell[r=2]{c} 2027 \ & 25158-23131 & \ \midrule & \Res-F & \SetCell[r=2]{c} 146 \ & 23131-22985 & \ \midrule \SetCell[r=8]{c} Set 3 & R-\Res_3+1 & \SetCell[r=2]{c} 2465 \ & 40049-37585+1 & \ \midrule & \Res_3-\Res_2 & \SetCell[r=2]{c} 125 \ & 37585-37460 & \ \midrule & \Res_2-\Res_1 & \SetCell[r=2]{c} 564 \ & 37460-36896 & \ \midrule & \Res-F & \SetCell[r=2]{c} 1442 \ & 36896-35454 & \ \end{tblr} \end{table} \end{document}

enter image description here

Edit: A bit more sophisticated version of the above MWE with even shorter table code producing nicer (to my opinion) table form (as exercise for use of the tabularray package):

  • reduced vertical space after even rows
  • drawing of the horizontal lines are defined in document and table preamble
  • considered is two column document
\documentclass[twocolumn]{article}

\usepackage{tabularray} \usepackage{amsmath} \DeclareMathOperator{\Res}{Res} \usepackage[font=small, labelfont=bf, justification=centerlast ]{caption}

\begin{document} \begin{table}[ht] \centering \caption{Table showing the Bp length of primer set 1, 2 and 3 after restriction cutting with HindIII.} \label{bp:HindIII} \begin{tblr}{colspec= {c | Q[c,mode=math] | r}, row{1} = {mode=text, c}, cell{even}{2} = {font=\footnotesize, c}, cell{even}{3} = {r=2}{ }, row{even} = {belowsep=-2pt}, hline{even[1-X]} = {0.25pt}, } Set \textnumero
& Calculations & \textbf{Bp} \ \SetCell[r=4]{c} Set 1 & R - \Res + 1 & 512 \ & 23642 - 23131 + 1 & \ & \Res-F & 4049 \ & 23131-19082 & \ \SetCell[r=6]{c} Set 2 & R-\Res_2+1 & 2185 \ & 27342-25158+1 & \ & \Res_2-\Res_1 & 2027 \ & 25158-23131 & \ & \Res-F & 146 \ & 23131-22985 & \ \SetCell[r=8]{c} Set 3 & R-\Res_3+1 & 2465 \ & 40049-37585+1 & \ & \Res_3-\Res_2 & 125 \ & 37585-37460 & \ & \Res_2-\Res_1 & 564 \ & 37460-36896 & \
& \Res-F & 1442 \ & 36896-35454 & \ \end{tblr} \end{table} \end{document}

enter image description here

Zarko
  • 296,517
1

You can avoid the problem if you don't use \\ to start a new (empty) row at the end:

\documentclass{article}

\usepackage{multirow} \usepackage{caption} \usepackage{amsmath}

\begin{document}

\begin{table}[th] \centering \captionsetup{justification=centering} \caption{Table showing the Bp length of primer set 1, 2 and 3 after restriction cutting with HindIII.} \begin{tabular}{c|c|c} Set \textnumero & Calculations & \textbf{Bp} \ \hline \multirow{4}{}{Set 1} & \footnotesize{$R-\text{Res}+1$} & \multirow{2}{}{$512$}\ & $23642-23131+1$ & \ \cline{2-3} & \footnotesize{$\text{Res}-F$} & \multirow{2}{}{$4049$}\ & $23131-19082$ & \ \hline \multirow{6}{}{Set 2}& \footnotesize{$R-\text{Res}_2+1$} & \multirow{2}{}{$2185$} \ & $27342-25158+1$ & \ \cline{2-3} & \footnotesize{$\text{Res}_2-\text{Res}_1$} & \multirow{2}{}{$2027$} \ & $25158-23131$ & \ \cline{2-3} & \footnotesize{$\text{Res}-F$} & \multirow{2}{}{$146$}\ & $23131-22985$ & \ \hline \multirow{8}{}{Set 3} & \footnotesize{$R-\text{Res}_3+1$} & \multirow{2}{}{$2465$} \ & $40049-37585+1$ & \ \cline{2-3} & \footnotesize{$\text{Res}_3-\text{Res}_2$} & \multirow{2}{}{$125$} \ & $37585-37460$ & \ \cline{2-3} & \footnotesize{$\text{Res}_2-\text{Res}_1$} & \multirow{2}{}{$564$} \ & $37460-36896$ & \ \cline{2-3} & \footnotesize{$\text{Res}-F$} & \multirow{2}{}{$1442$}\ & $36896-35454$ & \label{bp:HindIII} \end{tabular} \end{table}

\end{document}

enter image description here