Sunday, 19 May 2013

How to remove the white space on the top of the following table?

How to remove the white space on the top of the following table?

How to remove the white space on the top of the following table?

\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}
Bonus:
As I want to be a best practitioner, please kindly try to optimize, simplify, improve my code above.

No comments:

Post a Comment