Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

marked as duplicate by Werner, percusse, lockstep, cgnieder, Claudio Fiandrino Sep 7 '12 at 15:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 5 down vote accepted

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

share|improve this answer
Very valuable help. Thanks. – user984260 Sep 5 '12 at 22:45

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