# Centering images

I made my images in Ipe. But there are some not centered:

But, there are others centered:

I use the same code for both (just changing, of course, the files names):

\begin{center}
\begin{minipage}{\linewidth}
\centering
\includegraphics[scale=1]{m5c5f7}
\end{minipage}
\end{center}


(it's .eps file). What should I do to change it? I also tried to put the 1st image centered in Ipe, but it didn't work.

Another thing that I tried to do it is to write \hspace{6cm}\includegraphics[scale=1]{m5c5f7}, but it didn't work either.

Thanks :)

• Is the "pontos correspondentes..." paragraph part of the image? If it is, then I feel that the image is centered. – olga.saucedo Jul 7 '14 at 1:39
• No, it's not haha @olga.saucedo – mvfs314 Jul 7 '14 at 1:43
• If that's truly the case, please, show us an MWE. – Paul Gessler Jul 7 '14 at 1:48
• I never used IPE, but the reason can be that the bounding box of an .eps is wrong (it happens with pstricks when pure graphics is mixed up with text. A solution consists un converting the .eps files to .pdf, with epspdf (or epspdftk under Windows). It converts with the help of GhostScript and crops the image to obtain an exact bounding box. Then you compile directly with pdflatex. The application is a texlua script available on CTAN. – Bernard Jul 7 '14 at 1:53
• I'm gonna try here @Bernard. Do you have any suggestion about another program to draw images? Thanks :) – mvfs314 Jul 7 '14 at 1:57

## 1 Answer

Your centring efforts are almost certainly overkill here:

\begin{center}
\begin{minipage}{\linewidth}
\centering


Generally you should only need two commands to centre images:

1. \centering\includegraphics{...} — when the figure is smaller than the text width
2. \centerline{\includegraphics{...}} — when the figure is wider than the text width

If this doesn't appear to centre your image correctly, put \fbox{\includegraphics{...}} to see where the bounds of the image are; you may then need to either pad or crop the image to make it more symmetrical.

• I'd avoid \centerline{...} and favor \makebox[\textwidth]{...}: \centerline isn't documented and it may have surprising effects. – egreg Jul 7 '14 at 6:52
• @egreg — a matter of taste :) at least \centerline is somewhat semantic out of the box. I agree it's not the cleanest implementation, but it is memorable. I admit this is a controversial opinion of mine. – Will Robertson Jul 7 '14 at 7:08
• Actually, I just created another file and it worked haha but thanks anyway :) – mvfs314 Jul 8 '14 at 0:05