Graphics, Figures & TablesFigure not centered

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
newpuppet
Posts: 3
Joined: Wed Apr 03, 2013 6:16 pm

Figure not centered

Post by newpuppet »

Hi all,

I'm quite newbie to LaTeX, so I need some help.

I am writing a project in which i need to insert some figure centered in the page and I'm using this code.

Code: Select all

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{listings}

\begin{document}
  \begin{figure}[htbp]
    \centering
    \includegraphics{es2_1_cavo_reale_150.jpg}
  \end{figure}
\end{document}
The problem is that the output PDF shows the picture but it's not centered but aligned on the right of the page. What i did wrong?


Thank you very much for your help and sorry for bad English
Attachments
figures-alignment.jpg
figures-alignment.jpg (27.41 KiB) Viewed 24245 times
Last edited by localghost on Wed Apr 03, 2013 6:33 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Figure not centered

Post by localghost »

Do you get any warning in the log file (*.log)? I bet that the figure is simply too wide and sticks out into the right margin.


Best regards and welcome to the board
Thorsten
newpuppet
Posts: 3
Joined: Wed Apr 03, 2013 6:16 pm

Re: Figure not centered

Post by newpuppet »

Thanks very much for your answer. I had no error while compiling the PDF, anyway i attached here my *.log file.

If you have any suggestion it will be awesome!
Attachments
prova.log
(16.9 KiB) Downloaded 516 times
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Figure not centered

Post by localghost »

newpuppet wrote:[…] I had no error while compiling the PDF, […]
I did not talk of errors, but of warnings. And the log file is quite clear in this regard.

Code: Select all

Overfull \hbox (98.46169pt too wide) in paragraph at lines 13--14
The graphicx manual lists options how to determine the size of an included graphic.
newpuppet
Posts: 3
Joined: Wed Apr 03, 2013 6:16 pm

Re: Figure not centered

Post by newpuppet »

thank you very much :) problem solved!
Post Reply