类似地如何删除 longtable 顶部和底部的空格?,我想知道如何删除 longtblr 的顶部和底部空格,即文本(前后)和 longtblr 之间的空格(除非\vspace*{-\baselineskip}
或类似的东西是唯一的方法)。这是我的 MWE:
\documentclass{article}
\usepackage[a4paper,margin=0.1cm]{geometry}
\usepackage{tabularray}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\DefTblrTemplate{firsthead, middlehead,lasthead}{default}{}
\begin{longtblr}{ colspec = {|X|X|},hlines}
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
\end{longtblr}
\lipsum[1]
\end{document}
我尝试了与上述与“longtable”相关的问题相同的解决方法,即添加\setlength{\LTpre}{0pt} \setlength{\LTpost}{0pt}
,但它不起作用并且我收到错误Undefined control sequence
:
\documentclass{article}
\usepackage[a4paper,margin=0.1cm]{geometry}
\usepackage{tabularray}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\setlength{\LTpre}{0pt}
\setlength{\LTpost}{0pt}
\DefTblrTemplate{firsthead, middlehead,lasthead}{default}{}
\begin{longtblr}{ colspec = {|X|X|},hlines}
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
\end{longtblr}
\lipsum[1]
\end{document}
答案1
您可以使用presep
和postsep
选项来更改上方和下方的空间longtblr
:
\documentclass{article}
\usepackage[a4paper,margin=0.1cm]{geometry}
\usepackage{tabularray}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\DefTblrTemplate{firsthead, middlehead,lasthead}{default}{}
\begin{longtblr}[presep=0pt,postsep=0pt]{ colspec = {|X|X|},hlines}
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
First variable & Second variable \\
\end{longtblr}
\lipsum[1]
\end{document}