# Figures appear after their text in latex [duplicate]

When I click on the reference of the figure on the article its caption appears directly instead of all the figure then I have to go up to see the figure. I used it:

\documentclass[twocolumn,amsmath,showkeys,prb]{revtex4-1}
\usepackage{graphicx}
and
\begin{figure}
\centering
\includegraphics[width=8.5cm,keepaspectration=true]{./image}
\caption{image.png}
\label{fig:exp_diag}
\end{figure}


Thank you for the help.

## marked as duplicate by Werner floats StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Nov 12 '16 at 18:25

Usually package caption or package hypcap fixes the issue. A starting point:

\documentclass[twocolumn,amsmath,showkeys,prb]{revtex4-1}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{hyperref}
\begin{document}
\begin{figure}
\centering
\includegraphics[width=8.5cm,keepaspectratio]{example-image-a}
\caption{image.png}
\label{fig:exp_diag}
\end{figure}

Ref: \ref{fig:exp_diag}
\end{document}

• thank you for your reply, but I still have problem: when, I add the new packages :\documentclass[twocolumn,amsmath,showkeys,prb]{revtex4-1} \usepackage{caption} \usepackage{graphicx} \usepackage{hyperref}, the figure appear when I click on its reference but the lines of its caption are not aligned successively. Could one help me, please? – user118607 Nov 13 '16 at 13:24
• @user118607 No, I cannot help. TL has about 4000 LaTeX packages. That makes a number of 2^4000 package combinations, a number with 1205 decimal digits. Make a correct and tested minimal working example (MWE). It would show the problematic packages and maybe someone can help. – Heiko Oberdiek Nov 13 '16 at 15:06