1

I try to achieve a table that resembles the one given in this link.

Here is my code, and the result of running the code:

\begin{tabular}{l|l|l|}
\cline{2-3}
& \multicolumn{2}{l|}{Inner Rings} &  \multicolumn{4}{l|}{Outer Rings} \\
\cline{2-3} 
& 2.2668  & 1.2866 \\
& 2.5329  & 1.3195 \\
& 2.7484  & 1.3742 \\
& 2.6992  & 1.3403 \\ 
& 2.6338  & 1.3657 \\

\multicolumn{1}{|l|}{Average and uncertainty}
\end{tabular}

enter image description here

What I desire to have is three columns, the first column being blank until you reach the row containing "Average and uncertainty";
for the second column, I would like "Outer Rings" to be above 2.2668, 2.5329, etc.;
and for the third column, I would like "Inner Rings" to be above 1.2866, 1.3195, etc.

How might I achieve this? I have tried many things.

2
  • The first argument of multicolumn is the quantity of columns it spans. So the sum of all those columns in one row must be the same as stated behind \egin{tabular}{<quantity>}. Furthermore, you specified 3 columns, but i just see two.
    – Johannes_B
    Dec 12, 2013 at 14:03
  • You get at least one compilation error with that code.
    – egreg
    Dec 12, 2013 at 14:32

3 Answers 3

1

Or rather something like this, using siuntix and booktabs.

enter image description here

\documentclass{article}
\usepackage{siunitx}
\usepackage{booktabs}

\begin{document}
\begin{tabular}{
    S[table-format=1.4]
    S[table-format=1.4]
}
    \toprule
    {Outer Rings} &{Inner Rings} \\
    \midrule
    2.2668  & 1.2866 \\
    2.5329  & 1.3195 \\
    2.7484  & 1.3742 \\
    2.6992  & 1.3403 \\ 
    2.6338  & 1.3657 \\
    \cmidrule(lr){1-2}
    2.576+-.19 & 1.337+-0.04 \\
    \bottomrule
\end{tabular}
\end{document}

But it's really hard to tell what you really want. I didn't go for all those vertical lines, since they distract the reader. Think of the tables in all the articles you are reading. More information on how to typeset nice tables can be found in the documentation of booktabs.

2
  • With S[table-format=1.4] the alignment would be better.
    – egreg
    Dec 12, 2013 at 14:33
  • @egreg You are right. and since i don't like uncertainty to take up su much space, i left that part out.
    – Johannes_B
    Dec 12, 2013 at 14:49
1

Like this?

\documentclass{article}
\begin{document}
\begin{tabular}{l|l|l|}
\cline{2-3}
& Inner Rings &  Outer Rings \\
\cline{2-3}
& 2.2668  & 1.2866 \\
& 2.5329  & 1.3195 \\
& 2.7484  & 1.3742 \\
& 2.6992  & 1.3403 \\
& 2.6338  & 1.3657 \\

Average and uncertainty &&
\end{tabular}
\end{document}

enter image description here

2
  • The OP probably would want the last lines to be \cline{1-3} \multicolumn{1}{|l|}{Average and uncertainty}, considering the examples he linked to. Dec 12, 2013 at 14:08
  • So, it was unnecessary to use \multicolumn ?
    – Mack
    Dec 12, 2013 at 14:32
0

Why do you use multicolumn here, when you are not writing over multiple columns? You can can remove all the multicolumn related code (except for the one at the end, which introduces the | at the beginning of the line) and the table looks like you described in your text.

This would result in the following code:

\documentclass{article}
\begin{document}
\begin{tabular}{l|l|l|}
\cline{2-3}
&{Inner Rings} &  {Outer Rings} \\
\cline{2-3}
& 2.2668  & 1.2866 \\
& 2.5329  & 1.3195 \\
& 2.7484  & 1.3742 \\
& 2.6992  & 1.3403 \\
& 2.6338  & 1.3657 \\
\cline{1-3}
\multicolumn{1}{|l|}{Average and uncertainty}
\end{tabular}
\end{document} 
1
  • Yes, there was one \cline{1-3} too much. I edited my code.
    – Chris
    Dec 12, 2013 at 16:01

You must log in to answer this question.

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