LaTeX forum ⇒ 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

Postby douglastoy » Thu May 14, 2009 11:20 am

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.

Tags:

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

Postby localghost » Thu May 14, 2009 11:33 am

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
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

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

Postby douglastoy » Thu May 14, 2009 11:46 am

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.

  1. \begin{figure}
  2. \centering
  3. \subfloat[(8x4.5): Zero Torque \& Identical Rotational Regime]{\label{Comp_SD_ZQ_VQ35005000}\includegraphics[width=0.5\linewidth]{Comp_SD_ZQ_VQ35005000}}
  4. \subfloat{othersubfloat}
  5. \caption{Subfloat Caption}
  6. \label{Subfloat label}
  7. \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.jpg
Bad Caption Example
Bad Caption Example.jpg (92.78 KiB) Viewed 54919 times

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

Postby douglastoy » Thu May 14, 2009 1:40 pm

Fixed using caption package. Put this in the preamble.
  1. \usepackage[center]{caption}

magical marshmallow
Posts: 30
Joined: Mon Jan 21, 2013 11:37 am

Postby magical marshmallow » Thu Jun 13, 2013 5:21 pm

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?

  1. \documentclass{scrreprt}
  2. \usepackage{caption}
  3. \usepackage{graphicx}
  4.  
  5. \begin{document}
  6. \begin{figure}
  7. \centering
  8. \includegraphics[width=\linewidth]{SOME_IMAGE.png}
  9. \caption[Caption for LOF]{Accurate caption\\ \footnotesize \centering Experimental details}
  10. \label{Some label}
  11. \end{figure}
  12. \end{document}



Cheers

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

Postby localghost » Thu Jun 13, 2013 5:42 pm

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.
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

magical marshmallow
Posts: 30
Joined: Mon Jan 21, 2013 11:37 am

Postby magical marshmallow » Thu Jun 13, 2013 7:15 pm

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: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Thu Jun 13, 2013 7:33 pm

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.


  1. \documentclass{scrreprt}
  2. \usepackage[format=plain,indention=1em]{caption}
  3. \usepackage[demo]{graphicx}
  4. \begin{document}
  5. \begin{figure}
  6. {\centering
  7. \includegraphics[width=\linewidth]{SOME_IMAGE.png}
  8. \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}
  9. \label{Some label}}
  10. \footnotesize Experimental details
  11. \end{figure}
  12. \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: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Thu Jun 13, 2013 7:51 pm

Another possible approach with a \parbox.
  1. \documentclass{scrreprt}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{graphicx}
  4.  
  5. \setcapindent{1em} % only to mark the caption text,
  6. % set to 0pt in actual document
  7.  
  8. \begin{document}
  9. \begin{figure}[!htb]
  10. \centering
  11. \includegraphics[scale=0.5]{example-image}
  12. \caption[LOF entry]{The quick brown fox jump over the lazy dog. The quick brown fox jump over the lazy dog.}
  13. \label{fig:dummy}
  14.  
  15. \smallskip
  16. \parbox{\linewidth}{\footnotesize Experimental details}
  17. \end{figure}
  18. \end{document}
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

magical marshmallow
Posts: 30
Joined: Mon Jan 21, 2013 11:37 am

Postby magical marshmallow » Thu Jun 13, 2013 9:59 pm

What I have is:

  1. \documentclass{scrreprt}
  2. \usepackage{caption}
  3. \usepackage{graphicx}
  4. \begin{document}
  5. \begin{figure}
  6. \includegraphics[width=\linewidth]{some-image.png}
  7. \caption[Description for LOF]{Description of image\\ \footnotesize\centering Details of protocol used to collect data}
  8. \label{some label}
  9. \end{figure}
  10. \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 34430 times


Return to “General”

Who is online

Users browsing this forum: No registered users and 2 guests