Graphics, Figures & Tableslarge list of figures (problem with spaces)

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
o3hq
Posts: 3
Joined: Sun Nov 14, 2010 6:51 pm

large list of figures (problem with spaces)

Post by o3hq »

Hello!
I have to make a list of galaxies. I did like that:

Code: Select all

\begin{figure}[h]
\begin{center}$
\begin{array}{cccc}
\includegraphics[width=1.5in]{ngc5068} &
\includegraphics[width=1.5in]{ngc5091} &
\includegraphics[width=1.5in]{ngc5921} &
\includegraphics[width=1.5in]{ngc6154}
\end{array}$
\caption{NGC5068, NGC5091, NGC5921, NGC6154}
\end{center}
\end{figure}

\begin{figure}[h]
\begin{center}$
\begin{array}{cccc}
\includegraphics[width=1.5in]{ngc7479} &
\includegraphics[width=1.5in]{Tadpole_Galaxy} &
\includegraphics[width=1.5in]{Tadpole_Galaxy} &
\includegraphics[width=1.5in]{Tadpole_Galaxy}
\end{array}$
\caption{NGC7479, Tadpole Galaxy}
\end{center}
\end{figure}
etc.

The resulting pdf was ok in the first page, but I had a problem with the rest, because of a problem with spaces (since I know I haven't explained well, I uploaded the file here http://viewer.zoho.com/docs/pRLsd)
does someone know how to solve this problem or a better way to do lists of images?
thank you very much!

Lena

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
meho_r
Posts: 823
Joined: Tue Aug 07, 2007 5:28 pm

large list of figures (problem with spaces)

Post by meho_r »

Please, read Board Rules. You should always construct a complete Minimal Working Example (MWE), not just snippets of code. Beside that, you should also include all files directly here, outside links aren't allowed.

As for your question, in cases like this one, I would probably use minipage environment instead of floats, and \captionof command provided by caption package for captions. Here's a quick example:

Code: Select all

\documentclass{article}

\usepackage{caption}

\usepackage[demo]{graphicx}% remove “demo” option to use real images

\newcommand{\figspace}{\hspace{8pt}}% custom spacing between figures
\newcommand{\mpspace}{\vspace{4pt}}% custom spacing between minipages

\begin{document}

Some text\ldots

\mpspace
\noindent%
\begin{minipage}{\textwidth}\centering
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}
\captionof{figure}{Galaxy A}
\end{minipage}
\mpspace

\mpspace
\noindent%
\begin{minipage}{\textwidth}\centering
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}
\captionof{figure}{Galaxy B}
\end{minipage}
\mpspace

\mpspace
\noindent%
\begin{minipage}{\textwidth}\centering
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}
\captionof{figure}{Galaxy C}
\end{minipage}
\mpspace

\mpspace
\noindent%
\begin{minipage}{\textwidth}\centering
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}
\captionof{figure}{Galaxy D}
\end{minipage}
\mpspace

\mpspace
\noindent%
\begin{minipage}{\textwidth}\centering
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}
\captionof{figure}{Galaxy E}
\end{minipage}
\mpspace

\mpspace
\noindent%
\begin{minipage}{\textwidth}\centering
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}
\captionof{figure}{Galaxy F}
\end{minipage}
\mpspace

\mpspace
\noindent%
\begin{minipage}{\textwidth}\centering
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}
\captionof{figure}{Galaxy G}
\end{minipage}
\mpspace

\mpspace
\noindent%
\begin{minipage}{\textwidth}\centering
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}
\captionof{figure}{Galaxy H}
\end{minipage}
\mpspace

\mpspace
\noindent%
\begin{minipage}{\textwidth}\centering
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}\figspace
\includegraphics[width=1in]{image_name}
\captionof{figure}{Galaxy I}
\end{minipage}
\mpspace

\end{document}
I used custom commands for spacing between figures and between minipages because it's easier to change one command than to do corrections in all places. You may also define a new command to set minipage width (e.g. \newcommand{\mpwidth}{12cm}) and use that command instead of \textwidth.
Post Reply