# Subfigure Alignment [closed]

I am trying to show a set of pictures using subfigure. The first line seems OK, but the second line has a different alignment than the first line, even though the two lines are exactly the same. How can I fix it?

Code:

\begin{figure*}
\centering
\begin{subfigure}
\centering
\includegraphics[width=\imagewidth,height=\imageheigth]{image1}
\end{subfigure}
~
\begin{subfigure}
\centering
\includegraphics[width=\imagewidth,height=\imageheigth]{image2}
\end{subfigure}

..............
..............
~
\begin{subfigure}
\centering
\includegraphics[width=\imagewidth,height=\imageheigth]{imageN}
\end{subfigure} \\
~
\begin{subfigure}
\centering
\includegraphics[width=\imagewidth,height=\imageheigth]{image(N+1)}
\end{subfigure}
..............
..............
~
\begin{subfigure}
\centering
\includegraphics[width=\imagewidth,height=\imageheigth]{image(2N)}
\end{subfigure}
\caption{some stuff her}
\label{fig:stuff}
\end{figure*}

-

## closed as too localized by percusse, Torbjørn T., Joseph Wright♦Jul 31 '12 at 13:46

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Do the imageN and image1 figures have the same size? – percusse Jul 31 '12 at 11:33
Yes, figure sizes are exactly the same. – rooter Jul 31 '12 at 11:36
Your code is just a fragment not showing relevant detail but the line starting \\ ~ has white space to the left of the leftmost figure so will be out of line. I would delete all the ~ (use \hspace{1cm} where you need space, it is clearer. and delete the \\  just use a blank line paragraph break. – David Carlisle Jul 31 '12 at 12:09

Ok, I solved it finally. The reason was a misplaced ~. Thanks for your support.