Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I mess up with things when I try to use the figure-thing: the picture is not appearing with the correct alignment (apparently because I forget the float package). Now I want to use only the graphicx package with \includegraphics. How can I center the \includegraphics without figure?

Not working or doing centering to the document afterwards.

\includegraphics[width=0.5 \textwidth]{./Pictures/r.png}{\centering}
\includegraphics[width=0.5 \textwidth]{./Pictures/r.png}\centering
share|improve this question

2 Answers 2

up vote 27 down vote accepted

Put \includegraphics into a center environment -- this also adds some space before and after your picture.

\documentclass{article}

\usepackage[demo]{graphicx}% "demo" to make example compilable without .png-file

\usepackage{lipsum}

\begin{document}

\lipsum[1]

\begin{center}
\includegraphics[width=0.5\textwidth]{mypicture.png}
\end{center}

\lipsum[1]

\end{document}
share|improve this answer
2  
The environment center puts some extra vertical space around its contents, which is frowned upon, at least for me. Therefore I prefer the command \centering, i.e. {\centering\includegraphics[width=0.5\textwidth]{mypicture.png}}, the outer pair of braces is to make the effect of \centering be local. –  tohecz Mar 5 '12 at 21:51
4  
@tohecz I'd say center should be frowned upon inside floats (which add own space before/after them), but is perfectly fine for pictures inserted directly in the text. –  lockstep Mar 5 '12 at 21:57
    
@tohecz Your command misses a \par before the end of outer bracket. Without \par it won't work. –  AnonJ Nov 14 at 8:04

\includegraphics{..} looks to TeX like a big letter, center it the same way

\begin{center}
 \includegraphics{...

or use \centering if you prefer.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.