Graphics, Figures & TablesSide by Side Figures overlapping

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Aleksustheone
Posts: 3
Joined: Wed Jul 25, 2012 9:42 pm

Side by Side Figures overlapping

Post by Aleksustheone »

Hi,

I have two figures (see attachments), that I want to place together at the same level. This is a code I am using:

Code: Select all

\begin{figure}[!h]
\begin{center} 
\includegraphics[width=40mm]{Chap3/s11_smith.eps}
\hspace{5mm}
\includegraphics[width=40mm]{Chap3/sopt_smith.eps} \newline%
(a) \hspace{60mm} (b)
\end{center} 
\begin{quote} 
\caption[$\Gamma_{opt}$ and $\Gamma_{in}$ of 4 $\times$10 $\mu$m transistor for different degeneration inductances]{(a) $\Gamma_{in}$ and (b)$\Gamma_{opt}$ of 4 $\times$10 $\mu$m transistor for different degeneration inductance stubs.
\label{fig:SoptS11}} %
\end{quote} %
\end{figure}
For some reasons after compilation in PS (and PDF) files these figures are overlapped (see attachment), despite the fact, that EPS files are cropped by their borders. Can you assist me with that thing?

Thanks
Attachments
overlap.png
overlap.png (29.32 KiB) Viewed 15230 times
sopt_smith.eps
(338.61 KiB) Downloaded 412 times
s11_smith.eps
(338.66 KiB) Downloaded 397 times

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

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

Side by Side Figures overlapping

Post by localghost »

In order to get quick and good answers you should always provide a minimal example that is compilable out of the box for everybody. People are rarely motivated to do that themselves (unlike me in this case, but this is only an exception here).

What you are trying to achieve can be done much easier by the inclusion of some specialized packages.
  • caption for customization of captions (including margins to make them not fill the complete text width)
  • subcaption (from the caption bundle) for arrangement of sub-floats in float environments
It is absolutely not necessary to put a caption into a {quote} environment. And using the \centering command is preferable over the {center} environment to avoid unwanted vertical space.

Incorporated into a full example this looks like the below code.

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{caption}
\usepackage[font=footnotesize]{subcaption}
\usepackage{graphicx}
\usepackage{siunitx}

%% Setup for captions.
%% For details see package manual.
\captionsetup{
  font=small,          % Select font size
  labelfont=bf,        % Select appearance of label
  margin=3em,          % Margin, left and right
  tableposition=top    % Formatting for captions above tables
}

\begin{document}
  \begin{figure}[!ht]
    \begin{subfigure}[b]{0.45\linewidth}
      \includegraphics[width=\linewidth]{s11_smith}
      \caption{$\Gamma_{in}$}
      \label{subfig-1:smith}
    \end{subfigure}
    \hfill
    \begin{subfigure}[b]{0.45\linewidth}
      \includegraphics[width=\linewidth]{sopt_smith}
      \caption{$\Gamma_{opt}$}
      \label{subfig-2:smith}
    \end{subfigure}
    \caption{$\Gamma_{in}$ and $\Gamma_{opt}$ of \SI{4e10}{\micro\m} transistor for different degeneration inductances}
    \label{fig:smith}
  \end{figure}
\end{document}
In order to make this compilable with PDFLaTeX, I have (manually) converted the EPS images to PDF by epstopdf. Due to a possibly flawed bounding box the resulting PDF images had to be cropped by the pdfcrop Perl script (see attachments).

The siunitx package is not part of the solution. It has only been used to format the physical unit inside the caption.

For a deeper understanding of the involved packages, their purpose and their capabilities, please refer to the respective manuals.


Best regards and welcome to the board
Thorsten
Attachments
The resulting output.
The resulting output.
smith-sub-figures.png (34.61 KiB) Viewed 15225 times
s11_smith.pdf
The PDF image (converted and cropped).
(36.25 KiB) Downloaded 311 times
sopt_smith.pdf
The PDF image (converted and cropped).
(36.24 KiB) Downloaded 281 times
Aleksustheone
Posts: 3
Joined: Wed Jul 25, 2012 9:42 pm

Re: Side by Side Figures overlapping

Post by Aleksustheone »

Thank you very much!
I will try your solution right now!
Post Reply