20

I want to put the caption of my figure in the center but I can't do that. when I put my figure in the center the caption is also in the center but when the caption is too long and there is a return to a newline it is not in the center

2
  • 2
    Do you use the package caption? Do you use a KOMA-class? Do you use memoir? But the important question is: Did you read: How to Ask-page May 5 '12 at 12:12
  • 1
    Can you give us a minimal working example so we can see what's going on?
    – qubyte
    May 5 '12 at 12:12
37

Use the caption package and its justification=centering option.

\documentclass{article}

\usepackage[justification=centering]{caption}

\begin{document}

\begin{figure}
\centering
\rule{1cm}{1cm}
\caption{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut
    purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
    Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget,
    consectetuer id, vulputate a, magna. Donec vehicula augue eu neque.}
\end{figure}

\end{document}

enter image description here

2
  • @ lockstep: thank you your answer is so useful I resolved my problem. Really I don't know the package caption so thank you very much for your answer
    – boutheina
    May 5 '12 at 12:20
  • 1
    What if I want to do this only to a selected number of captions?
    – Suraj S
    Apr 3 at 9:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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