0

I try to change the numbering and formatting of my table(s). Currently I am working with this

\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}

With this code I get a table caption of this form:

Table 1.1.: My table title.

I would rather - in accordance with APA7 - like to have this form:

Table 1.1

This is my table title.

How can I change my code to achieve this?

2 Answers 2

2

This caption style can be relative easy implemented in the talltblr table, which is tabularray package way to write threeparttables:

\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}

enter image description here

Addendum: From February 2024 is available new package tblr-extras which enables simple writing captions in longtblr and talltblr tables using caption package.

My first test of it shows, that it works fine and make writing of captions in the longtblr and talltblr tables much simpler by use of caption syntax.

Manuel E. Merino, thank you very much for this nice package!

Using it, above solution now can be:

\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}

Compilation result is:

enter image description here

4
  • you can also use caption captions and tabularray with tblr-extras and \UseTblrLibrary{caption}. It should apply caption style to all tall and long tblrs
    – Mane32
    Mar 8 at 6:28
  • @Mane32, I observe this new package but not tested it yet. Recently I'm to busy with some other obligation and unfortunately haven't spare time for testing it :-(. Anyway, thank you very much for remain me on it :-).
    – Zarko
    Mar 8 at 6:41
  • @Mane32, your package is super! Thank you very much for it.
    – Zarko
    Mar 9 at 7:34
  • +1: Great showcase of the new package Mar 9 at 7:49
0

This is easy with the caption package:

    \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} 

enter image description here

5
  • Thank you for your answer but surprisingly that does not work. It is still all in one line. "belowskip=2ex" has an effect but "labelsep=newline" does not. Any ideas how to fix that?
    – offline
    Sep 14, 2022 at 13:28
  • Not really, since I loaded your code and only added the caption package loading. Did you load caption as the last package, as I did in my code?
    – Bernard
    Sep 14, 2022 at 13:31
  • Yes, I did. This is really strange ... Thank you anyway! Maybe one more question: I do not want Table Number and Table Title to be centered. How can I change this?
    – offline
    Sep 14, 2022 at 13:36
  • Never mind. Now it works. There was a problem with my label. Still, there is my open question about the centering. Any ideas?
    – offline
    Sep 14, 2022 at 13:45
  • @offline: I tried various possibilities with caption, such as justification=raggedright or singlelinecheck=false, but they didn't work. Maybe this is due to the threeparttable environment?
    – Bernard
    Sep 14, 2022 at 15:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .