Graphics, Figures & TablesCaption Alignment for Sub-figures

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
magical marshmallow
Posts: 30
Joined: Mon Jan 21, 2013 11:37 am

Caption Alignment for Sub-figures

Post by magical marshmallow »

Hey,

I have three images in a line across a page which I have inserted using the {minipage} environment.

Code: Select all

\begin{figure}[H]
  \hspace{-2cm}
  \centering
  \begin{minipage}[c]{.23\textwidth}
    \centering
    \includegraphics[scale=0.2]{Images/Chapter_6/fortafix_30_45_11l-min.png}
    \subcaption{Water circulated at 11 litres per minute}
    \label{fig: fortafix 11l-min}
  \end{minipage}
  \hspace{1.5cm}
  \begin{minipage}[c]{.23\textwidth}
    \centering
    \includegraphics[scale=0.2]{Images/Chapter_6/fortafix_30_45_9l-min.png}
    \subcaption{Water circulated at 9 litres per minute}
    \label{fig: fortafix 9l-min}
  \end{minipage}
  \hspace{1.5cm}
  \begin{minipage}[c]{.23\textwidth}
    \centering
    \includegraphics[scale=0.2]{Images/Chapter_6/fortafix_30_45_6l-min.png}
    \subcaption{Water circulated at 6 litres per minute}
    \label{fig: fortafix 6l-min}
  \end{minipage}
  \caption{Plate mould cooling with Fortafix flexseal 350 gap filler layer}
  \label{fig: plate cooling fortafix traces}
\end{figure}
I cannot get the \subcaptions to line up properly. I have tried using a preceding \hspace{}, but this just moves the images vertically. Has anyone come across this before?

Cheers
Last edited by localghost on Tue Jun 11, 2013 4:49 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Caption Alignment for Sub-figures

Post by localghost »

For an adequate problem description kindly prepare a self-contained and minimal example to prevent others from guesswork, random shots and speculations regarding your document setup.


Thorsten
magical marshmallow
Posts: 30
Joined: Mon Jan 21, 2013 11:37 am

Caption Alignment for Sub-figures

Post by magical marshmallow »

I hope this is sufficient as an MWE
The effect of including the \hspace{} command is shown in the attached image. For some reason this increases the gap between the image and the subcaption.

Code: Select all

 \documentclass[11pt,a4paper]{scrreprt}
 \usepackage{caption}
 \usepackage{subcaption}
 \usepackahe{float}
 \begin{document}

 \begin{figure}[H]
  \hspace{-2cm}
  \centering
  \begin{minipage}[c]{.23\textwidth}
    \centering
    \includegraphics[scale=0.2]{Images/Chapter_6/fortafix_30_45_11l-min.png}
    \subcaption{Water circulated at 11 litres per minute}
    \label{fig: fortafix 11l-min}
  \end{minipage}
  \hspace{1.5cm}
  \begin{minipage}[c]{.23\textwidth}
    \centering
    \includegraphics[scale=0.2]{Images/Chapter_6/fortafix_30_45_9l-min.png}
    \subcaption{Water circulated at 9 litres per minute}
    \label{fig: fortafix 9l-min}
  \end{minipage}
  \hspace{1.5cm}
  \begin{minipage}[c]{.23\textwidth}
    \centering
    \includegraphics[scale=0.2]{Images/Chapter_6/fortafix_30_45_6l-min.png}
    \hspace{1cm}\subcaption{Water circulated at 6 litres per minute}
    \label{fig: fortafix 6l-min}
  \end{minipage}
  \caption{Plate mould cooling with Fortafix flexseal 350 gap filler layer}
  \label{fig: plate cooling fortafix traces}
\end{figure}
\end{document}
Basically I want to bump the subcaptions across so that (a) is directly underneath the Y-axis of the image for example.
Attachments
minipage_subcaption_problem.png
minipage_subcaption_problem.png (20.72 KiB) Viewed 26711 times
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Caption Alignment for Sub-figures

Post by localghost »

magical marshmallow wrote:I hope this is sufficient as an MWE […]
You didn't follow the links in my last reply. Otherwise you would know that this is not a proper example because it is not self-contained.
  • It is not compilable because the graphicx package is missing.
  • The external graphics files are missing.
