我是一个 LaTeX 初学者,正在寻找在表格下方添加脚注的可能性,我偶然发现了好矩阵包。这个包基本上结合了我在文档中生成表格所需的一切。我唯一缺少的是将标题宽度调整到表格宽度的可能性。我尝试使用包浮行在标题包手册,但这会弄乱 NiceMatrix 生成的表格脚注(它们根本不再出现在文档中)。由于表格脚注已经适合表格宽度,我希望有类似的方法来实现这一点。对于大多数表格来说,这不是问题,因为标题的宽度比表格小,但在下面显示的示例中,它看起来不太符合我的口味。
整个文档是使用 LuaLaTeX 编译的,但我不认为这里是强制性的。
\documentclass[captions=tableheading,captions=figuresignature]{scrreprt}
\usepackage{caption} [2022/02/20]
\captionsetup{%
format=hang,%
labelsep=period%
}
\addtokomafont{caption}{\small}
\setkomafont{captionlabel}{\sffamily\bfseries}
\usepackage{booktabs}
\usepackage{nicematrix}
\NiceMatrixOptions{%
cell-space-limits = 2pt,%
notes/code-before = \footnotesize%
}
\usepackage{enumitem}
\usepackage{siunitx}
\newcolumntype{A}[1]{%
S[%
table-number-alignment = center,%
table-format = #1%
]%
}
\begin{document}
\begin{table}[ht]
\caption{This is a long long long caption that needs to be fitted to the
table width}
\label{tab:Activity}
\centering
\begin{NiceTabular}{@{}l!{\qquad}@{}A{1.1e1}!{\qquad}A{1.1e1}@{}}
\toprule
\Block{2-1}{Nuclide} & \Block{1-2}{Maximal activity in \unit{Bq}} \\
\cmidrule(lr){2-3}
& {Material~1} & {Material~2} \\
\midrule
$^{99}\mathrm{Tc}$\tabularnote{This is a long long long tabular note
that is already fitted to the table width.}
& 10.1e9 & 1.1e5 \\
\bottomrule
\end{NiceTabular}
\end{table}
\end{document}
有人能帮助我实现我想要实现的目标吗?
此外,由于我是 LaTeX 初学者,请随意提及并纠正我在上面代码中所做的愚蠢的事情。
非常感谢,塞巴斯蒂安
答案1
最新版本nicematrix
(2022-07-28 的 v 6.12) 提供了一个键“caption”,用于在表格宽度处换行的标题。
\documentclass[captions=tableheading]{scrreprt}
\addtokomafont{caption}{\small}
\setkomafont{captionlabel}{\sffamily\bfseries}
\usepackage{booktabs}
\usepackage{nicematrix}
\NiceMatrixOptions{%
cell-space-limits = 2pt,
notes/code-before = \footnotesize ,
caption-above
}
\usepackage{enumitem}
\usepackage{siunitx}
\newcolumntype{A}[1]{%
S[%
table-number-alignment = center,%
table-format = #1%
]%
}
\begin{document}
\begin{table}[ht]
\centering
\label{tab:Activity}
\begin{NiceTabular}
[caption = {This is a long long long caption that needs to be fitted to the table width}]
{@{}l!{\qquad}@{}A{1.1e1}!{\qquad}A{1.1e1}@{}}
\toprule
\Block{2-1}{Nuclide} & \Block{1-2}{Maximal activity in \unit{Bq}} \\
\cmidrule(lr){2-3}
& {Material~1} & {Material~2} \\
\midrule
$^{99}\mathrm{Tc}$\tabularnote{This is a long long long tabular note that is already fitted to the table width.} & 10.1e9 & 1.1e5 \\
\bottomrule
\end{NiceTabular}
\end{table}
\end{document}
与往常一样nicematrix
,您需要进行多次编译。