7

Possible Duplicate:
Column padding in tables

I want to make a table where one column heading has superscript which overlaps with hline above it. How can I increase the height of just that row so that it does not overlap? I tried commands such as \arraystretch, but this increases the whole table which then looks odd in the document. The exact code is copied below (MWE).

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{table}[htbp]
\caption{Some values}
\begin{center}
{
 %\renewcommand{\arraystretch}{1.35}
\begin{tabular}{|c|c|c||c|c|c|}
\hline
& \multicolumn{2}{c||}{L2 Unit} &  \multicolumn{3}{c|}{SUB} \\ \cline{2-6} 
 Unit & $E^{\text{Dyn}}_{\text{L2}}$&  $P^{\text{SUP}}_{\text{L2}}$ &  Number  &$E^{\text{Dyn}}_{\text{SUB}}$ &$P^{\text{SUP}}_{\text{SUB}}$ \\
Size & (unit) & (unit) &  ($N$) &(unit) & (unit) \\\hline
4MB& 0.289& 1.39 &2 & .005 &.006\\\hline
\end{tabular}
}
\end{center}
\end{table}
\end{document}
8

You can use a \rule of zero width and the desired height; however, I would like to suggest you the use of the booktabs package to build your tables (this implies giving up on vertical rules, but the result is much better). Below an example with and without booktabs:

\documentclass{article}
\usepackage{amsmath}
\usepackage{booktabs}

\begin{document}

\begin{table}[htbp]
\caption{Some values}
\centering
\begin{tabular}{@{}*{6}{c}@{}}
\toprule
& \multicolumn{2}{c}{L2 Unit} & \multicolumn{3}{c}{SUB} \\ 
\cmidrule(r){2-3}\cmidrule(l){4-6} 
Unit & $E^{\text{Dyn}}_{\text{L2}}$ &  $P^{\text{SUP}}_{\text{L2}}$ 
  & Number & $E^{\text{Dyn}}_{\text{SUB}}$ & $P^{\text{SUP}}_{\text{SUB}}$ \\
Size & (unit) & (unit) & ($N$) &(unit) & (unit) \\
\cmidrule(r){1-1}\cmidrule(lr){2-2}\cmidrule(lr){3-3}
\cmidrule(lr){4-4}\cmidrule(lr){5-5}\cmidrule(l){6-6}
4MB & 0.289 & 1.39 & 2 & .005 & .006\\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[htbp]
\caption{Some values}
\centering
\begin{tabular}{|c|c|c||c|c|c|}
\hline
& \multicolumn{2}{c||}{L2 Unit} &  \multicolumn{3}{c|}{SUB} \\ \cline{2-6} 
\rule{0pt}{14pt}Unit & $E^{\text{Dyn}}_{\text{L2}}$&  $P^{\text{SUP}}_{\text{L2}}$ &  Number  &$E^{\text{Dyn}}_{\text{SUB}}$ &$P^{\text{SUP}}_{\text{SUB}}$ \\
Size & (unit) & (unit) &  ($N$) &(unit) & (unit) \\\hline
4MB& 0.289& 1.39 &2 & .005 &.006\\\hline
\end{tabular}
\end{table}

\end{document}

enter image description here

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.