So try again. But next time check your example for functionality on other machines in order not to waste more time. You can ensure this by using the stuff provided by the mwe package (sample images, …) and try to reproduce the problem therewith.
magical marshmallow
Posts: 30
Joined: Mon Jan 21, 2013 11:37 am

Caption Alignment for Sub-figures

Post by magical marshmallow »

The effect of including the \hspace{} command is shown in the attached image. For some reason this increases the gap between the image and the subcaption.

Code: Select all

 \documentclass[11pt,a4paper]{scrreprt}
 \usepackage{caption}
 \usepackage{subcaption}
 \usepackage{float}
 \usepackage{graphicx}
 \begin{document}

 \begin{figure}[H]
  \hspace{-2cm}
  \centering
  \begin{minipage}[c]{.23\textwidth}
    \centering
    \includegraphics[scale=0.2]{fortafix_30_45_11l-min.png}
    \subcaption{Water circulated at 11 litres per minute}
    \label{fig: fortafix 11l-min}
  \end{minipage}
  \hspace{1.5cm}
  \begin{minipage}[c]{.23\textwidth}
    \centering
    \includegraphics[scale=0.2]{fortafix_30_45_9l-min.png}
    \subcaption{Water circulated at 9 litres per minute}
    \label{fig: fortafix 9l-min}
  \end{minipage}
  \hspace{1.5cm}
  \begin{minipage}[c]{.23\textwidth}
    \centering
    \includegraphics[scale=0.2]{fortafix_30_45_6l-min.png}
    \hspace{1cm}\subcaption{Water circulated at 6 litres per minute}
    \label{fig: fortafix 6l-min}
  \end{minipage}
  \caption{Plate mould cooling with Fortafix flexseal 350 gap filler layer}
  \label{fig: plate cooling fortafix traces}
\end{figure}
\end{document}
Basically I want to bump the subcaptions across so that (a) is directly underneath the Y-axis of the image for example.
Attachments
Image 3
Image 3
fortafix_30_45_11l-min.png (45.45 KiB) Viewed 26693 times
Image 2
Image 2
fortafix_30_45_9l-min.png (47.35 KiB) Viewed 26693 times
Image 1
Image 1
fortafix_30_45_6l-min.png (47.33 KiB) Viewed 26693 times
Basically I want to shift the subcaptions to the right
Basically I want to shift the subcaptions to the right
minipage_subcaption_problem.png (20.72 KiB) Viewed 26698 times
Last edited by cgnieder on Wed Jun 12, 2013 10:42 am, edited 1 time in total.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Caption Alignment for Sub-figures

Post by Johannes_B »

Why do you work with all those \hspace commands?

Have a look at my example, I also used the siunitx package.

Code: Select all

\documentclass{scrreprt}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{float}
\usepackage{graphicx}
\usepackage{siunitx}

\begin{document}
  \begin{figure}[H]
    \centering
    \begin{minipage}[c]{.3\textwidth}
      \includegraphics[width=\linewidth]{fortafix_30_45_11-min}
      \subcaption{Water circulated at \SI{11}{\litre\per\minute}}
      \label{fig: fortafix 11l-min}
    \end{minipage}
    \hfill
    \begin{minipage}[c]{.3\textwidth}
      \includegraphics[width=\linewidth]{fortafix_30_45_9l-min}
      \subcaption{Water circulated at 9 litres per minute}
      \label{fig: fortafix 9l-min}
    \end{minipage}
    \hfill
    \begin{minipage}[c]{.3\textwidth}
      \includegraphics[width=\linewidth]{fortafix_30_45_6l-min}
      \subcaption{Water circulated at 6 litres per minute}
      \label{fig: fortafix 6l-min}
    \end{minipage}
    \caption{Plate mould cooling with Fortafix flexseal 350 gap filler layer}
    \label{fig: plate cooling fortafix traces}
  \end{figure}
\end{document}
Either way, the graphics seem to be too small for my taste.
The option H in conjunction with the float package should not be used. If you don't want the figures to float, don't use a floating environment.


At the OP or any Mod: Please, can someone make those pics smaller or attach them to the forum server? This line may be deleted afterwards.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply