Text FormattingAPA6 and centered captions

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
sjkiss
Posts: 30
Joined: Tue Nov 15, 2011 12:23 am

APA6 and centered captions

Post by sjkiss »

Hi: I'm using APA6 to prepare an article. I'm trying to get a centered caption to work, but none of the following variations on the theme work. The APA 6 documentation states that the caption package is loaded automatically and that there's an additional command `\centeredcaption'. I can't get either to work.
Thoughts?

Simon

Code: Select all

\documentclass[doc]{apa6}
\usepackage[center]{caption}
\shorttitle{Test}
\begin{document}
\begin{table}
\caption{This is my caption}
\begin{tabular}{lrr}
This is my table & 5&10\\
This is my table & 5&10\\
\end{tabular}
\end{table}


\end{document}

Code: Select all

\documentclass[doc]{apa6}

\shorttitle{Test}
\begin{document}
\begin{table}
\centeredcaption{5in}{This is my caption}
\begin{tabular}{lrr}
This is my table & 5&10\\
This is my table & 5&10\\
\end{tabular}
\end{table}


\end{document}

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

APA6 and centered captions

Post by cgnieder »

This probably refers to an older version of caption. The following works:

Code: Select all

\documentclass[doc]{apa6}
\usepackage[justification=centering]{caption}
\shorttitle{Test}

\begin{document}
\begin{table}
\caption{This is my caption}
\begin{tabular}{lrr}
This is my table & 5&10\\
This is my table & 5&10\\
\end{tabular}
\end{table}

\end{document}
For details please have a look at the documentation: caption.

Regards
site moderator & package author
sjkiss
Posts: 30
Joined: Tue Nov 15, 2011 12:23 am

Re: APA6 and centered captions

Post by sjkiss »

Hi Clemens, thanks for that. I just tried your code, but it didn't work. I got an option clash error message "option clash for package caption".

I think I'm running caption package 3.1, at least that's what I gather from the .pdf documentation installed on my system.
Simon
User avatar
sommerfee
Posts: 503
Joined: Mon Apr 09, 2007 4:20 pm

APA6 and centered captions

Post by sommerfee »

sjkiss wrote:Hi Clemens, thanks for that. I just tried your code, but it didn't work. I got an option clash error message "option clash for package caption".
In this case try replacing

Code: Select all

\usepackage[justification=centering]{caption}
by

Code: Select all

\captionsetup{justification=centering}
.
sjkiss
Posts: 30
Joined: Tue Nov 15, 2011 12:23 am

Re: APA6 and centered captions

Post by sjkiss »

Now we're cooking with gas! Can you tell me where you found that information?
Thank you!
sjkiss
Posts: 30
Joined: Tue Nov 15, 2011 12:23 am

APA6 and centered captions

Post by sjkiss »

Hi Clemens,
I see the \captionsetup command in the caption documentation, but I wasn't aware that it could be used without invoking the \usepackage{caption}. But I guess if APA is loading the caption package silently (as the documentation seems to suggest), then it seems like it's not necessary. Is that right?

One other question though. I can't seem to get upright captiontext with the following code. The documentation has this to say:
font= There are three font options which affects different parts of the caption: ). You set them
up using the options
font={hfont optionsi} ,
labelfont={hfont optionsi} , and
textfont={hfont optionsi} ,
where hfont optionsi is a list of comma separated font options.
And these are the available font options:
scriptsize Very small size
footnotesize The size usually used for footnotes
small Small size
normalsize Normal size
large Large size
Large Even larger size
up Upright shape

Code: Select all

\documentclass[doc]{apa6}
\shorttitle{test}
\captionsetup{justification=centering, textfont=up}
\begin{document}
\begin{table}
\caption{This is my caption}
\begin{tabular}{lrr}
This is my table & 5&10\\
This is my table & 5&10\\
\end{tabular}
\end{table}
\end{document}
Last edited by cgnieder on Thu Aug 30, 2012 6:07 pm, edited 1 time in total.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

APA6 and centered captions

Post by cgnieder »

