无法使用 tabularray longtblr 控制分页符

无法使用 tabularray longtblr 控制分页符

目的

我在 overleaf 上做一个项目。我有下面表格的代码,这是一个跨多页的表格。到目前为止一切顺利。问题是由于第一列包含多行单元格,表格应该只在整个多行单元格之后进行分页,例如,在 s04 之后。我想告诉 latex 它可以在每个“组”(如第一列中定义)之后进行分页。我还希望每次我在论文中添加或删除表格上方的文本时,我的文档不会中断(没有双关语的意思)。

问题

但是,\pagebreak无论我将它放在哪里,插入都不会在我的代码中执行任何操作。

我尝试过

我尝试过添加和删除\\*\\,但似乎没有任何影响。\pagebreak在多个地方尝试过,也没有用。请帮帮我,我真的很茫然。

代码

\documentclass{article}

\usepackage{lipsum}
\usepackage{multirow}
\usepackage[export]{adjustbox}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\begin{document}

\section{Introduction}
\lipsum[1]

\begin{longtblr}[
    label={tab:codes},
    caption={Codes based on the conducted interviews.},
    ]{
    width=1\linewidth,
    colspec={ Q[1] Q[1,c,m] Q[2,c,m] Q[4,l,h] },
    row{1} = { font=\bfseries }
    }
    \toprule
    Groups & ID & Subcodes & \SetCell{c}Explanation\\*
    \midrule
    \SetCell[r=4]{c} \rotatebox[origin=c]{90}{Reliabil\-ity and Security}
    & s01 & Access Control & The option to assign different rights of access for different users or teams. This includes encapsulated environments that protect a team from critical errors made by another team.\\*
    \midrule
    & s02 & Encryption & The method that is used to encrypt data in conjunction with services that can handle encrypted data.\\*
    \midrule
    & s03 & Compliance and Certification & Certification by an independent third party insures that requirements for security and compliance are fulfilled. \\*
    \midrule
    & s04 & Data Replication and Backup & Creation of backup copies of customer data, code, and models, including repllication accross multiple locations.\\
    \midrule
    \pagebreak
    \SetCell[r=4]{c} \rotatebox[origin=c]{90}{Performance}
    & s05 & Execution Speed & The runtime of a service until it provides a result. Mainly driven by inference time.\\*
    \midrule
    & s06 & Model Performance & The quality of the model output, measured in accuracy, F1 score, or others.\\*
    \midrule
    & s07 & Geo-Spatial Location of Data & The geographic locations where the data reside or the services run.\\*
    \midrule
    & s08 & Scalability & The ability for a service to increase or decrease its usage of computational power based on the current usage. Includes deploying the service to more machines.\\
    \midrule
    \SetCell[r=3]{c} \rotatebox[origin=c]{90}{Ease of Use}
    & s12 & Entry barrier & The hoops potential customers need to go through before they can use the service.\\*
    \midrule
    & s13 & Access to Third Party Apps & The possibility for third party developers to provide additional services and plugins complementary to the services of the provider. Often provided via a central marketplace.\\*
    \midrule
    & s14 & Create Applications with Few Clicks & The ability to create a minimal working application with few clicks. Most settings for such an application are pre-configured.\\
    \midrule
    \SetCell[r=3]{c} \rotatebox[origin=c]{90}{Relation to Competing Products}
    & s09 & Degree of Integration with other Services & The integration of third party services into the provider's products.\\*
    \midrule
    & s10 & Treatment of Downstream Services & The treatment of services that build upon the own provided services.\\*
    \midrule
    & s11 & Flexibility of Product Choice & The different ways a customer can accomplish a task when using a specific AIaaS product or product family.\\
    \midrule
    \SetCell[r=4]{c} \rotatebox[origin=c]{90}{Functionalities}
    & s15 & Offered Model Size & The model size can be measured by the number of parameters, FLOPs/MACs, or the storage size of the parameters.\\*
    \midrule
    & s16 & Complexity and Variety of Functionalities & The number of possible configurations,the workload types, the types of AI capabilities, such as labelling, MLOps, and data augmentation, and others, of a service.\\*
    \midrule
    & s17 & General Methods and Specialized Methods & Methods that have very niche use-cases but are highly optimized for those. In contrast to methods that are widely applicable to many tasks.\\*
    \midrule
    & s18 & Explainability and Transparency & Methods that provide explanations behind outputs of the AI services.\\*
