Centering Caption for TeX Document Figure

  • Thread starter Juggler123
  • Start date
  • Tags
    Figure
In summary, there is a problem with the caption of a figure in a TeX document, as it is long and runs onto two lines. The default setting in LaTeX is to have the second line flushed left, but the desired result is to have both lines centered. A possible solution is to include the "caption" package with the "justification=centering" option.
  • #1
Juggler123
83
0
Hi I know this isn't general math but I didn't know where else to post!

I'm using this code to put a figure into my TeX document:

\begin{figure}[htp]
\centering
\includegraphics[scale=0.5]{A}
\caption{Flow patterns for non-Newtonian fluids for increasing rotational speeds ($\omega_{1}<\omega_{2}<\omega_{3}$) [39]}\label{A}
\end{figure}

The problem is that the caption is long and it runs onto two lines, the default setting in LaTeX is that the second line in the caption is flushed left but I would like both of the lines of the caption to be centred.

I've had a look at some possible solutions but can't really make any sense of them!

Can anyone help?
Thanks.
 
Physics news on Phys.org
  • #2
You may include the "caption" package with the appropriate option:
Code:
\usepackage[justification=centering]{caption}
Source:
http://anorien.csc.warwick.ac.uk/mirrors/CTAN/macros/latex/contrib/caption/caption-eng.pdf
 

Related to Centering Caption for TeX Document Figure

1. How do I center the caption for a figure in a TeX document?

To center the caption for a figure in a TeX document, you can use the \centering command before the \caption{} command. This will center the caption without affecting the alignment of the rest of the document.

2. Can I center the caption for a specific figure while keeping the rest of the captions aligned to the left?

Yes, you can use the \captionsetup{justification=centering} command before the \caption{} command for the specific figure. This will only center the caption for that particular figure while keeping the rest of the captions aligned to the left.

3. Is there a way to center the caption for a figure without using the \centering command?

Yes, you can use the \usepackage[justification=centering]{caption} package in the preamble of your document. This will automatically center all the captions for figures without the need for the \centering command.

4. Can I change the alignment of the caption for a figure after it has been centered?

Yes, you can use the \captionsetup{justification=left} command before the \caption{} command for the specific figure. This will change the alignment of the caption for that particular figure to the left.

5. Is it possible to center the caption for a figure without changing the alignment of the figure itself?

Yes, you can use the \captionsetup{format=center} command before the \caption{} command for the specific figure. This will center the caption without affecting the alignment of the figure itself.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
18K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
Back
Top