Graphics, Figures & Tablessubfloat question

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
danielsameold
Posts: 2
Joined: Sun May 10, 2015 10:24 pm

subfloat question

Post by danielsameold »

Hello dear community.

I am new to Latex and I was told they do not use subfigures anymore.

I am using subfloat, two figures on top of each other. The problem is that the lettering (a), (b) does not go to the center of the figures, instead it goes to the left. This is my first question.

The second is that how do I ensure that the vertical or horizontal length of the figures themselves are equal?

Below is my code:

Code: Select all

\begin{figure}
	\centering
	\subfloat[]{\label{Fig2a}}{\includegraphics[scale=0.5]{Fig4}}
	\subfloat[]{\label{Fig2b}}{\includegraphics[scale=0.5]{Fig3}}
	\caption{Pictures of animals}
	\label{fig:animals}
\end{figure}
THANK YOU VERY MUCH IN ADVANCE
Attachments
Output
Output
Capture.JPG (63.28 KiB) Viewed 9737 times

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

rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

subfloat question

Post by rais »

danielsameold wrote: I am new to Latex and I was told they do not use subfigures anymore.
The subfigure package was superceded by the subfig package about ten years ago, yes. For some time now, there's an alternate called subcaption, that provides its own version of a subfigure environment. Such subfigures you can still use...
danielsameold wrote: I am using subfloat, two figures on top of each other. The problem is that the lettering (a), (b) does not go to the center of the figures, instead it goes to the left. This is my first question.
I haven't really used the subfig package---if that is, what you're using---for quite some time now, so it may be possible with that package as well.
danielsameold wrote: The second is that how do I ensure that the vertical or horizontal length of the figures themselves are equal?
By giving them the same height or width, respectively.
See `texdoc grfguide' and look up the options for \includegraphics

Code: Select all

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}
  \centering
  \begin{subfigure}{0.7\linewidth}
    \centering
    \includegraphics[width=\linewidth]{Fig4}
    \caption{}
    \label{Fig2a}
  \end{subfigure}\par
  \medskip
  \begin{subfigure}{0.7\linewidth}
    \centering
    \includegraphics[width=\linewidth]{Fig3}
    \caption{}
    \label{Fig2b}
  \end{subfigure}
  \caption{Pictures of animals}
  \label{fig:animals}
\end{figure}
\end{document}
KR
Rainer
danielsameold
Posts: 2
Joined: Sun May 10, 2015 10:24 pm

Re: subfloat question

Post by danielsameold »

Thank you very much for your reply. I will look into that package.
Post Reply