I would like to center an image but keep the caption aligned with the margins ( not centered).
When using [H] (here precisely):
\begin{figure} [H]
\includegraphics[scale=0.8]{figures/mass.png}
\caption{The ordered and blac aldl dsjfd f eheher erhrhr erher rher h er h wer werh erher er rher erh erh erhr erh er erherw werh rh erh h werrfhwerhwer erioer ier ier ierw werui weriu weriufieruirehweriheih wei i i i eri uire rhh rh erh er werihwer ierh eriher ih }
\label{fig:01}
\end{figure}
The caption is the way I want it, but the image is to the side.
If I add the following command:
\begin{figure} [H]
\centerline{\includegraphics[scale=0.8]{figures/mass.png}}
\caption{The ordered and blac aldl dsjfd f eheher erhrhr erher rher h er h wer werh erher er rher erh erh erhr erh er erherw werh rh erh h werrfhwerhwer erioer ier ier ierw werui weriu weriufieruirehweriheih wei i i i eri uire rhh rh erh er werihwer ierh eriher ih }
\label{fig:01}
\end{figure}
I get a centered image and the caption where I wish:
However, I don't want to use [H], I want to use [h]/[ht]/[htbp!]. If I change that, for example:
\begin{figure} [htbp!]
\centerline{\includegraphics[scale=0.8]{figures/mass.png}}
\caption{The ordered and blac aldl dsjfd f eheher erhrhr erher rher h er h wer werh erher er rher erh erh erhr erh er erherw werh rh erh h werrfhwerhwer erioer ier ier ierw werui weriu weriufieruirehweriheih wei i i i eri uire rhh rh erh er werihwer ierh eriher ih }
\label{fig:01}
\end{figure}
Then the image is centered, but also the caption, and this is not what I want.
This what in my preamble:
\documentclass[12pt,a4paper]{revtex4-1}
\usepackage{graphicx}% Include figure files
\usepackage{bm}% bold math
\usepackage[usenames]{color}
\usepackage[all]{xy}
\usepackage{amsmath}
\usepackage{natbib}
\usepackage{placeins}
\usepackage{verbatim}
\usepackage[top=0.59in,bottom=0.59in,left=0.59in,right=0.59in]{geometry}
\usepackage{amssymb}
\usepackage{float}
\usepackage[nice]{nicefrac}
\usepackage{chemmacros}
\usepackage{caption}
\usepackage[font=footnotesize]{caption}
\setlength{\parindent}{0pt}
\renewcommand\thesection{\arabic{section}}
\renewcommand\thesubsection{\alph{subsection}}
please provide a simple solution.
cheers
Best Answer
Don't use
\centerline
-- use\centering
instead.Addendum, posted after the OP drew my attention to the fact that
[htbp]
should be used, rather than[H]
. Thecaption
package is known to be incompatible with therevtex4-1
document class. Therefore, the best suggestion I can make is that you not load thecaption
package at all. If the text of the caption simply has to typeset in footnote size -- and I can't think of a good reason for this, since you're presumably using therevtex4-1
document for some good reason -- you could place a\footnotesize
directive at the start of the argument of the\caption
instruction.