表格标题和表格编号

表格标题和表格编号

我尝试更改表格的编号和格式。目前我正在处理此问题

\documentclass[twoside, titlepage=firstiscover, open=right, 11pt]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{mathpazo}
\usepackage{graphicx}
\usepackage{float}
\usepackage{tabularx}
\usepackage{threeparttablex}
\usepackage[font=footnotesize, labelfont = bf]{caption}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\usepackage{threeparttable}

\begin{document}
 \begin{table}[!h]
    \begin{threeparttable}
    \begin{footnotesize}
    \caption{My Table Title\\}
    \begin{tabularx}{\columnwidth}{@{}lYYYYY@{}}
    \toprule
    & \multicolumn{5}{c}{bla}\\
    \cmidrule{2-6}
    this & is  & some & really  & random & text  \\
    \midrule
    bla & 0 & 1 & 2 & \textbf{3} & 4\\
    blubb & 5 & 6 & 7 & 8 & 9\\
    bla blubb & 10 & \textbf{11} & 12 & \textbf{13} & \textbf{14}\\
    \bottomrule
    \end{tabularx}
    \begin{tablenotes}[flushleft]
          \footnotesize
          \item \textit{Note.} This is a note!
    \end{tablenotes}
    \label{some label}
    \end{footnotesize}
    \end{threeparttable}
    \end{table}
\end{document}

通过此代码,我得到了以下形式的表格标题:

表 1.1.:我的表格标题。

我宁愿 - 按照 APA7 - 采用这种形式:

表 1.1

这是我的表格标题。

我怎样才能更改我的代码来实现这一点?

答案1

这种标题样式可以相对容易地在talltblr表格中实现,这是tabularray封装的写法threeparttable

\documentclass[twoside,
               titlepage=firstiscover,
               open=right, 11pt]{scrbook}
\usepackage{mathpazo}

\usepackage{tabularray}
\UseTblrLibrary{booktabs, counter}
\usepackage[skip=0ex, width=\linewidth,
            format=plain,
            font = {small, sf},
            labelfont = bf, labelsep = newline,
            singlelinecheck = off]{caption}
\NewTblrTheme{captionof}% needed that talltblr instead of own caption settings
                        % consider settings of the caption package 
{%
    \DefTblrTemplate{caption}{default}%
    {\addtocounter{table}{-1}%
     \captionof{table}{\InsertTblrText{caption}}%
    }
}


\begin{document}
    \begin{table}[!h]
    \begin{talltblr}[
  theme = captionof,            % <--- for considering caption package setup
caption = {My Table Title},
  label = {tab:???},
remark{Note:} = This is a note! % <--- "table notes"
                    ]{colspec = {@{}l *{4}{X[c]} @{}} }
    \toprule
\SetCell[r=2]{c}
    &   \SetCell[c=5]{c}   bla
        &   &   &   &           \\
    \midrule
this & is & some & really & random & text \\
    \midrule
bla & 0 & 1 & 2 & \textbf{3} & 4\\
blubb & 5 & 6 & 7 & 8 & 9\\
bla blubb & 10 & \textbf{11} & 12 & \textbf{13} & \textbf{14}\\
    \bottomrule
    \end{talltblr}
    \end{table}
\end{document}

在此处输入图片描述

附录: 自 2024 年 2 月起,将推出新的软件包tblr-extras,可使用该软件包在表格longtblr中轻松编写标题。talltblrcaption

我的第一次测试表明,它运行良好,并且通过使用语法使在表格longtblr中编写标题变得更加简单。talltblrcaption

Manuel E. Merino,非常感谢您送来的这个精美的包裹!

使用它,上述解决方案现在可以是:

\documentclass[twoside,
               titlepage=firstiscover,
               open=right, 11pt]{scrbook}
\usepackage{mathpazo}

\usepackage[skip=0ex, belowskip=0.5ex,
            format=plain,
            font = {small, sf},
            labelfont = bf, labelsep = newline,
            singlelinecheck = off]{caption}
\usepackage{tabularray}
\usepackage{tblr-extras}        % new package   
\UseTblrLibrary{booktabs, 
                caption}        % new library

\usepackage{lipsum}


\begin{document}
\lipsum[66]
    \begin{table}[ht]
\begin{talltblr}[
caption = {My Table Title},
  label = {tab:???},
remark{Note} = This is a note! % <--- "table notes"
                    ]{colspec = {@{}l *{5}{X[c]} @{}} }
    \toprule
\SetCell[r=2]{c}
    &   \SetCell[c=5]{c}   bla
        &   &   &   &           \\
    \midrule
this & is & some & really & random & text \\
    \midrule
bla & 0 & 1 & 2 & \textbf{3} & 4\\
blubb & 5 & 6 & 7 & 8 & 9\\
bla blubb & 10 & \textbf{11} & 12 & \textbf{13} & \textbf{14}\\
    \bottomrule
\end{talltblr}
    \end{table}    
\end{document}

编译结果为:

在此处输入图片描述

答案2

有了这个包,这很容易caption

    \documentclass[twoside, titlepage=firstiscover, open=right, 11pt]{scrbook}
    \usepackage[utf8]{inputenc}
    \usepackage{booktabs}
    \usepackage{mathpazo}
    \usepackage{graphicx}
    \usepackage{float}
    \usepackage{tabularx}
    \usepackage{threeparttablex}
    \usepackage[font=footnotesize, labelfont = bf]{caption}
    \newcolumntype{Y}{>{\centering\arraybackslash}X}
    \usepackage{threeparttable}
    \usepackage{caption}

    \begin{document}

     \begin{table}[!h]
        \begin{threeparttable}
    \captionsetup{belowskip=2ex, labelsep = newline}
        \begin{footnotesize}
        \caption{My Table Title\\}
        \begin{tabularx}{\columnwidth}{@{}lYYYYY@{}}
        \toprule
        & \multicolumn{5}{c}{bla}\\
        \cmidrule{2-6}
        this & is & some & really & random & text \\
        \midrule
        bla & 0 & 1 & 2 & \textbf{3} & 4\\
        blubb & 5 & 6 & 7 & 8 & 9\\
        bla blubb & 10 & \textbf{11} & 12 & \textbf{13} & \textbf{14}\\
        \bottomrule
        \end{tabularx}
        \begin{tablenotes}[flushleft]
              \footnotesize
              \item \textit{Note.} This is a note!
        \end{tablenotes}
        \label{some label}
        \end{footnotesize}
        \end{threeparttable}
        \end{table}

    \end{document} 

在此处输入图片描述

相关内容