1

In the following MWE (screenshot below) I create two panels of 6 figures (2 rows 3 columns):

Arranging the figures outside of a minipage, I can control the vertical separation with my custom command ``LineSep''

Arranging the figures inside of a minipage, I can't seem to control the vertical separation with my custom command ``LineSep'', it ends up being applied outside the minipage.

I've seen other examples use \vspace*{} inside of minipages so I am not sure how to get this capability back so I can control my figure spacing inside my minipage.

Note: for the purpose of this MWE, tikz functions that overlay the sub figure labels A-F have been removed as the spacing issue persists independently of a custom include graphics function with tikz overlays.

\documentclass{article}

\usepackage{xparse}         % can exclude expl3, xparse loads it
\usepackage{xpatch}         % can exclude etoolbox, xpatch loads it

\usepackage{graphicx}
\usepackage[format=hang,singlelinecheck=0,font={sf,small},labelfont=bf]{subfig}

    %http://tex.stackexchange.com/questions/75014/is-it-possible-to-make-a-reference-to-a-subfigure-to-appear-figure-2a-with-cle
    \captionsetup[subfigure]{subrefformat=simple,labelformat=simple,listofformat=subsimple}
    \renewcommand\thesubfigure{\Alph{subfigure}}

\pagestyle{empty}

\DeclareDocumentCommand{\LineSep}{ O{-0.45} }
{%
    \\\vspace*{-\baselineskip}\vspace*{15 mm}%
}

\begin{document}

\begin{figure}
\begin{center}% 
    \subfloat{\includegraphics[keepaspectratio,width=0.3\textwidth]{example-image-a}}
    \subfloat{\includegraphics[keepaspectratio,width=0.3\textwidth]{example-image-a}}
    \subfloat{\includegraphics[keepaspectratio,width=0.3\textwidth]{example-image-a}}   
\LineSep
    \subfloat{\includegraphics[keepaspectratio,width=0.3\textwidth]{example-image-a}}
    \subfloat{\includegraphics[keepaspectratio,width=0.3\textwidth]{example-image-a}}
    \subfloat{\includegraphics[keepaspectratio,width=0.3\textwidth]{example-image-a}}   

\caption[NO FIGURE LEGEND EXPECTED]{%
\label{fig:2}
General summary statement / figure title:
With a small caption here describing the content of (A) through to (F).
}
\end{center}
\end{figure}

\begin{figure}
\begin{center}% 
\begin{minipage}{0.32\textwidth}
    \subfloat{\includegraphics[keepaspectratio,width=0.99\textwidth]{example-image-a}}
    \LineSep
    \subfloat{\includegraphics[keepaspectratio,width=0.99\textwidth]{example-image-a}}
\end{minipage}\hspace{1 mm}
\begin{minipage}{0.32\textwidth}
    \subfloat{\includegraphics[keepaspectratio,width=0.99\textwidth]{example-image-a}}  
    \LineSep
    \subfloat{\includegraphics[keepaspectratio,width=0.99\textwidth]{example-image-a}}
\end{minipage}\hspace{1 mm}
\begin{minipage}{0.32\textwidth}
    \subfloat{\includegraphics[keepaspectratio,width=0.99\textwidth]{example-image-a}}
    \LineSep
    \subfloat{\includegraphics[keepaspectratio,width=0.99\textwidth]{example-image-a}}  
\end{minipage}


\caption[NO FIGURE LEGEND EXPECTED]{%
\label{fig:1}
General summary statement / figure title:
With a small caption here describing the content of (A) through to (F).
}
\end{center}
\end{figure}


\end{document}

enter image description here

1

Your stacking technique for the \subfloats differ between the two figures. In the first, you're setting them row-wise, while in the second you're setting them column-wise. This brings with it a different location (or time) when \vspace is applied.

As an explination, consider the following elementary/contrived example:

enter image description here

\documentclass{article}