sjkiss wrote:Hi Clemens,
I see the \captionsetup command in the caption documentation, but I wasn't aware that it could be used without invoking the \usepackage{caption}. But I guess if APA is loading the caption package silently (as the documentation seems to suggest), then it seems like it's not necessary. Is that right?
In short: yes. Actually it not only loads caption but also defines setup's for the captions. You need to redefine the setup that's used for the table caption text:

Code: Select all

\documentclass[doc]{apa6}
\shorttitle{test}
\captionsetup{justification=centering}
\DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent}#1}% same as the one by apa6 but without \textit
\begin{document}
\begin{table}
\caption{This is my caption}
\begin{tabular}{lrr}
This is my table & 5&10\\
This is my table & 5&10\\
\end{tabular}
\end{table}
\end{document}
Regards
site moderator & package author
sjkiss
Posts: 30
Joined: Tue Nov 15, 2011 12:23 am

APA6 and centered captions

Post by sjkiss »

OK, Yours works, but I don't understand why mine doesn't work. I tried playing with the version below. It should work, shouldn't it? and where do you get the label "tabletext" from?

Code: Select all

\DeclareCaptionStyle{mystyle}%
{font=up}
\captionsetup{style=mystyle}
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

APA6 and centered captions

Post by cgnieder »

Yours doesn't because of the following lines in apa6.cls (lines 685--700):

Code: Select all

\ifapamode{% man
    \DeclareCaptionLabelFormat{tablelabel}{\hspace{-\parindent}\raggedright#1 #2}
    \DeclareCaptionLabelFormat{figurelabel}{\hspace{-\parindent}\raggedright\textit{#1 #2}}
    \DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent}\raggedright\textit{#1}}
}{% jou
    \DeclareCaptionLabelFormat{tablelabel}{\hspace{-\parindent}#1 #2}
    \DeclareCaptionLabelFormat{figurelabel}{\hspace{-\parindent}\textit{#1 #2}}
    \DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent
}\textit{#1}}
}{% doc
    \DeclareCaptionLabelFormat{tablelabel}{\hspace{-\parindent}#1 #2}
    \DeclareCaptionLabelFormat{figurelabel}{\hspace{-\parindent}\textit{#1 #2}}
    \DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent}\textit{#1}}
}
\captionsetup[table]{position=above,skip=0pt,labelformat=tablelabel,labelsep=newline,textformat=tabletext}
\captionsetup[figure]{position=below,skip=0pt,labelformat=figurelabel,labelsep=period}
You'd need to explicitly set \captionsetup[table]{<declarations>} to overwrite the settings done by apa6.

Regards
site moderator & package author
sjkiss
Posts: 30
Joined: Tue Nov 15, 2011 12:23 am

APA6 and centered captions

Post by sjkiss »

Hi there:
I'm not sure if you're reading this Clemens, or anyone else, but I'm still working with this.
The problem still remains: I can't combine sans serif with small caps. It seems like sans serif works, and all the other font options listed in the caption package documentation work just fine, but combining small caps with sans serif just doesn't work.
Help!
Simon

Code: Select all

\documentclass[doc, natbib]{apa6}
\usepackage{graphicx}
\usepackage{dcolumn}
\newcommand{\thickhline}{\noalign{\hrule height 1.5pt}}
\captionsetup{justification=centering, labelfont={sf,sc}, labelsep=newline}
\usepackage[figuresright]{rotating}

\title{Sustaining Agendas: Assessing The Media's Role In the Regulation of Bisphenol A In The US States}
\shorttitle{Sustaining Agendas}
\affiliation{Journalism Program\\Wilfrid Laurier University}
\author{Simon J. Kiss}

\begin{document}

This is my document
\begin{table}
\center

\caption{Exposure Estimates To BPA}
\begin{tabular*}{0.9\textwidth}{lc}
\thickhline
Age Category & micrograms/kg/bw per day\\
\hline
0-4 month-old infant & 1.6 \\
6-12 month-old infant  & 0.8\\
4-6 year old child	& 1.2 \\
60 kg adult	& 0.37 \\
\thickhline
\multicolumn{2}{l}{\emph{Source:} European Commission. Scientific Committee on Food. (2002)}\\
\end{tabular*}
\end{table}

\end{document}
Post Reply