1

Is it possible to totally suppress all bottom padding of a cell in the tabular environment?

Edit 2: As @Joseph Wright points out in the comments, I had stray linefeeds that were introducing extra space. So @gernot's answer is correct.

Edit: I've tried the answers, but they don't always work. For exampple:

\documentclass[10pt]{article}

\usepackage{array}
\usepackage{hyphenat}
\usepackage{geometry}
\geometry{a4paper, portrait, margin=2.5cm}
\usepackage{enumitem}
\setlist{nosep}

\pagenumbering{gobble}

\newenvironment{resume}[1]
    {
        \noindent{\LARGE {\bf {#1}}} \\
        \noindent\makebox[\linewidth]{\rule{\textwidth}{0.2pt}}
        \vspace{-0.2cm} \\
    }
    {   
    }

\newcommand{\rsectionbegin}[1]{
        \renewcommand\arraystretch{0}
        \setbox\strutbox=\hbox{}
        \noindent\begin{tabular}{@{}p{3cm}p{12.5cm}}
        \noindent{\uppercase \nohyphens{#1}}
        &
    }
\newcommand{\rsectionend}{
        \end{tabular}
%       \\
    }

\newcommand{\rwherebegin}[2]{
        {\bf #1}, {#2} \par     
    }
\newcommand{\rwhereend}{
        \vspace{0.25cm}
    }

\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\newcommand{\rrole}[2]{
        \vspace{0.15cm}
        \begin{tabular}[t]{@{}p{9cm}R{3.05cm}}
        {\em {#1}} & {\bf {#2}}
        \end{tabular}
    }

\newcommand{\rwhat}[1]{
    {#1} \par
    }

\newcommand{\rskills}[1]{
    ({#1}) \par
    }

\newenvironment{ritemize}
    {
        \begin{itemize}[leftmargin=0.2cm]
    }
    {
        \end{itemize}
    }

\begin{document}
\begin{resume}{L}
\rsectionbegin{A}
\rwherebegin{A}{A}
\rrole{A}{A}
\begin{ritemize}
\item[] A
\item[] A
\end{ritemize}
\rrole{A}{A}
\rwhereend
\rsectionend
\rsectionbegin{X}
Y
\rsectionend

\end{resume}

\end{document}

This still leaves space between Y and the preceding text. Should I be using a different environment or package altogether?

  • 3
    A MWE showing what is the problem would be nice. – Denis Dec 16 '16 at 13:07
  • I don't need a solution to a particular problem. – the.punisher Dec 16 '16 at 13:10
  • 4
    The question is pretty unclear in its current state. Please elaborate. – Johannes_B Dec 16 '16 at 13:22
  • I want to ensure that there is no space between the lower edge of each cell and the lower edge of the content. – the.punisher Dec 16 '16 at 13:30
  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Martin Schröder Dec 16 '16 at 14:05
5

Given an ordinary tabular environment, you can set \arraystretch to 0 to eliminate the distance between cells. Adding space using the \\ command ends up above an \hline (if present), i.e., it looks like space at the bottom of the cell. However, you can add struts.

enter image description here

\documentclass{article}
\parindent0em
\parskip1ex
\begin{document}

Setting \verb"\arraystretch" to 0.

\renewcommand\arraystretch{0}
\begin{tabular}{c}
  A\\B\\C\\D\\E
\end{tabular}

Adding distance between rows using \verb"\\[...]" appears to end up
again below the cell.

\begin{tabular}[t]{c}
  A\\
  B\\[1ex]
  C\\[3ex]
  D\\
  E
\end{tabular}
\qquad
\begin{tabular}[t]{c}
  A\\\hline
  B\\[1ex]\hline
  C\\[3ex]\hline
  D\\\hline
  E
\end{tabular}

But we can insert an invisible rule that extends from the base line
upwards.

\newcommand\spaceabove[1]{\rule{0em}{#1}}
\begin{tabular}[t]{c}
  A\\\hline
  B\\\hline
  \spaceabove{3ex}%
  C\\\hline
  \spaceabove{5ex}%
  D\\\hline
  E
\end{tabular}
\qquad
\begin{tabular}[t]{c}
  A\\\hline
  B\\\hline
  \spaceabove{3ex}%
  C\\\hline
  \spaceabove{5ex}%
  D\\\hline
  E
\end{tabular}
\end{document}
| improve this answer | |
  • Setting \arraystretch doesn't suppress all spacing. See edits to question. – the.punisher Dec 17 '16 at 1:16
3

The LaTeX tabular construct inserts material at the start of cells to make sure they have a minimum height: this is set by the \strutbox. You can set that to an empty box to suppress this

\documentclass{article}
\begin{document}
\setlength\fboxsep{0pt}%
\setbox\strutbox=\hbox{}
\fbox{%
  \begin{tabular}{@{}c@{}}
  \fbox{a}
  \end{tabular}%
}
\end{document}

although it's there to avoid different rows having different heights!

| improve this answer | |

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.