`longtable` 和 `tabularx` 使用 `X` 类型列包裹长单元格

`longtable` 和 `tabularx` 使用 `X` 类型列包裹长单元格

tabularx X使用列类型的最佳方法是什么longtable?我读过这里表列是“古老的”,同一篇文章也提到了,tabu但它的提到该包可能没有得到妥善维护。所以我想知道,哪种方式是首选方式?(我也想避免手动处理多列)

答案1

我的新 LaTeX3 包tabularray是过时软件包的替代品tabu。您可以在环境中使用X列。longtblr

\documentclass[12pt]{article}
\usepackage[a6paper,margin=10mm]{geometry}
\pagestyle{empty}

\usepackage{tabularray}
\usepackage{xcolor}
\usepackage{hyperref}
\hypersetup{colorlinks}

\begin{document}

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text.
\NewTblrTheme{fancy}{
  \SetTblrStyle{firsthead}{font=\bfseries}
  \SetTblrStyle{firstfoot}{fg=blue}
  \SetTblrStyle{caption-tag}{red}
}
\begin{longtblr}[
  theme = fancy,
  caption = {Long Tabular},
  entry = {Short Caption},
  label = {tblr:test},
  note{a} = {It is the first footnote.},
  note{$\dag$} = {It is the second long long long long long long footnote.},
]{
  colspec = {XXX}, hlines,
  rowhead = 2, rowfoot = 1,
  row{odd} = {gray9}, row{even} = {teal9},
  row{1-2} = {purple7}, row{Z} = {blue7},
}
 Head    & Head  & Head    \\
 Head    & Head  & Head    \\
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta\TblrNote{a}       & Eta    \\
 Iota    & Kappa\TblrNote{$\dag$} & Lambda \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Alpha   & Beta  & Gamma   \\
 Epsilon & Zeta  & Eta     \\
 Iota    & Kappa & Lambda  \\
 Nu      & Xi    & Omicron \\
 Rho     & Sigma & Tau     \\
 Phi     & Chi   & Psi     \\
 Foot    & Foot  & Foot    \\
\end{longtblr}
Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text.

\end{document}

在此处输入图片描述

相关内容