\usepackage{xcolor}
\newcommand{\insertvspace}{%
  \rlap{\color{red}\rule{.4pt}{.7\baselineskip}}% Mark location
  \vspace{\baselineskip}}% Insert \vspace

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
\insertvspace
Fusce placerat dolor nisl, a convallis justo mattis at. 
\insertvspace
In porta ex at ante varius feugiat. Fusce sollicitudin, 
\insertvspace
neque eget lobortis cursus, mi ex porta ante, non condimentum 
\insertvspace
nibh elit sed dui. Cras vestibulum dignissim faucibus. Donec 
\insertvspace
bibendum eros vel massa tristique rutrum. Phasellus nec dapibus nulla.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
Fusce placerat dolor nisl, a convallis justo mattis at. 
In porta ex at ante varius feugiat. Fusce sollicitudin, 
neque eget lobortis cursus, mi ex porta ante, non condimentum 
nibh elit sed dui. Cras vestibulum dignissim faucibus. Donec 
bibendum eros vel massa tristique rutrum. Phasellus nec dapibus nulla.

\end{document}

The first paragraph has a number of \vspaces inserted (and marked). Instinctively one may think that the \vspace will be added to the output exactly where it is placed. However, this is obviously not the case. The \vspaces are accumulated until content is being set in vertical mode. Hence, the double \baselineskip between the last two lines.

Essentially, if you want to control the location/placement of vertical space, you should do it inside vertical mode, otherwise the results may be different from what you intended.


The following might be more in line with what you're intending to achieve:

enter image description here

\documentclass{article}

\usepackage{graphicx,subfig}

\renewcommand\thesubfigure{\Alph{subfigure}}

\newcommand{\LineSep}[1][-0.45]{%
  \vspace*{\dimexpr-\baselineskip+15mm}%
}

\begin{document}

\begin{figure}
  \centering
  \subfloat[\label{sfig:1a}]{\includegraphics[keepaspectratio,width=0.3\textwidth]{example-image-a}}
  \subfloat[]{\includegraphics[keepaspectratio,width=0.3\textwidth]{example-image-b}}
  \subfloat[]{\includegraphics[keepaspectratio,width=0.3\textwidth]{example-image-c}}

  \LineSep

  \subfloat[]{\includegraphics[keepaspectratio,width=0.3\textwidth]{example-image-c}}
  \subfloat[]{\includegraphics[keepaspectratio,width=0.3\textwidth]{example-image-b}}
  \subfloat[\label{sfig:1f}]{\includegraphics[keepaspectratio,width=0.3\textwidth]{example-image-a}}

  \caption[figure title]{%
    General summary statement / figure title:
    With a small caption here describing the content of~\subref{sfig:1a} through to~\subref{sfig:1f}.
  }
\end{figure}

\begin{figure}
  \centering
  \begin{minipage}{0.32\textwidth}
    \subfloat[\label{sfig:2a}]{\includegraphics[keepaspectratio,width=0.99\textwidth]{example-image-a}}

    \LineSep

    \subfloat[]{\includegraphics[keepaspectratio,width=0.99\textwidth]{example-image-c}}
  \end{minipage}\hspace{1mm}%
  \begin{minipage}{0.32\textwidth}
    \subfloat[]{\includegraphics[keepaspectratio,width=0.99\textwidth]{example-image-b}}

    \LineSep

    \subfloat[]{\includegraphics[keepaspectratio,width=0.99\textwidth]{example-image-b}}
  \end{minipage}\hspace{1mm}%
  \begin{minipage}{0.32\textwidth}
    \subfloat[]{\includegraphics[keepaspectratio,width=0.99\textwidth]{example-image-c}}

    \LineSep

    \subfloat[\label{sfig:2f}]{\includegraphics[keepaspectratio,width=0.99\textwidth]{example-image-a}}
  \end{minipage}

  \caption[figure title]{%
  General summary statement / figure title:
  With a small caption here describing the content of~\subref{sfig:2a} through to~\subref{sfig:2f}.
  }
\end{figure}

\end{document}

If you don't like the explicit line breaks around \LineSep, you can use remove it an use the following defition instead:

\newcommand{\LineSep}[1][-0.45]{%
  \par\vspace*{\dimexpr-\baselineskip+15mm}%
}
1

When \vspace is used inside a paragraph, the vertical space is added after the end of the line it is in. As you precede the \vspace with \\, it is inside a paragraph. So replace the \\ with \par.

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.