[Tex/LaTex] Latex table with Multirow

multicolmultirowtables

I've been struggling with this for a while.

1.) I want the 2.5 and 97.5 to appear distinctly from the "Percentile" label but still in the same cell.

2.) I want the 2.5 to appear centered around the "P" in "Percentile and I want the 97.5 to appear centered around the last e in "percentile"

3.) the 0.05 and 0.57 should appear directly below the 2.5 and 97.5 respectively (in their new positions)

Baz

\usepackage{multirow}

\begin{tabular}{l|cc}
\hline
\multicolumn{3}{c}{Steepener Sharpe Ratio Estimation Results} \\
\cline{1-3}
\multicolumn{1}{c|}{\multirow{2}{*}{Estimate} }  &  \multicolumn{2}{c}{\multirow{2}{*}{Percentile}} \\
\multicolumn{1}{c|}{} &  \multicolumn{1}{c}{2.5} &  \multicolumn{1}{c}{97.5} \\
\cline{2-3} 
TNA & 0.05 & 0.57 \\
\hline
\end{tabular}

Best Answer

I suggest you take the following steps:

  • Use a table environment, with a \caption that's distinct from the tabular material itself. The caption can be placed either above or below the tabular material. In the example below I use \caption* -- a macro provided by the caption package -- to create an unnumbered table float. (If you want a "regular", i.e., numbered table float, use \caption instead of \caption*.)

  • Use the line-drawing commands of the booktabs package to get well-spaced horizontal lines.

  • Don't use vertical lines -- they merely add visual clutter. (If you don't believe me, try to create a few tables for yourself, first with vertical lines and then without. Ask yourself critically if any of the vertical lines in any of your tables truly add visual clarity.)

The following screenshot shows both your current table as well as the one I suggest.

enter image description here

\documentclass{article}
\usepackage{multirow}          % for old code
\usepackage{booktabs,caption}  % for new code
\begin{document}

before:
\begin{center}
\begin{tabular}{l|cc}
\hline
\multicolumn{3}{c}{Steepener Sharpe Ratio Estimation Results} \\
\cline{1-3}
\multicolumn{1}{c|}{\multirow{2}{*}{Estimate} }  &  \multicolumn{2}{c}{\multirow{2}{*}{Percentile}} \\
\multicolumn{1}{c|}{} &  \multicolumn{1}{c}{2.5} &  \multicolumn{1}{c}{97.5} \\
\cline{2-3} 
TNA & 0.05 & 0.57 \\
\hline
\end{tabular}
\end{center}

\bigskip
new:
\begin{table}[h!] % "[h!]" location specifier just for this example
\caption*{Steepener Sharpe Ratio Estimation Results}
\centering
\begin{tabular}{lcc}
\toprule
Estimate & \multicolumn{2}{c}{Percentile} \\
\cmidrule{2-3}
& 2.5 & 97.5 \\
\midrule
TNA & 0.05 & 0.57 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
Related Question