# add blank space before image

I'm drawing two images, one on top and one in the bottom, and I want them to be aligned. One of them has some extra blank space one its left side, so I need to realign it manually:

\begin{minipage}{9em}
\includegraphics[height=3em]{images/img1.png} \\
\includegraphics[height=3em]{images/img2.png}
\end{minipage}


I tried to add \hspace{some_number} to either one of them to see the effect, but nothing happened. What should I use?

Thanks.

-
While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. The images appear aligned to me, so without a MWE, not sure how to determine the source of the problem. You could try \hspace*{} but you should not need to resort to a manual tweak like that to align things. – Peter Grill Nov 30 '12 at 8:34
They are aligned, but as I said above one image has some extra blank space in it on its left side, so I have to move it a little bit to the left or I have to move the other one a little bit to the right. – Ricky Robinson Nov 30 '12 at 8:52
The space is /inside/ the image, it's not introduced by latex. – Ricky Robinson Nov 30 '12 at 8:52

\includegraphics of package graphicx knows option trim=<left> <bottom> <right> <top>. Default unit is bp:

\includegraphics[trim=10 0 0 1mm]{img.png}% trims 10bp from the left and 1mm from the top


Or crop the image with image editing software.

-

You can use \hspace*{-<length>} to move one of the images to the left (or a postive amount to move to the right) to compensate for the extra space in the image itself:

## Code:

\documentclass{article}
\usepackage[demo]{graphicx}% Remove demo option for real use.

\begin{document}
\begin{minipage}{9em}
\includegraphics[height=3em]{images/img1.png} \\
\hspace*{-1ex}\includegraphics[height=3em]{images/img2.png}
\end{minipage}
\end{document}

-
This would work but isn't the recommended approach, right? I'm sure it's not good practice to try and put images and then align them using such code. Probably something with subfig etc would be better? – recluze Nov 30 '12 at 9:13
@recluze: Yep Heiko's answer is the correct approach for this specific problem. I was addressing the question asked. – Peter Grill Nov 30 '12 at 10:27