Take the 2-minute tour ×
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.

So I've made a block of figures using the subcaption package. It contains 5 images and follows the following layout:

\begin{figure}[t]
        \begin{subfigure}[t]{0.3\textwidth}
                \includegraphics[width=\textwidth]
                {1.pdf}
                \caption{$1$}
                \label{fig:1}
        \end{subfigure}
        ~
        \begin{subfigure}[t]{0.3\textwidth}
                \includegraphics[width=\textwidth]
                {2.pdf}
                \caption{$2$}
                \label{fig:2}
        \end{subfigure}
        ~
        \begin{subfigure}[t]{0.3\textwidth}
                \includegraphics[width=\textwidth]
                {3.pdf}
                \caption{$3$}
                \label{fig:3}
        \end{subfigure}
        ~
        \begin{subfigure}[t]{0.3\textwidth}
                \includegraphics[width=\textwidth]
                {4.pdf}
                \caption{$4$}
                \label{fig:4}
        \end{subfigure}
        ~
        \begin{subfigure}[t]{0.3\textwidth}
                \includegraphics[width=\textwidth]
                {5.pdf}
                \caption{$5$}
                \label{fig:5}
        \end{subfigure}
        ~  

        \caption{Plots of numbers.}
        \label{fig:numbers} 

\end{figure}

My question is: what should I do with the whitespace? I thought of either putting the figure caption there, or centering the last two images so the whitespace is symmetrical. However I don't how to do any of the two. For the latter, I tried inserting an extra ~ before the fourth image but it didn't work-nothing happened.

share|improve this question
    
welcome to tex.sx but please always try to post complete documents so they can be run locally (otherwise we can not see the spaces you are talking about) or upload a screenshot of your result (use the upload button but remove the ! as you do not have enough rep yet, but someone will put the ! back so including the image. Probably you want to use \hfill rather than ` ~ ` so the 3 figures on each line are flush left centre and flush right. If you do that and set \parfillskip to zero the last two would spread out. –  David Carlisle Feb 20 '13 at 20:41
add comment

1 Answer

up vote 3 down vote accepted

enter image description here

Please always post complete documents (I had to ask in chat which package you were using as my guess of subfigure proved wrong).

The image shows two layouts: the second one from the code as posted to get the first just simply use \hfill in all cases not the blank line and \hfil construct.

\documentclass{article}

\usepackage{subcaption}

\usepackage[demo]{graphicx}

\begin{document}

\begin{figure}[t]
\centering
        \begin{subfigure}[t]{0.3\textwidth}
                \includegraphics[width=\textwidth]
                {1.pdf}
                \caption{$1$}
                \label{fig:1}
        \end{subfigure}%
        \hfill
        \begin{subfigure}[t]{0.3\textwidth}
                \includegraphics[width=\textwidth]
                {2.pdf}
                \caption{$2$}
                \label{fig:2}
        \end{subfigure}%
        \hfill
        \begin{subfigure}[t]{0.3\textwidth}
                \includegraphics[width=\textwidth]
                {3.pdf}
                \caption{$3$}
                \label{fig:3}
        \end{subfigure}%

        \mbox{}\hfil%
        \begin{subfigure}[t]{0.3\textwidth}
                \includegraphics[width=\textwidth]
                {4.pdf}
                \caption{$4$}
                \label{fig:4}
        \end{subfigure}%
        \hfil
        \begin{subfigure}[t]{0.3\textwidth}
                \includegraphics[width=\textwidth]
                {5.pdf}
                \caption{$5$}
                \label{fig:5}
        \end{subfigure}


        \caption{Plots of numbers.}
        \label{fig:numbers} 

\end{figure}

\end{document}
share|improve this answer
    
Thanks very much, I'll be sure to post complete docs in the future. –  Bracket Feb 21 '13 at 20:39
add comment

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.