feat: add tabularray

This commit is contained in:
jackfiled 2025-04-18 14:39:26 +08:00
parent a587dceb99
commit b9e5e56b5d
2 changed files with 39 additions and 2 deletions

View File

@ -181,6 +181,9 @@ pdfborder=001, linkcolor=black, citecolor=black, urlcolor=black]{hyperref} %
\usepackage{array,booktabs,multirow} % multirow, multicolumn and more professional format support
\usepackage{tabularx} % deal with text wrapping in tables
\usepackage{longtable}
\usepackage{tabularray}
\usepackage{tblr-extras}
\usepackage{caption}
\usepackage[labelformat=simple]{subcaption}
@ -199,6 +202,21 @@ pdfborder=001, linkcolor=black, citecolor=black, urlcolor=black]{hyperref} %
% 外文文献中表、图、公式、代码编号重置
\newcommand{\newtranschapter}{\thispagestyle{empty}\addtocounter{chapter}{1}\setcounter{table}{0}\setcounter{equation}{0}\setcounter{figure}{0}\setcounter{lstlisting}{0}}
% Tabularray 设置
\SetTblrStyle{contfoot-text}{font=\kaishu\zihao{5}}
\SetTblrStyle{caption-tag}{font=\kaishu\zihao{5}}
\SetTblrStyle{caption-text}{font=\kaishu\zihao{5}}
\DeclareTblrTemplate{contfoot-text}{default}{接下页}
\DeclareTblrTemplate{caption-sep}{default}{ }
\DeclareTblrTemplate{conthead-text}{default}{续表}
\DefTblrTemplate{firsthead,middlehead,lasthead}{default}{}
% \DefTblrTemplate{firstfoot,middlefoot}{default}{} % <---
\DefTblrTemplate{lastfoot}{default}% % <---
{
\UseTblrTemplate{caption}{default}
}
% equation tweaking
\usepackage{amssymb}
\usepackage{bm} % 加粗使用
@ -319,4 +337,4 @@ pdfborder=001, linkcolor=black, citecolor=black, urlcolor=black]{hyperref} %
% with a paragraph and no extra blank before, in or after the list.
%\setlist[itemize]{labelindent=\parindent,leftmargin=*,noitemsep,topsep=0pt}
% Modify the label format by yourself if you do not like 1), 2), ... here.
%\setlist[enumerate]{labelindent=\parindent,leftmargin=*,noitemsep,topsep=0pt,label={\arabic*)}}
%\setlist[enumerate]{labelindent=\parindent,leftmargin=*,noitemsep,topsep=0pt,label={\arabic*)}}

View File

@ -131,4 +131,23 @@ chapter2.tex中
### 如何统计字数
见[issue#5](https://github.com/jackfiled/BUPTBachelorThesis/issues/5#issue-2992316613)
见[issue#5](https://github.com/jackfiled/BUPTBachelorThesis/issues/5#issue-2992316613)
### 需要排版跨页的表格使用什么环境?
使用`tabularray`包提供的`longtblr`环境,一个例子如下:
```latex
\begin{longtblr}[
caption = {基本块构建器提供的接口},
label = {tab:basicblock-builder-interface}
]{
colspec = {|p{4cm}|X[2,l]|X[1,l]|X[2,l]|},
rowhead = 1, % 重复表头
}
\hline
\textbf{接口名称} & \textbf{参数} & \textbf{返回值} & \textbf{接口功能说明} \\
\hline
% 这里是表格内容
\end{longtblr}
```