2

I would like to insert a double \hline below the caption in my table. The caption is positioned at the top of my table. MWE is below. The %\hline \hline line is where I would like the double \hline to be.

\documentclass{article}
\begin{document}

\begin{table}
\caption{Title}
%\hline \hline 
\begin{tabular}{lc}
Column heading & More column heading
\hline
Data & More data
\end{tabular}
\end{table}

\end{document}
3

One option is to use the caption package to define a ruled style (adjust the settings to suit):

\documentclass{article}
\usepackage{caption}

\DeclareCaptionFormat{ruled}{
  #1#2#3\par\vspace{-.65\baselineskip}\hrulefill\par\vspace{-.83\baselineskip}\hrulefill}
\captionsetup[table]{format=ruled}

\begin{document}

\begin{table}
\centering
\caption{Title}
\begin{tabular}{lc}
Stuff & More stuff 
\end{tabular}
\end{table}

\end{document}

enter image description here

However, if your table begins with a horizontal rule, this might look odd.

If the double rules should be part of the tabular material, you can use for example booktabs and its rule commands to define the double rule (in an example below I used \specialrule to illustrate some control on the spacing requested in comment):

\documentclass{article}
\usepackage{caption}
\usepackage{booktabs}

\newcommand\doubleRule{\toprule\toprule}
\newcommand\doublerule{\toprule\specialrule{\heavyrulewidth}{\doublerulesep}{0.95em}}

\begin{document}

\begin{table}
\centering
\caption{A test table}
\begin{tabular}{l r}
\doubleRule
Header1 & Header2 \\
\midrule
Column1a & Column 2a \\
Column1a & Column 2a \\
\bottomrule
\end{tabular}
\end{table}

\captionsetup{skip=2pt}
\begin{table}
\centering
\caption{A test table}
\begin{tabular}{l r}
\doublerule
Header1 & Header2 \\
\midrule
Column1a & Column 2a \\
Column1a & Column 2a \\
\bottomrule
\end{tabular}
\end{table}

\end{document} 

enter image description here

  • I extended my MWE to be a more complete example of the kind of tables I would like to make. Does your suggestion work in this case? – NeutronStar Aug 31 '15 at 20:19
  • @Joshua Of course. I have a doubt now, however: are the two rules supossed to be part of the tabular material or are they supossed to be part of the caption? – Gonzalo Medina Aug 31 '15 at 20:25
  • It doesn't matter to me, as long as they span the entire width of the table. I would prefer them to be closer to the caption than the tabular (like you have above). – NeutronStar Aug 31 '15 at 21:51
  • @Joshua Please see my updated answer. Is is something like that what you have in mind? – Gonzalo Medina Aug 31 '15 at 22:23
0

After examining Gonzalo Medina's excellent answer, I realized there was a simple mistake I was making that prevented the double \hline from working. I needed to move it into the tabular environment

\documentclass{article}
\begin{document}

\begin{table}
\caption{Title}
\begin{tabular}{lc}  %These two lines are switched
\hline \hline        %These two lines are switched
Column heading & More column heading
\hline
Data & More data
\end{tabular}
\end{table}

\end{document}

The above code works just fine, and it only requires swapping two lines from the code of my original question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.