更改长表中分布在多行上的单元格行之间的间距

更改长表中分布在多行上的单元格行之间的间距

我有一张跨两页的表格,所以用 编写longtable。我想为我的表格设置一个比论文其他部分更紧凑的行距。我使用了\renewcommand{\arraystretch}{0.8},它可以正确更改行之间的行距。但是,有些单元格的文本跨多行,而这些单元格的行距不会改变。我该如何修复它?

我知道一种方法是使用\setstretch{1.0}而不是\renewcommand{\arraystretch}{0.8}(来自线程),但是,当我使用包时,我正在使用的文档类会弹出太多错误 setspace

一个例子:

\renewcommand{\arraystretch}{0.8}
\begin{longtable}{lp{10cm}}
 \caption{Notations.} \label{table_notations} \\
    \toprule
    \textbf{Notation} & \textbf{Definition}\\
    
    \midrule
    Indices and sets: & \\
    
    Row & In this cell I have a very long definition that will requires three rows of my table. The space between these three rows is not changed, and so is larger than the space between other rows. \\
    
    & This is another row.\\
    
    & This is another row.\\
    
    & This is another row.\\
    
    \bottomrule
\end{longtable}

答案1

考虑@David Carlisle 在他的评论中的建议并使用tabularray包及其对X表中的列和使用的字体的定义:

\documentclass{article}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}% For dummy text filler

\usepackage{microtype}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}

\begin{document}
\lipsum[1]
    \begin{longtblr}[
caption = {Notations.}, 
  label = {table_notations}
                    ]{rowhead = 1,
                      colspec = {@{} l X[j, font=\linespread{0.84}\selectfont] @{}},
                      row{1}  = {font=\bfseries},
                     }
    \toprule
Notation    
    &   Definition          \\
    \midrule
Indices and sets: 
    &                       \\
Row & In this cell I have a very long definition that will requires three rows of my table. The space between these three rows is not changed, and so is larger than the space between other rows.   \\
    & This is another row.  \\
    & This is another row.  \\
    & \lipsum[66]  \\
    \bottomrule
\end{longtblr}
\end{document}

在此处输入图片描述

相关内容