\end{longtblr}

\end{document}

答案1

您只需要使用\\*来防止这些行之后出现分页符。 而\pagebreak在您的示例中不需要。

我还在您的代码中添加了rowhead=1和,并删除了不必要的内容。\bottomrule\usepackage{multirow}

\documentclass{article}

\usepackage{lipsum}
\usepackage[export]{adjustbox}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\begin{document}

\section{Introduction}
\lipsum[1]

\begin{longtblr}[
    label={tab:codes},
    caption={Codes based on the conducted interviews.},
]{
    width=\linewidth,
    colspec={ Q[1] Q[1,c,m] Q[2,c,m] Q[4,l,h] },
    row{1} = { font=\bfseries },
    rowhead = 1,
}
    \toprule
    Groups & ID & Subcodes & \SetCell{c}Explanation\\*
    \midrule
    \SetCell[r=4]{c} \rotatebox[origin=c]{90}{Reliabil\-ity and Security}
    & s01 & Access Control & The option to assign different rights of access for different users or teams. This includes encapsulated environments that protect a team from critical errors made by another team.\\*
    \midrule
    & s02 & Encryption & The method that is used to encrypt data in conjunction with services that can handle encrypted data.\\*
    \midrule
    & s03 & Compliance and Certification & Certification by an independent third party insures that requirements for security and compliance are fulfilled. \\*
    \midrule
    & s04 & Data Replication and Backup & Creation of backup copies of customer data, code, and models, including repllication accross multiple locations.\\
    \midrule
    \SetCell[r=4]{c} \rotatebox[origin=c]{90}{Performance}
    & s05 & Execution Speed & The runtime of a service until it provides a result. Mainly driven by inference time.\\*
    \midrule
    & s06 & Model Performance & The quality of the model output, measured in accuracy, F1 score, or others.\\*
    \midrule
    & s07 & Geo-Spatial Location of Data & The geographic locations where the data reside or the services run.\\*
    \midrule
    & s08 & Scalability & The ability for a service to increase or decrease its usage of computational power based on the current usage. Includes deploying the service to more machines.\\
    \midrule
    \SetCell[r=3]{c} \rotatebox[origin=c]{90}{Ease of Use}
    & s12 & Entry barrier & The hoops potential customers need to go through before they can use the service.\\*
    \midrule
    & s13 & Access to Third Party Apps & The possibility for third party developers to provide additional services and plugins complementary to the services of the provider. Often provided via a central marketplace.\\*
    \midrule
    & s14 & Create Applications with Few Clicks & The ability to create a minimal working application with few clicks. Most settings for such an application are pre-configured.\\
    \midrule
    \SetCell[r=3]{c} \rotatebox[origin=c]{90}{Relation to Competing Products}
    & s09 & Degree of Integration with other Services & The integration of third party services into the provider's products.\\*
    \midrule
    & s10 & Treatment of Downstream Services & The treatment of services that build upon the own provided services.\\*
    \midrule
    & s11 & Flexibility of Product Choice & The different ways a customer can accomplish a task when using a specific AIaaS product or product family.\\
    \midrule
    \SetCell[r=4]{c} \rotatebox[origin=c]{90}{Functionalities}
    & s15 & Offered Model Size & The model size can be measured by the number of parameters, FLOPs/MACs, or the storage size of the parameters.\\*
    \midrule
    & s16 & Complexity and Variety of Functionalities & The number of possible configurations,the workload types, the types of AI capabilities, such as labelling, MLOps, and data augmentation, and others, of a service.\\*
    \midrule
    & s17 & General Methods and Specialized Methods & Methods that have very niche use-cases but are highly optimized for those. In contrast to methods that are widely applicable to many tasks.\\*
    \midrule
    & s18 & Explainability and Transparency & Methods that provide explanations behind outputs of the AI services.\\
    \bottomrule
