表格 CSS,例如 padding-bottom

表格 CSS,例如 padding-bottom

有没有办法在表格末尾留一个小间隙?类似于 CSS 属性 padding-bottom

\documentclass[16pt]{article}
\usepackage{microtype}
\usepackage[a4paper]{geometry}
\geometry{a4paper,margin=15mm,bindingoffset=2mm,heightrounded,}
\usepackage{chemfig}
\usepackage[version=3]{mhchem}
\usepackage{fixltx2e}
\usepackage{hyperref}
\usepackage{changepage}
\usepackage{array,amsmath,booktabs}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\definecolor{lightgray}{HTML}{EFEFEF}

\begin{document}
\renewcommand{\arraystretch}{1.6}

\begingroup\setlength{\fboxsep}{0pt}
\def\arraystretch{2.0}
\colorbox{lightgray}{%
\begin{tabular}[t]{l}

DERIVATE\\
\newcommand\B{\rule[6.2ex]{6pt}{7pt}}
$\bullet \; \displaystyle \frac{d}{dx}\;a= 0$ \\

\textcolor{blue}{$\bullet\;\displaystyle \frac{d}{dx}\;x= 1$ }\\

$\bullet \; \displaystyle \frac{d}{dx}\;ax^n= a\cdot nx^{n-1}$ \\

\textcolor{blue}{$\bullet\; \displaystyle \frac{d}{dx}\;ln\;x= \frac{1}{x},\; x > 0$ }\\

$\bullet \; \displaystyle \frac{d}{dx}\;log_{a}\;x= \frac{1}{x\;ln\;a} = \frac{log_{a}\;e}{x}, \;x > 0$ \\

\textcolor{blue}{$\bullet\; \displaystyle \frac{d}{dx}\;sen\;x = cos\;x$ }\\

$\bullet \; \displaystyle \frac{d}{dx}\;cos\;x = -sen\;x$\\

\end{tabular}%
}\endgroup
\quad

\end{document}

表格是灰色背景的表格 表格是灰色背景的表格

答案1

您使用的工具不对。请注意\;:如果您在文档中多次使用 ,则需要修复某些问题。在这种情况下,问题在于您没有使用正确的命令。

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}
\usepackage[
  a4paper,
  margin=15mm,
  bindingoffset=2mm,
  heightrounded,
]{geometry}

\usepackage{amsmath}
\usepackage{microtype}
\usepackage{xcolor}
\usepackage{varwidth}
\usepackage{enumitem}
\usepackage{hyperref}

\definecolor{lightgray}{HTML}{EFEFEF}
\DeclareMathOperator{\sen}{sen}

\begin{document}

\begingroup\setlength{\fboxsep}{6pt}
\colorbox{lightgray}{%
  \begin{varwidth}{\textwidth}
  DERIVATE
  \begin{itemize}[leftmargin=*]

  \item $\dfrac{d}{dx}a= 0$

  \item \textcolor{blue}{$\dfrac{d}{dx}x = 1$}

  \item $\dfrac{d}{dx}ax^n = anx^{n-1}$

  \item \textcolor{blue}{$\dfrac{d}{dx}\ln x = \dfrac{1}{x}$, $x > 0$}

  \item $\dfrac{d}{dx}\log_{a}x = \dfrac{1}{x\ln a} = \dfrac{\log_{a}e}{x}$, $x > 0$

  \item \textcolor{blue}{$\dfrac{d}{dx}\sen x = \cos x$}

  \item $\dfrac{d}{dx}\cos x = -\sen x$

  \end{itemize}
  \end{varwidth}%
}\endgroup

\end{document}

在此处输入图片描述

答案2

您可以在最后一行添加一个负支撑:

在此处输入图片描述

\documentclass{article}

\usepackage{array,amsmath,xcolor}

\definecolor{lightgray}{HTML}{EFEFEF}

\newcommand{\dx}{\mathrm{d}x}
\newcommand{\ddx}{\frac{\mathrm{d}}{\dx}}

\begin{document}

\setlength{\fboxsep}{0pt}%
\renewcommand{\arraystretch}{2}%
\colorbox{lightgray}{%
  $\begin{array}{ >{\bullet~\displaystyle} l }
    \multicolumn{1}{l}{\mbox{DERIVATE}} \\
    \ddx a = 0 \\
    \color{blue} \ddx x = 1 \\
    \ddx a x^n = a \cdot n x^{n - 1} \\
    \color{blue} \ddx \ln x = \frac{1}{x},\ x > 0 \\
    \ddx \log_a x = \frac{1}{x \ln a} = \frac{\log_a e}{x},\ x > 0 \\
    \color{blue} \ddx \sin x = \cos x \\
    \ddx \cos x = -\sin x
    \rule[-1.2\normalbaselineskip]{0pt}{0pt}% negative strut to have bottom row extend further down
  \end{array}$%
}

\end{document}

我删除了所有手动间距(代替 TeX 在操作符/操作数周围的自然间距)并使表格格式自动化(插入项目符号)。

相关内容