4

I have 2 figures identical in size, I even aligned them myself in Illustrator, just to be sure, and when I put them in subfigure side by side, they are not horizontally aligned!

The worst part is, I have 2 other pictures, again the same size, and they are aligned normally. And the code is the same!! I don't know what's the problem!! Is there a way to manually shift one picture up a bit?

Here's the MWE:

%&latex
\documentclass[twocolumn,prc,floats,amsmath,amssymb,superscriptaddress,nofootinbib,11pt]{revtex4-1}


\usepackage{caption}
\usepackage{array}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\newcolumntype{y}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\renewcommand*{\arraystretch}{1.2}



\begin{document}

\begin{figure*}[!tp]
       \centering
       \begin{subfigure}{0.48\textwidth}
               \centering
               \includegraphics[width=1.1\textwidth]{Cobalt60.eps}
               \label{fig:Co}
       \end{subfigure}\quad
       \begin{subfigure}{0.48\textwidth}
               \centering
               \includegraphics[width=1.1\textwidth]{Cezij137.eps}
               \label{fig:Cs}
       \end{subfigure}
       \caption{Lijevo: Spektar ${}^{60} \textrm{Co}$ s dvije karakteristične zrake na 1173.237 keV i 1332.501 keV. Desno: Spektar ${}^{137} \textrm{Cs}$ s karakterističnom zrakom na 661.657 keV. Na manjoj slici je uvećan Comptonov rub smješten oko 550-og kanala.}
       \label{fig:Spektripoz1}
\end{figure*}

\begin{figure*}[!tp]
       \centering
       \begin{subfigure}{0.48\textwidth}
               \centering
               \includegraphics[width=1.1\textwidth]{Barij133.eps}
               \label{fig:Ba}
       \end{subfigure}\quad
       \begin{subfigure}{0.48\textwidth}
               \centering
               \includegraphics[width=1.1\textwidth]{fit.eps}
       \end{subfigure}
       \caption{Lijevo: Spektar ${}^{133} \textrm{Ba}$. Barijev spektar ima nekoliko karakterističnih vrhova, no uzimamo samo najintenzivniji vrh. Desno: Kalibracijski pravac.}
       \label{fig:Spektripoz2}
\end{figure*}

\end{document}

And here are the pictures (.eps format):

http://www76.zippyshare.com/v/19000331/file.html http://www76.zippyshare.com/v/78211264/file.html http://www76.zippyshare.com/v/46193895/file.html http://www76.zippyshare.com/v/25153661/file.html

The second right picture is lower than the left, and the first pictures are perfectly aligned...

2 Answers 2

7

Looking at the code it is obvious what the difference between the two floats is: the labels! Since you don't have sub-captions, remove the \label commands for them, and the alignment problem disappears.

5
  • Omg I'm such an idiot! i totally didn't notice that there is no label under the second one (and I don't need labels in subfigures anyway)! Feels dumb xD Thanks!!!! :)
    – dingo_d
    Commented Mar 13, 2013 at 12:26
  • 1
    Nonono, this happens. But maybe @AxelSommerfeldt might have a look into this, as the \label seems to leak something into the float.
    – mafp
    Commented Mar 13, 2013 at 16:34
  • I have the same problem but I do have subcaptions and my figures are not aligned (one is smaller than the other and this causes the subcaptions to not be aligned). How can I solve the problem?
    – desmond13
    Commented Oct 16, 2017 at 15:39
  • 1
    I did solve my problem by substituting \begin{subfigure}{0.3\textwidth} by \begin{subfigure}[b]{0.3\textwidth}
    – desmond13
    Commented Oct 16, 2017 at 15:42
  • @kalmanlsAGameChanger thank you!
    – Fábio
    Commented Jul 19, 2019 at 11:35
3

For those that run into this issue but do have subcaptions (like me): I found that the solution was to use \begin{subfigure}[t]{<width>}: using t in the argument being passed into subfigure apparently aligns images at the top rather than the bottom (b), meaning the tops of the images and captions are aligned and the bottoms of the captions can flow as far as they want without affecting the rest of the layout!

(source)

You must log in to answer this question.

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