TZJ
TZJ

Reputation: 159

How to reduce vertical spacing between figures in latex?

I'm trying to remove vertical white spacing between my latex figures but unsuccessfully.

Apologies for how basic this is but I was hoping for some advice on how to do this. I've tried various fixes but they didn't seem to work. My current code looks like this:

\begin{figure}[!htb]
\centering
  \begin{tabular}{@{}cc@{}}
    \includegraphics[trim=0cm 0cm 0cm 0cm,clip=true,width=.50\linewidth]{CHAP-3/FIGS/peak_flux/z010.png} &
    \includegraphics[trim=0cm 0cm 0cm 0cm,clip=true,width=.50\linewidth]{CHAP-3/FIGS/peak_flux/z015.png} \\
    \includegraphics[trim=0cm 0cm 0cm 0cm,clip=true,width=.50\linewidth]{CHAP-3/FIGS/peak_flux/z020.png} &
    \includegraphics[trim=0cm 0cm 0cm 0cm,clip=true,width=.50\linewidth]{CHAP-3/FIGS/peak_flux/z025.png} \\
    \includegraphics[trim=0cm 0cm 0cm 0cm,clip=true,width=.50\linewidth]{CHAP-3/FIGS/peak_flux/z030.png} &
    \includegraphics[trim=0cm 0cm 0cm 0cm,clip=true,width=.50\linewidth]{CHAP-3/FIGS/peak_flux/z035.png} \\
    \fbox{\includegraphics[trim=0cm 0cm 0cm 0cm,clip=true,width=.50\linewidth]{CHAP-3/FIGS/peak_flux/z040.png}} &
    \fbox{\includegraphics[trim=0cm 0cm 0cm 0cm,clip=true,width=.50\linewidth]{CHAP-3/FIGS/peak_flux/z045.png}} \\
  \end{tabular}
\end{figure}

Upvotes: 2

Views: 13512

Answers (1)

Alain Merigot
Alain Merigot

Reputation: 11547

In tabular, you must put @{} anywhere you want to remove normal intercolumn spacing. With \begin{tabular}{@{}cc@{}} you just remove it before your first image and after the second one, which is the opposite of what you want. It should probably be \begin{tabular}{@{}c@{}c@{}} or \begin{tabular}{c@{}c}

To remove interline spacing, you can use \renewcommand{\arraystretch}{0}

\documentclass{article}
\usepackage{graphicx}
\begin{document}
Several copies of Mona Lisa

  \renewcommand{\arraystretch}{0}

\begin{tabular}{|c@{}c@{}c|}
  \hline
  \includegraphics[width=0.3\textwidth]{monalisa.pdf}&%
     \includegraphics[width=0.3\textwidth]{monalisa}&
     \includegraphics[width=0.3\textwidth]{monalisa}\\
  \includegraphics[width=0.3\textwidth]{monalisa.pdf}&%
     \includegraphics[width=0.3\textwidth]{monalisa}&
     \includegraphics[width=0.3\textwidth]{monalisa}\\
  \hline
\end{tabular}

(aka Multa Lisa)
\end{document}

enter image description here

Upvotes: 5

Related Questions