将长标题放在表格下方

将长标题放在表格下方

默认情况下,longtblr的环境tabularray有一个caption将标题放在表格上方的参数:

\begin{table}
    \centering
    \begin{longtblr}[
        caption = {A breakable longtblr environment.}
    ]{
        colspec = {|cccc|},
        rowhead = 1,
    }
        \hline
        A & B & C & D \\
        \hline
        Value 1 & Value 2 & Value 3 & Value 4 \\
        \hline
        \pagebreak
        Value 5 & Value 6 & Value 7 & Value 8 \\
        \hline
    \end{longtblr}
\end{table}

如何将重复的表格标题放在A breakable longtblr environment.每个单独的表格下方?

答案1

\documentclass{article}

\usepackage{tabularray}

\DefTblrTemplate{firsthead,middlehead,lasthead}{default}{
}
\DefTblrTemplate{firstfoot}{default}{
  \UseTblrTemplate{contfoot}{default}
  \UseTblrTemplate{caption}{default}
}
\DefTblrTemplate{middlefoot}{default}{
  \UseTblrTemplate{contfoot}{default}
  \UseTblrTemplate{capcont}{default}
}
\DefTblrTemplate{lastfoot}{default}{
  \UseTblrTemplate{note}{default}
  \UseTblrTemplate{remark}{default}
  \UseTblrTemplate{capcont}{default}
}


\begin{document}

    \centering
    \begin{longtblr}[
        caption = {A breakable longtblr environment.}
    ]{
        colspec = {|cccc|},
        rowhead = 1,
    }
        \hline
        A & B & C & D \\
        \hline
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 5 & Value 6 & Value 7 & Value 8 \\
        \hline
    \end{longtblr}

\end{document}

在此处输入图片描述 在此处输入图片描述

答案2

这种变化Pieter van Oostrum 的精彩回答也照顾longtblr不是分为几页:

\documentclass{article}
\usepackage[margin=2cm, paper width=12cm, paper height=12cm]{geometry}
\usepackage{tabularray}

\DefTblrTemplate{firsthead,middlehead,lasthead}{default}{
}
\DefTblrTemplate{firstfoot}{default}{
  \UseTblrTemplate{contfoot}{default}
  \UseTblrTemplate{caption}{default}
}
\DefTblrTemplate{middlefoot}{default}{
  \UseTblrTemplate{contfoot}{default}
  \UseTblrTemplate{capcont}{default}
}
\ExplSyntaxOn
\DefTblrTemplate{lastfoot}{default}{
  \UseTblrTemplate{note}{default}
  \UseTblrTemplate{remark}{default}
  \int_compare:nNnTF { \l__tblr_table_page_int } = {1} {
    \UseTblrTemplate{caption}{default}
  } {
    \UseTblrTemplate{capcont}{default}
  }
}
\ExplSyntaxOff

\begin{document}

    \centering
    \begin{longtblr}[
        caption = {A breakable longtblr environment.}
    ]{
        colspec = {|cccc|},
        rowhead = 1,
    }
        \hline
        A & B & C & D \\
        \hline
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        \hline
    \end{longtblr}

    \bigskip

    \begin{longtblr}[
        caption = {A breakable longtblr environment.}
    ]{
        colspec = {|cccc|},
        rowhead = 1,
    }
        \hline
        A & B & C & D \\
        \hline
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        Value 1 & Value 2 & Value 3 & Value 4 \\
        \hline
    \end{longtblr}

\end{document}

在此处输入图片描述 在此处输入图片描述 在此处输入图片描述

相关内容