0

How can I get two pictures perfectly align alongside. My code is given below.

\begin{figure}[t!]
\centering
\begin{minipage}{3.3cm}
    \centering
    \subtop[]{\includegraphics[height=0.25\textheight]{figa/ParameterSpace}\label{figa}}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}{3.3cm}
    \centering
    \subtop[]{\includegraphics[height=0.25\textheight]{figa/StringMotion}\label{figb}}
\end{minipage}
\mycaption[Motion of open string in spacetime.]{%
  (a) Parameter space for open strings.
  (b) Open string worlsheet in target space.}
\label{figA}
\end{figure}

enter image description here

2
  • from your code snippet follows that your equation should be aligned as you wish. to say more, we should see complete small document beginning with \documentclass{...} preamble with to image related packages and end with \end{document}. welcome to tex.se!
    – Zarko
    Dec 27, 2017 at 18:55
  • Does changing \begin{minipage}{3.3cm} to \begin{minipage}[t]{3.3cm} help? And why do you squeeze the pictures in minipages of fixed width? (No wonder that the pictures overlap.)
    – user121799
    Dec 27, 2017 at 19:17

1 Answer 1

1

Your approach of putting the sub-figures inside minipages is the problem here. The blocks created by the minipages are too narrow for the images to fit, so they overlap. Drop the use of minipages entirely:

enter image description here

\documentclass{memoir}

\usepackage{graphicx}

\newsubfloat{figure}

\begin{document}

\chapter{A chapter}

\begin{figure}[!ht]
  \centering
%  \begin{minipage}{3.3cm}
%    \centering
    \subtop[]{\includegraphics[height=0.2\textheight]{example-image-a}}
%  \end{minipage}
  \hspace{0.5cm}
%  \begin{minipage}{3.3cm}
%    \centering
    \subtop[]{\includegraphics[height=0.2\textheight]{example-image-b}}
%  \end{minipage}
  \caption[Motion of open string in spacetime.]{%
    (a) Parameter space for open strings.
    (b) Open string worlsheet in target space.}
\end{figure}

\end{document}

Not the answer you're looking for? Browse other questions tagged .