GeneralCentered Captions

LaTeX specific issues not fitting into one of the other forums of this category.
douglastoy
Posts: 7
Joined: Mon Apr 06, 2009 11:07 am

Centered Captions

Post by douglastoy »

I would like to centre the caption text underneath my figure but I don't know how. Can anyone help me?

Here is an example. I've loaded an example photo onto my flickr which hopefully will appear here...

Image

If not, please go to here in order to see it. Examining this you can see that the word "Regime" is below the "(f)" and looks pretty rubbish. Is it possible to centre this text in order the Regime be in the middle of the page, rather than under the "(f)".

Thanks in advance for any help.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Centered Captions

Post by localghost »

douglastoy wrote:I would like to centre the caption text underneath my figure but I don't know how. [...]
Centered captions are the default behaviour. Build a minimal working example (MWE) example that shows another one.
douglastoy wrote:[...] I've loaded an example photo onto my flickr which hopefully will appear here [...]
Pictures can also be uploaded to the forum server as attachment to posts. Use the tab called "Upload Attachment" right below the input window when posting. This is the better method because links to other servers could die after some time.
douglastoy wrote:[...] Examining this you can see that the word "Regime" is below the "(f)" and looks pretty rubbish. Is it possible to centre this text in order the Regime be in the middle of the page, rather than under the (f). [...]
Captions can be customized in many ways by using the caption package. Other classes than the standard ones may have built-in features.


Best regards
Thorsten
douglastoy
Posts: 7
Joined: Mon Apr 06, 2009 11:07 am

Centered Captions

Post by douglastoy »

Thanks for your quick reply.

I've uploaded a picture of the figure as an attachment and here is a brief code like the one I am using. This figure is one of six within a subfloat environment.

Code: Select all

\begin{figure}
\centering
\subfloat[(8x4.5): Zero Torque \& Identical Rotational Regime]{\label{Comp_SD_ZQ_VQ35005000}\includegraphics[width=0.5\linewidth]{Comp_SD_ZQ_VQ35005000}}
\subfloat{othersubfloat}
\caption{Subfloat Caption}
\label{Subfloat label}
\end{figure}
Is it possible to centre the caption "(8x4.5): Zero Torque \& Identical Rotational Regime"? From the uploaded figure you can see my previous remark about Regime being to the left of the caption and not in the centre.
Attachments
Bad Caption Example
Bad Caption Example
Bad Caption Example.jpg (92.78 KiB) Viewed 93610 times
douglastoy
Posts: 7
Joined: Mon Apr 06, 2009 11:07 am

Centered Captions

Post by douglastoy »

Fixed using caption package. Put this in the preamble.

Code: Select all

\usepackage[center]{caption}
magical marshmallow
Posts: 30
Joined: Mon Jan 21, 2013 11:37 am

Centered Captions

Post by magical marshmallow »

I have a similar question to this. I have a caption for a figure underneath which I would like to have a smaller centered piece of text. When I add the \centering command (to the \caption), the whole caption becomes centered, not just the portion after the \centering command. Can anyone tell me why this is and what I should do to fix this please?

Code: Select all

\documentclass{scrreprt}
\usepackage{caption}
\usepackage{graphicx}

\begin{document}
  \begin{figure}
    \centering
    \includegraphics[width=\linewidth]{SOME_IMAGE.png}
    \caption[Caption for LOF]{Accurate caption\\ \footnotesize \centering Experimental details}
    \label{Some label}
  \end{figure}
\end{document}

Cheers
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Centered Captions

Post by localghost »

As I already said in an earlier reply here, captions are centered by default. And that's not different in your example even if the manual line break and the other following stuff is dropped.

Please prepare a proper example where your main caption is not centered. Otherwise this discussion remains academic.

Just a hint. You don't necessarily need to write the additional text into the caption. Just place it before the caption as usual text.
magical marshmallow
Posts: 30
Joined: Mon Jan 21, 2013 11:37 am

Centered Captions

Post by magical marshmallow »

Sorry slightly ambiguous post. I shall try to clear this up

The caption as a whole is indeed centred by default under the image, however the caption text is formated as:
Figure X.X: Caption text.

When the caption is long enough, it drops to a second line and takes the form of
Figure X.X: Caption text which is long and requires a
  2nd line of text

I would like thus to add a 3rd line which would take the form of
Figure X.X: Caption text which is long and requires a
  2nd line of text
   small font details

It is this last part that I am striving to achieve
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Centered Captions

Post by Johannes_B »

I guess I am not the only one who doesn't really knows what you are trying to achieve. A minimal example is supposed to isolate the problem so we can help you faster.

Code: Select all

\documentclass{scrreprt}
\usepackage[format=plain,indention=1em]{caption}
\usepackage[demo]{graphicx}
\begin{document}
  \begin{figure}
    {\centering
    \includegraphics[width=\linewidth]{SOME_IMAGE.png}
    \caption[Caption for LOF]{Accurate caption, I would like thus to add a 3rd line which would take the form of Figure X.X: Caption text which is long and requires a \\ \footnotesize Experimental details}
    \label{Some label}}
    \footnotesize Experimental details
\end{figure}
\end{document}

If this is not what you want, a minimal example is more than required. Please also have a look at the caption manual and the format and indention options.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Centered Captions

Post by localghost »

Another possible approach with a \parbox.

Code: Select all

\documentclass{scrreprt}
\usepackage[T1]{fontenc}
\usepackage{graphicx}

\setcapindent{1em}  % only to mark the caption text,
                    % set to 0pt in actual document

\begin{document}
  \begin{figure}[!htb]
    \centering
    \includegraphics[scale=0.5]{example-image}
    \caption[LOF entry]{The quick brown fox jump over the lazy dog. The quick brown fox jump over the lazy dog.}
    \label{fig:dummy}
    
    \smallskip
    \parbox{\linewidth}{\footnotesize Experimental details}
  \end{figure}
\end{document}
magical marshmallow
Posts: 30
Joined: Mon Jan 21, 2013 11:37 am

Centered Captions

Post by magical marshmallow »

What I have is:

Code: Select all

\documentclass{scrreprt}
\usepackage{caption}
\usepackage{graphicx}
\begin{document}
  \begin{figure}
\includegraphics[width=\linewidth]{some-image.png}
\caption[Description for LOF]{Description of image\\ \footnotesize\centering Details of protocol used to collect data}
\label{some label}
\end{figure}
\end{document}
What I would like is for the 'rubbish' on the 2nd line of the caption to be aligned under Description, not centered.
Attachments
caption-centered.png
caption-centered.png (12.36 KiB) Viewed 73121 times
Post Reply