![如何删除下表顶部的空白?](https://linux22.com/image/268749/%E5%A6%82%E4%BD%95%E5%88%A0%E9%99%A4%E4%B8%8B%E8%A1%A8%E9%A1%B6%E9%83%A8%E7%9A%84%E7%A9%BA%E7%99%BD%EF%BC%9F.png)
如何删除下表顶部的空白?
\documentclass[preview,border=0pt,varwidth]{standalone}
\usepackage[table]{xcolor}
\usepackage{array}
\usepackage{longtable}
\newcolumntype{A}[2]{%
>{\minipage{\dimexpr#1\linewidth-2\tabcolsep-#2\arrayrulewidth}\vspace\tabcolsep}%
c%
<{\vspace\tabcolsep\endminipage}%
}
\newcommand\correction[1]{%
\abovedisplayshortskip=#1\baselineskip\relax
\belowdisplayshortskip=#1\baselineskip\relax
\abovedisplayskip=#1\baselineskip\relax
\belowdisplayskip=#1\baselineskip\relax
}
\rowcolors{1}{cyan!20}{white}%
\arrayrulewidth=1pt\relax
%\topskip=0pt\relax
\begin{document}
\begin{longtable}{|*2{>{\arraybackslash\correction{-1}\strut\[}A{0.4}{1.5}<{\]\strut}|}}\hline
f(x) & f'(x)\\\hline
c & 0\\\hline
x^n & nx^{n-1}\\\hline
\ln x & \frac{1}{x}\\\hline
e^x & e^x\\\hline
a(x)b(x) & a'(x)b(x)+a(x)b'(x)\\\hline
\frac{a(x)}{b(x)} & \frac{a'(x)b(x)-a(x)b'(x)}{b^2(x)}\\
\hline
\end{longtable}
\end{document}
奖金:
因为我想成为一名最佳实践者,请尝试优化、简化和改进上述我的代码。
答案1
空白来自\LTpre
,在 之后将以下行添加到您的序言中\usepackage{longtable}
:
\setlength{\LTpre}{0pt}
也\LTpost
可以设置为0pt
,但standalone
似乎会删除页面末尾的这个空间。