0

How would one go about making a fancy table like this one? By this I mean the line elements that begin in some column and end in another, as well as text in one cell that seems to overlap multiple cells below its row.

enter image description here

  • 4
    Use the booktabs package. Please provide a minimal working example to get further (code) help. – TeXnician Aug 30 '17 at 16:17
  • For text spanning multiple columns, use the \multicolumn command. For rules spanning one or several columns, use the \cmidrule command provided by the booktabs package. – Michael Palmer Aug 30 '17 at 16:28
  • 1
    You will also want to reformat the caption (caption package). – John Kormylo Aug 30 '17 at 16:30
3

Two simple things.

  • Use booktabs, it would give you \toprule, etc.
  • For partial rulers there is a \cmidrule.

Here is a production example.

\begin{table*}
\centering
\caption[Comparison of execution times]{Comparison of execution times.
%  \newline
% We state time in
% hours:minutes:seconds.
  \textbf{Bold} font denotes best time,
  parameters in \emph{italic} designate the configuration we used for
  evaluation in
  Sections~\ref{sec:comp-vcbm}--\ref{sec:quantitative}.
  % 
  \newline
  \enquote{Scale}  denotes the minimal key point size. An asterisk
  (\textasteriskcentered) marks execution times specially discussed in
  Section~\ref{sec:execution-times}. In these cases phase contrast of
  unstained cells generates too many small features.}  
\label{tab:times}
\let\tabsepbakup\tabcolsep
\setlength{\tabcolsep}{2.8pt}
\begin{tabular}{lcc  lccc  r}
\toprule
\multicolumn{3}{c}{Specimen} & \multicolumn{4}{c}{Registration} &
\multicolumn{1}{c}{\multirow{2}{*}{Time}} 
%\multicolumn{1}{c}{Time}
\\
% rules!
\cmidrule(r{\tabcolsep}){1-3} \cmidrule(l{\tabcolsep}){4-7} % \cmidrule(r){8-8} % time is multirow
%
\multicolumn{1}{c}{Name} & Side & Slices &
\multicolumn{1}{c}{Method} & Multi-resolution? 
& Levels & \multicolumn{1}{c}{Scale} & 
\multicolumn{1}{c}{\tiny (hh:mm:ss)} \\
\midrule
\multirow{4}{3.6cm}{Single-stained spleen (Figs.~\ref{fig:specimens-single},
\ref{fig:one-milz-volume}, Chapter~\ref{cha:follikel})} & \multirow{4}{*}    {8000} &
\multirow{4}{*}{24} &
Chapter~\ref{cha:vcbm14} & no & -- & 100 & 0:21:11 \\
& & & \cite{elastix} & yes & 4 & -- & 01:01:05 \\
& & & \multirow{2}{*}{our method} & \multirow{2}{*}{yes}
 & 2 & 50 & \textbf{0:12:06} \\ % (100, 50)
&&& & & \emph{4} & \emph{10} & 0:49:20 \\
%&&& &
\midrule
\multirow{5}{3.6cm}{Double-stained spleen (Figs.~\ref{fig:specimens-double},
 \ref{fig:double-milz-other}\olcomment{, Chapter~\ref{cha:sheaths}})} &         \multirow{5}{*}{5032} &
\multirow{5}{*}{24} &
Chapter~\ref{cha:vcbm14} & no & -- & 100 & 0:18:31 \\
& & & \cite{elastix} & yes & 4 &--& 0:23:12 \\
%& & & ours & yes
& & & \multirow{3}{*}{our method} & \multirow{3}{*}{yes} & 
%\multirow{2}{*}{2} &
2 &
%% trying to adapt by increasing minimal feature size, from 100,20 to
%% 100,50:
50 & \textbf{0:18:09} \\ % @ 100, 50
&&&&& 2 & 20 & 04:03:14\hangright{\textsuperscript{\textasteriskcentered}} \\         % @ 100,20
% & & & our method & yes
&&&&& \emph{4} & \emph{10} &     14:40:14\hangright{\textsuperscript{\textasteriskcentered}} \\
\midrule
\multirow{5}{3.6cm}{Bone marrow (Figs.~\ref{fig:specimens-km},
   \ref{fig:km-z}, Chapter~\ref{cha:km})} & \multirow{5}{*}{4032} &     \multirow{5}{*}{30} &
Chapter~\ref{cha:vcbm14} & no & -- &100& 0:12:55 \\
& & & \cite{elastix} & yes & 4 &--& 0:17:43 \\
& & & \multirow{3}{*}{our method} & \multirow{3}{*}{yes} 
   & 2 &50& \textbf{0:07:07} \\ 
% ^^^ this is (100, 50)
& & &  &  & \emph{2} &\emph{20}& 0:13:00 \\
% ^^^ this is (100, 20)
& & &  &  & \emph{4} &\emph{10}& 0:44:42 \\
\bottomrule
\end{tabular}
\setlength\tabcolsep\tabsepbakup
\end{table*}

enter image description here

PS: Commentaries on the layout and typesetting are welcome.

PPS: I see, I omitted \hangright, it is not crucial for understanding or something, but still, here it is:

%%% hack for hanging footnotes in the table
\newcommand{\hangleft}[1]{\makebox[0pt][r]{#1}}
\newcommand{\hangright}[1]{\makebox[0pt][l]{#1}}

PPPS: For formatting numbers siunitx provides some new column styles.

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.