为什么在环境中可以工作\caption
和\label
不工作longtblr
(见图片)?我在标题文档中找不到有关长表的任何具体信息。
\documentclass[
12pt,
a4paper,
parskip=half,
toc=bibliography,
numbers=noendperiod
]{scrbook}
\usepackage[
left=3cm,
right=2.5cm,
top=2.5cm,
bottom=2.0cm,
includehead,
includefoot
]{geometry}
\usepackage[UKenglish]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{scrlayer-scrpage}
\usepackage{lmodern}
\usepackage{textcomp}
\usepackage{lscape}
\usepackage{makecell}
\usepackage[onehalfspacing]{setspace}
\usepackage[inline]{enumitem}
\usepackage{float}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{tabularx, ragged2e}
\usepackage{siunitx}
\usepackage{longtable}
\usepackage[longtable]{multirow}
\usepackage{multicol}
\addtokomafont{caption}{\scriptsize}
\usepackage[font={normal}]{caption}
\captionsetup[table]{labelsep=space, justification=raggedright, singlelinecheck=off}
\usepackage[flushleft]{threeparttable}
\setkomafont{captionlabel}{\bfseries\rmfamily}
\renewcommand*\dictumwidth{0.72\linewidth}
\usepackage[skip=10pt]{parskip}
\usepackage{array}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, varwidth}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}p{#1}}
\newcolumntype{P}[1]{>{\endgraf\vspace*{-\baselineskip}}p{#1}}
\newcommand{\abbrlabel}[1]{\makebox[4cm][l]{\textbf{#1}\ \tocfill}}
\newcommand{\rr}{\raggedright}
\newcommand{\tn}{\tabularnewline}
\raggedbottom
\singlespacing\label{key}
\begin{document}
\begin{landscape}
\footnotesize
\setlist[itemize]{nosep,leftmargin=*}
\SetTblrStyle{contfoot}{font=\footnotesize\itshape}
{\def\arraystretch{2}\tabcolsep=10pt
\begin{longtblr}
[
\setlength\extrarowheight{-3pt}
caption = {Characteristics of pressure driven membrane processes},
entry = {Characteristics of pressure driven membrane processes},
label = {tab:pressuredriven},
]{colspec = {@{} X[1,l] *{4}{X[l]} @{}},
stretch = -1, %<--- remove extra space above and below lists
% with nosep option; doc p.51 tabularray
rowsep = 5pt,
rowhead = 1,
measure = vbox,
}
\toprule
& A
& B
& C
& D \\
\midrule
E&F&G&&I\\
E&F&G&H&I\\
E&F&G&H&I\\
\bottomrule
\end{longtblr}
}
\end{landscape}
\end{document}
答案1
该包tabularray
似乎会默默忽略未定义的键,导致输出毫无意义且没有任何警告。例如
\documentclass{article}
\usepackage{tabularray}
\begin{document}
\begin{longtblr}[caption=foo,some nonsense]{colspec={ll}}
a & b
\end{longtblr}
\end{document}
运行没有问题,但产生
在我看来,这是一个非常值得怀疑的设计选择。
longtblr
就你的情况而言,在可选参数中
\begin{longtblr}
[
\setlength\extrarowheight{-3pt}
caption = {Characteristics of pressure driven membrane processes},
% ...
]{...}
并且杂散部分\setlength\extrarowheight{-3pt}
被解释为“关键”的一部分\setlength\extrarowheight{-3pt} caption
,然后它什么也不做(显然)只是吞下标题。