1

I have the following table:

\begin{table}[h!]
\centering
\begin{tabular}{ccccccccc}
\toprule
 & \multirow{2}{*}{\textbf{ID}} & $\mathbf{T^x_{EO}}$ & $\mathbf{T^y_{EO}}$ & $\mathbf{T^z_{EO}}$ & $\mathbf{R^x_{EO}}$ & $\mathbf{R^y_{EO}}$ & $\mathbf{R^z_{EO}}$ & \textbf{RMS} \\
 & & [m] & [m] & [m] & [deg] & [deg] & [deg] & [px] \\
\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{P\textit{n}P-LM}} & A & 2.748 & -0.135 & 2.175 & 119.232 & 1.368 & -76.261 & 0.240 \\
& B & 2.690  & 0.768  & 2.128 & 124.905 & -1.972 & -91.559 & 0.247 \\
& C & -1.576 & 1.139  & 2.146 & 120.264 & 1.428  & 98.205  & 0.255 \\
& D & -1.575 & -0.122 & 2.165 & 119.634 & -0.818 & 85.313  & 0.231 \\\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{EP\textit{n}P}}& A & 2.722 & -0.161 & 2.345 & 121.639 & 1.828 & -75.974 & 0.463 \\
& B & 2.649  & 0.729  & 2.259 & 127.082 & -0.881 & -91.444 & 0.432 \\
& C & -1.565 & 1.148  & 2.246 & 121.639 & 1.250  & 98.377  & 0.389 \\
& D & -1.547 & -0.077 & 2.238 & 120.951 & 0.199  & 85.428  & 0.372 \\\bottomrule
\end{tabular}
\end{table}

I want to add a vectical line that covers [A-D] on the right side of EPnP and PnP-LM. If I do {c|cccccccc} it creates a vertical line also in the header which I dont want.

1
  • you seem to be using booktabs as well, so vertical lines will not look pretty as they won't touch the \midrule. however, if you need to remove them on some cells, just put \multicolumn{1}{}{} in them.
    – ArTourter
    Commented Dec 9, 2015 at 12:22

2 Answers 2

2

An alternative to ArTourter answer, considering his/her comment (by which I agree) with emphasis on formatting numbers in table. For this I added two packages: siunitx (fur numbers formatting) and stackengine (for setting of column heads):

\documentclass[border=3mm]{standalone}
    \usepackage{graphicx}
    \usepackage{booktabs,multirow}
    \usepackage{siunitx}
    \usepackage{stackengine}

    \begin{document}
\begin{tabular}{cc*{2}{S[table-format=-1.3]}
                       S[table-format= 1.3]
                       S
                       S[table-format=-1.3]
                       S[table-format= 3.3]
                       S[table-format= 1.3]}
    \toprule
%\multicolumn{1}{c}{}% in case, if you prefer to have vertical line after first column ...
    &   {\textbf{ID}} 
        &   {\stackon{[m]}{$\mathbf{T^{x\vphantom{y}}_{EO}}$}}
            &   {\stackon{[m]}{$\mathbf{T^y_{EO}}$}}
                &   {\stackon{[m]}{$\mathbf{T^{z\vphantom{y}}_{EO}}$}}
                    &   {\stackon{[deg]}{$\mathbf{R^{x\vphantom{y}}_{EO}}$}}
                        &   {\stackon{[deg]}{$\mathbf{R^y_{EO}}$}}
                            &   {\stackon{[deg]}{$\mathbf{R^{z\vphantom{y}}_{EO}}$}}
                                &   {\stackon{[px]}{\textbf{RMS}\vphantom{y}}}   \\
    \midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{P\textit{n}P-LM}}
    & A & 2.748  & -0.135 & 2.175 & 119.232 & 1.368  & -76.261 & 0.240  \\
    & B & 2.690  & 0.768  & 2.128 & 124.905 & -1.972 & -91.559 & 0.247  \\
    & C & -1.576 & 1.139  & 2.146 & 120.264 & 1.428  & 98.205  & 0.255  \\
    & D & -1.575 & -0.122 & 2.165 & 119.634 & -0.818 & 85.313  & 0.231  \\
    \midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{EP\textit{n}P}}
    & A & 2.722  & -0.161 & 2.345 & 121.639 & 1.828  & -75.974 & 0.463  \\
    & B & 2.649  & 0.729  & 2.259 & 127.082 & -0.881 & -91.444 & 0.432  \\
    & C & -1.565 & 1.148  & 2.246 & 121.639 & 1.250  & 98.377  & 0.389  \\
    & D & -1.547 & -0.077 & 2.238 & 120.951 & 0.199  & 85.428  & 0.372  \\
    \bottomrule
\end{tabular}
    \end{document}

enter image description here

1

You seem to be using the booktabs package as you are using \toprule, \midrule and \bottomrule. These command add some space above and below the line. Therefore if you also use vertical lines in your table, they will not touch the horizontal lines, which may not look as good.

That being said, you can remove a vertical line defined in the table header on a cell to cell basis using \multicolumn.

\multicolumn take 3 arguments:

  1. number of column merged (in your case 1)
  2. style of the cell in the same format as you have in the header and will remove any already defined.
  3. the content of the column

so for your case, if you define your table as you tried with {c|cccccccc}, you can add \multicolumn{1}{c}{} in the cell you do not want the vertical bar to appear:

\documentclass{standalone}

\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{booktabs,multirow}

\begin{document}

\begin{tabular}{c|cccccccc}
\toprule
\multicolumn{1}{c}{} & \multirow{2}{*}{\textbf{ID}} & $\mathbf{T^x_{EO}}$ & $\mathbf{T^y_{EO}}$ & $\mathbf{T^z_{EO}}$ & $\mathbf{R^x_{EO}}$ & $\mathbf{R^y_{EO}}$ & $\mathbf{R^z_{EO}}$ & \textbf{RMS} \\
\multicolumn{1}{c}{} & & [m] & [m] & [m] & [deg] & [deg] & [deg] & [px] \\
\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{P\textit{n}P-LM}} & A & 2.748 & -0.135 & 2.175 & 119.232 & 1.368 & -76.261 & 0.240 \\
& B & 2.690  & 0.768  & 2.128 & 124.905 & -1.972 & -91.559 & 0.247 \\
& C & -1.576 & 1.139  & 2.146 & 120.264 & 1.428  & 98.205  & 0.255 \\
& D & -1.575 & -0.122 & 2.165 & 119.634 & -0.818 & 85.313  & 0.231 \\
\midrule
\multirow{4}{*}{\rotatebox[origin=c]{90}{EP\textit{n}P}}& A & 2.722 & -0.161 & 2.345 & 121.639 & 1.828 & -75.974 & 0.463 \\
& B & 2.649  & 0.729  & 2.259 & 127.082 & -0.881 & -91.444 & 0.432 \\
& C & -1.565 & 1.148  & 2.246 & 121.639 & 1.250  & 98.377  & 0.389 \\
& D & -1.547 & -0.077 & 2.238 & 120.951 & 0.199  & 85.428  & 0.372 \\
\bottomrule
\end{tabular}

\end{document}

Which gives you this.

enter image description here

I still think this is unnecessary and the original table looked better but...

1
  • You are right. But if I dont visualize it first I cant decide.
    – Kostas
    Commented Dec 9, 2015 at 13:52

You must log in to answer this question.

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