\end{longtblr}

\end{document}

在此处输入图片描述

答案2

对于您的餐桌布置,有一些题外的建议,它们展示了另一种书写餐桌的方式:

  • rotating对于单元格使用和包中的旋转内容makecell
  • 使用hline{1,Z} = 1pt, hline{2-Y} = {solid},而不是booktabs包中定义的规则(由加载UseTblrLibrary{booktabs}
  • 最后两列使用X列类型
  • 页面之间的表格分隔符以与@LJR 答案中相同的方式启用
\documentclass{article}
\usepackage{lipsum}

\usepackage{rotating}   % needed
\usepackage{makecell}   % needed
\usepackage{tabularray}

\begin{document}

\section{Introduction}
\lipsum[66]

\begingroup
\settowidth\rotheadsize{Competing Products}
\renewcommand\cellalign{cc}
\begin{longtblr}[
    caption={Codes based on the conducted interviews.},
    label={tab:codes}, % had to be after caption?
                ]{
      hline{1,Z} = 1pt, hline{2-Y} = {solid},
         colspec = {@{} Q[c,m] Q[c,m] X[c,m] X[2,j,h] @{}},
    cell{2-Z}{1} = {cmd=\rotcell[cc]},
          row{1} = {font=\bfseries, c},
         rowhead = 1,
                  }
Groups & ID & Subcodes &    Explanation     \\*
\SetCell[r=4]{c}    Reliability and Security
    & s01   & Access Control
                & The option to assign different rights of access for different users or teams. This includes encapsulated environments that protect a team from critical errors made by another team.\\*
    & s02   & Encryption
                & The method that is used to encrypt data in conjunction with services that can handle encrypted data.\\*
    & s03   & Compliance and Certification
                & Certification by an independent third party insures that requirements for security and compliance are fulfilled. \\*
    & s04   & Data Replication and Backup
                & Creation of backup copies of customer data, code, and models, including replication across multiple locations.\\
\SetCell[r=4]{c,m}    Performance
    & s05   & Execution Speed
                & The runtime of a service until it provides a result. Mainly driven by inference time.\\*
    & s06   & Model Performance
                & The quality of the model output, measured in accuracy, F1 score, or others.\\*
    & s07   & Geo-Spatial Location of Data
                & The geographic locations where the data reside or the services run.\\*
    & s08   & Scalability
                & The ability for a service to increase or decrease its usage of computational power based on the current usage. Includes deploying the service to more machines.\\
\SetCell[r=3]{c,m}    Ease of Use
    & s12   & Entry barrier
                & The hoops potential customers need to go through before they can use the service.\\*
    & s13   & Access to Third Party Apps
                & The possibility for third party developers to provide additional services and plugins complementary to the services of the provider. Often provided via a central marketplace.\\*
    & s14   & Create Applications with Few Clicks
                & The ability to create a minimal working application with few clicks. Most settings for such an application are pre-configured.\\
\SetCell[r=3]{c,m}    {Relation to\\ Competing Products}
    & s09   & Degree of Integration with other Services
                & The integration of third party services into the provider's products.\\*
    & s10   & Treatment of Downstream Services
                & The treatment of services that build upon the own provided services.\\*
    & s11 & Flexibility of Product Choice & The different ways a customer can accomplish a task when using a specific AIaaS product or product family.\\
\SetCell[r=4]{c,m}    Functionalities
    & s15   & Offered Model Size
                & The model size can be measured by the number of parameters, FLOPs/MACs, or the storage size of the parameters.\\*
    & s16   & Complexity and Variety of Functionalities
                & The number of possible configurations,the workload types, the types of AI capabilities, such as labelling, MLOps, and data augmentation, and others, of a service.\\*
    & s17   & General Methods and Specialized Methods
                & Methods that have very niche use-cases but are highly optimized for those. In contrast to methods that are widely applicable to many tasks.\\*
    & s18   & Explainability and Transparency
                & Methods that provide explanations behind outputs of the AI services.\\
    \end{longtblr}
\endgroup
\end{document}

在此处输入图片描述

相关内容