标题放置和引用

标题放置和引用

我对 longtable 的标题和引用有疑问

\documentclass[stu,12pt]{apa7}
\usepackage[american]{babel}
\usepackage{setspace}
\usepackage{longtable}
\usepackage[style=apa,sortcites=true,sorting=nyt,backend=biber]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\title{title}
\begin{document}
\maketitle
Winter is cold in \ref{column_table}
\begin{center}
\begin{longtable}{p{0.4cm} | p{5cm} | p{2.5cm} | p{2.5cm} | p{2.3cm}}
\caption{Seasons of Island A}
\label{column_table}
\endfirsthead
\endhead
\hline
  & Season   & Temp  & Length   & Popular \\ \hline
1 & Spring   & Warm  & Nominal  & Yes  \\ \hline
2 & Summer   & Hot   & Nominal  & Yes  \\ \hline
3 & Winter   & Cold  & Nominal  & Yes  \\ \hline
\end{longtable}
\end{center}
\end{document}

这会产生 在此处输入图片描述

我可以将表格标题格式化为在同一行上显示表格编号和标题吗,例如“表格 1 岛屿 A 的季节”?此外,是否可以通过表格名称来引用表格,例如“表格 1 中的冬季很冷”,而不仅仅是使用数字?

答案1

另一种方法是使用表格longtblrtalltblrtabularray。在这种情况下,标题格式由包定义tabularray

\documentclass[stu,12pt]{apa7}
\usepackage[american]{babel}

\usepackage[style=apa,sortcites=true,sorting=nyt,backend=biber]{biblatex}
\DeclareLanguageMapping{american}{american-apa}

\usepackage{tabularray} % <--- instead of longtable

\title{title}

\begin{document}
\maketitle
Winter is cold in \ref{long_table} and \ref{tall_table} \dots

\begin{longtblr}[
caption = {Seasons of Island A},
  label = {long_table}
                ]
                {hlines, vlines,
                 colspec = {l  Q[l, wd=5cm] *{3}{Q[l, wd=2.5cm]}},
                 rowhead = 1
                }
%   table body
  & Season   & Temp  & Length   & Popular   \\  
1 & Spring   & Warm  & Nominal  & Yes       \\ 
2 & Summer   & Hot   & Nominal  & Yes       \\ 
3 & Winter   & Cold  & Nominal  & Yes       \\ 
\end{longtblr}


    \begin{center}
\begin{talltblr}[
caption = {Seasons of Island A},
  label = {tall_table}
                ]
                {hlines, vlines,
                 colspec = {l  X[l] *{3}{Q[l, wd=2.5cm]}}
                }
%   table body
  & Season   & Temp  & Length   & Popular   \\
1 & Spring   & Warm  & Nominal  & Yes       \\
2 & Summer   & Hot   & Nominal  & Yes       \\
3 & Winter   & Cold  & Nominal  & Yes       \\
\end{talltblr}
    \end{center}
    \begin{center}
\begin{talltblr}[
caption = {Seasons of Island A, but this time the caption test is so long that it is broken into two lines},
  label = {tall_table}
                ]
                {hlines, vlines,
                 colspec = {l  X[l] *{3}{Q[l, wd=2.5cm]}}
                }
%   table body
  & Season   & Temp  & Length   & Popular   \\
1 & Spring   & Warm  & Nominal  & Yes       \\
2 & Summer   & Hot   & Nominal  & Yes       \\
3 & Winter   & Cold  & Nominal  & Yes       \\
\end{talltblr}
    \end{center}

并保留 APA7 标题格式:

    \begin{center}
\begin{talltblr}[
caption = {Seasons of Island A, but this time the caption test is so long that it is break into two lines},
  label = {tblr_table}
                ]
                {hlines, vlines,
                 colspec = {l  X[l] *{3}{Q[l, wd=2.5cm]}}
                }
%   table body
  & Season   & Temp  & Length   & Popular   \\
1 & Spring   & Warm  & Nominal  & Yes       \\
2 & Summer   & Hot   & Nominal  & Yes       \\
3 & Winter   & Cold  & Nominal  & Yes       \\
\end{talltblr}
    \end{center}
but when you like to preserve original APA7 caption formatting at short tables, you should use `tblr` inserted in `center` environment:
    \begin{center}
\captionof{table}{Seasons of Island A}
  \label{tblr_table}
\begin{tblr}{hlines, vlines,
             colspec = {l  X[l] *{3}{Q[l, wd=2.5cm]}}
            }
%   table body
  & Season   & Temp  & Length   & Popular   \\
1 & Spring   & Warm  & Nominal  & Yes       \\
2 & Summer   & Hot   & Nominal  & Yes       \\
3 & Winter   & Cold  & Nominal  & Yes       \\
\end{tblr}
    \end{center}
\end{document}

在此处输入图片描述

答案2

此标题格式在文档类中定义。您可能应该保留原样,因为它符合 APA 格式(请参阅APA7 表格)。

如果你确实想改变它并继续使用文档类,请将以下代码片段放在你的序言中。这需要包标题但似乎apa7已经加载了。

% \usepackage{caption}
\clearcaptionsetup{table}
\captionsetup[table]{
  format=hang,
  justification=centering,
  singlelinecheck,
  labelfont=bf,
  labelsep=period,
}

相关内容