Graphics, Figures & Tablessubfig package - Customize distance between two pictures

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
L1011
Posts: 2
Joined: Tue Jul 20, 2010 12:23 pm

subfig package - Customize distance between two pictures

Post by L1011 »

Hi everyone!

I am new on the forum and here is my first post.

I am using the subfig package to display two pictures one aside the other with the following code:

Code: Select all

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{figure}[H]
  \begin{center}
    \subfloat[FIGURE 1.]{\includegraphics{FIG1.jpg}}
    \subfloat[FIGURE2]{\includegraphics{FIG2.jpg}}
  \end{center}
\end{figure}
					
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The above code works but I would like to customize the horizontal distance between the two figures, indeed, with that code, the figures are always 'stick' together.

If you have any idea...

Thank you in advance!

L1011

Recommended reading 2024:

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

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

php1ic
Posts: 192
Joined: Wed Jan 28, 2009 8:17 pm

subfig package - Customize distance between two pictures

Post by php1ic »

Hi L1011,

Don't post random bits of code, take a look at this post and read about creating MWE.
http://www.latex-community.org/forum/vi ... =37&t=7878

For your problem, you can use 'normal' horizontal spacing commands. eg to force the figures as far apart as possible use \hfill

Code: Select all

\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}
\begin{document}
\begin{figure}[H]
  \begin{center}
    \subfloat[FIGURE 1.]{\includegraphics{FIG1.jpg}}\hfill
    \subfloat[FIGURE2]{\includegraphics{FIG2.jpg}}
  \end{center}
\end{figure}
\end{document}
L1011
Posts: 2
Joined: Tue Jul 20, 2010 12:23 pm

Re: subfig package - Customize distance between two pictures

Post by L1011 »

Thank you php1ic for your answer! It works just fine.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

subfig package - Customize distance between two pictures

Post by localghost »

Now that the problem is solved, please mark the topic as accordingly as described in Section 3 of the Board Rules.


Best regards
Thorsten
Post Reply