# How to center a specific caption?

I'm having a problem with centering my figure captions. Particuarly, I know that we can use \usepackage[justification=centering]{caption} to center captions, however, I'm interested in just centering a specific caption. I've read the caption manual but no luck, so my question is: How can I center a specific caption?

-
You can use \captionsetup{justification=centering} in the specific table or figure environment (after \usepackage{caption}. – egreg Jan 24 '13 at 15:14
Thanks @egreg, it worked! Please add as an aswer so I can close the question. :) – Marcos Roriz Junior Jan 24 '13 at 15:25

You can use \captionsetup in a specific figure (or table) environment:

\documentclass{article}

\usepackage{graphicx}
\usepackage{caption}

\begin{document}

\begin{figure}[hp]
\centering

\includegraphics[scale=.30]{example-image-a}

\caption{A caption with long text bla bla bla bla bla bla bla bla
bla bla bla bla bla bla bla bla bla bla}
\end{figure}

\begin{figure}[hp]
\centering
\captionsetup{justification=centering}

\includegraphics[scale=.30]{example-image-b}

\caption{A caption with long text bla bla bla bla bla bla bla bla
bla bla bla bla bla bla bla bla bla bla}
\end{figure}

\begin{figure}[hp]
\centering
\captionsetup{justification=centering,margin=2cm}

\includegraphics[scale=.30]{example-image-c}

\caption{A caption with long text bla bla bla bla bla bla bla bla
bla bla bla bla bla bla bla bla bla bla}
\end{figure}

\end{document}


-