Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

1 Answer

up vote 9 down vote accepted

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}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.