# The photo doesn't center when using \centering

I just saved an .eps file that it can not be uploaded to latex and it shows as in the photo , how would I resolve it ? this is the code , when I use smaller dimensions it's in the center , but with this one , I increased a little bit , and it went out of the center

\begin{figure}[H]
\centering
\label{fig:f419}
\caption{Deflection and weight as functions of D11 and D12}
\includegraphics[width=15cm, height=8cm]{4-23.eps}

\end{figure}


also this is my main file codes , that I don't know how to make a minimal , I mean , I know the link to minimal but here it's just too much and confusing

\documentclass[11pt,a4paper,twoside,openright]{report}

\usepackage{setspace}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{tabu}
\usepackage{subfigure}
\usepackage{afterpage}
\usepackage{amsmath,amssymb}
\usepackage{rotating}
\usepackage{fancyhdr}
\usepackage[scriptsize]{caption}
\hyphenation{a-gen-tiz-za-zio-ne}
\usepackage{float}
\usepackage[parfill]{parskip}
\graphicspath{ {images/} }

\setlength{\paperwidth}{16cm}
\setlength{\paperheight}{24cm}
\setlength{\oddsidemargin} {2. cm}
\setlength{\evensidemargin} {2. cm}

\usepackage[USenglish]{babel}
\usepackage[latin1]{inputenc}
\renewcommand{\captionfont}{\normalfont \sffamily \itshape \small}

\pagestyle{empty}

\begin{document}

\include{frontespizio}
\thispagestyle{empty} \normalfont \cleardoublepage
\include{dedica}
\thispagestyle{empty}  \cleardoublepage
\pagenumbering{Roman}
\include{sommario}
\thispagestyle{empty} \vspace*{.75truecm} \cleardoublepage
\include{ringraziamenti}
\thispagestyle{empty} \vspace*{.75truecm} \normalfont \cleardoublepage
\pagestyle{plain}\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}

\include{capitolo1}
\include{capitolo2}
\include{capitolo3}
\include{capitolo4}
\include{capitolo5}
\include{capitolo6}
\include{capitolo7}

\cleardoublepage
% ---- Bibliography ----
\bibliographystyle{plain}
\bibliography{bibl_tesi}
%\nocite{*}

\appendix

\pagestyle{fancy}
\fancyfoot{}
\renewcommand{\chaptermark}[1]{\markboth{\appendixname\ \thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}

\renewcommand\bibname{references}
\renewcommand\listfigurename{list of figures}\listoffigures
\renewcommand\listtablename{list of tables}\listoftables

\include{appendiceA}
\include{appendiceB}
\include{appendiceC}
\include{appendiceD}
\include{appendiceE}
\include{appendiceF}
\include{references}
\end{document}

• Probably 15cm is wider than \textwidth, please see Center figure that is wider than \textwidth. Please also see Why does an environment's label have to appear after the caption? because your labeling is incorrect at the moment. :-) – Paul Gessler Mar 29 '15 at 19:20
• Also, note that \label should go after \caption, or else any \ref that refers to the figure will be completely wrong. (As in, it will refer to the section number instead of the figure number, or something equally silly.) – Mark Mar 29 '15 at 19:25
• @Farzad64 please use @-username notation (as I've done here for you) to notify other commenters of your replies. It's probably also the reason your tables don't center, but it's impossible to say for sure without a minimal working example (MWE). – Paul Gessler Mar 29 '15 at 19:36
• @Farzad64: You should not turn the screw on such lengths as paperwidth directly. Use the excellent geometry package for this – user31729 Mar 29 '15 at 20:44
• As SoundsOfSilence says, don't modify these directly unless you really know what you are doing and why you can't avoid it. However, if you are really printing on A4, you do not want paperwidth to be 16cm unless you are doing some complicated layout with trimming or multiple pages to one physical page. The width of A4 paper is 210mm - not 160. – cfr Mar 29 '15 at 20:50

Here's a guess at what you might want, after minimising your example:

\documentclass[11pt,a4paper,twoside,openright]{report}

\usepackage[demo]{graphicx}
\usepackage{float}
\usepackage[scriptsize]{caption}

\usepackage[textwidth=160mm, textheight=240mm, hmarginratio=1:1, showframe]{geometry}

\pagestyle{empty}

\begin{document}

\begin{figure}[H]
\centering
\caption{Deflection and weight as functions of D11 and D12\label{fig:f419}}
\includegraphics[width=15cm, height=8cm]{4-23.eps}

\end{figure}

\end{document}


• thank you so much, I am comparing it with my doc , is the demo in \usepackage[demo]{graphicx} , make difference also ? @cfr – Farzad64 Mar 29 '15 at 21:03
• @Farzad64 The demo is because I don't have the image you have. Otherwise, I get an error when I try to compile. demo replaces all such images by black boxes. – cfr Mar 29 '15 at 21:30
• @Farzad64: I strongly suggest to read introductory books on LaTeX as well the documentation of packages which is in most cases installed too together with them. – user31729 Mar 29 '15 at 21:45
• @cfr: I wished I could upvote your comments, but I run out of upvotes for them ... but anyway (+1) for the post itself ;-) – user31729 Mar 29 '15 at 21:55
• @SoundsOfSilence ;). That happens to me too. I must upvote lots of comments! – cfr Mar 29 '15 at 22:10