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.

Is there a way that I can insert a small space in a table? When I use a superscript, the number touches the \hline.

\documentclass[9pt,letterpaper]{article}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

\begin{document}
\begin{picture}(0,0)

\put(20,-136){\mbox{    
        \footnotesize   
        \begin{tabular}{ p{8em}  r  r  l }  
        \hline      
                        & Total     & Average   & Unit   \\
        \hline      
        Area1           & 419773    &   9.15        &  \emph{m$^2$}      \\      
        Area2           & 0     &   0       &  \emph{m$^3$}      \\
        \hline  
        \end{tabular}
    }}  

\end{picture}

\end{document}

I tried inserting \vspace but this does not move everything, just one cell.

\vspace{0.001 in} Area1 & \vspace{0.001 in} 419773  &   \vspace{0.001 in} 9.15      & \vspace{0.001 in} \emph{m$^2$} \\

My preference would be to adjust this without an external package, as I am using an old version of LaTeX on a server that I cannot replace.

share|improve this question
possible duplicate of Column padding in tables – Werner Apr 1 '12 at 16:29

5 Answers

up vote 7 down vote accepted

use

\rule{0pt}{4ex}    

in the first column of that line.

share|improve this answer
This does work (thank you). It creates a small offset unless the cell contents are touching the code (no whitespace). – celenius Apr 1 '12 at 16:41

you can load array package then

\setlength\extrarowheight{3pt}

the array package is a required part of the core latex distribution, so will be available on all installations.

share|improve this answer

For a general reference on how to improve the spacing in tabular and array lines, see the article "Correct spacing for tables and arrays" by Claudio Beccari on p. 10 of TeX and TUG News 1993 (Vol. 2, No. 3).

His method, which involves judiciously inserting "struts", applies to lines in tabular (as well as tabular*, supertabular, xtabular, longtable) and array environments which contain

  • superscript material, on a line that's preceded by an \hline,
  • subscript material, on a line that's followed by an \hline, and
  • any other lines with material (including \hlines) above or below them that might result in a cramped look of the output.

He suggested defining a "top strut" and a "bottom strut" as follows:

\newcommand\T{\rule{0pt}{2.6ex}}       % Top strut
\newcommand\B{\rule[-1.2ex]{0pt}{0pt}} % Bottom strut

Using your MWE as a starting point -- by the way, 9pt is not a recognized option in the article document class, so I'm omitting it -- one could put these macros to use as follows:

\documentclass[letterpaper]{article}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

\newcommand\T{\rule{0pt}{2.6ex}}       % Top strut
\newcommand\B{\rule[-1.2ex]{0pt}{0pt}} % Bottom strut

\begin{document}  
\begin{tabular}{ p{8em}  r  r  l }  
\hline      
          & Total     & Average   & Unit \T\B  \\
\hline      
Area 1    & 419773    &   9.15    &  m\textsuperscript{2} \T \\      
Volume 1  & 0         &      0    &  m\textsuperscript{3} \B \\
\hline  
\end{tabular}
\end{document}

enter image description here

share|improve this answer

The simplest solution was given by David Carlisle in How to add vertical space struts after hline?

\hline
\noalign{\vskip 2mm}    

For those who can use the bigstrut package, then just inserting \bigstrut[t] will fix the problem.

\documentclass[letterpaper]{article}
\usepackage{helvet}
\usepackage{bigstrut}
\renewcommand{\familydefault}{\sfdefault}

\begin{document}
\begin{picture}(0,0)

\put(20,-136){\mbox{    
        \footnotesize   
        \begin{tabular}{ p{8em}  r  r  l }  
        \hline      
                        & Total     & Average   & Unit   \\
        \hline      
        Area1           & 419773    &   9.15        &  \emph{m$^2$} \bigstrut[t]     \\  
        Area2           & 0     &   0       &  \emph{m$^3$}      \\
        \hline  
        \end{tabular}
    }}  

\end{picture}

\end{document}
share|improve this answer

fwiw, http://www.tex.ac.uk/cgi-bin/texfaq2html?label=struttab summarises all the above, and mentions a couple of other packages. (apologies for intruding with an obvious pointer.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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