![如何增加长表单元格中方程式下方和上方的空间](https://linux22.com/image/437408/%E5%A6%82%E4%BD%95%E5%A2%9E%E5%8A%A0%E9%95%BF%E8%A1%A8%E5%8D%95%E5%85%83%E6%A0%BC%E4%B8%AD%E6%96%B9%E7%A8%8B%E5%BC%8F%E4%B8%8B%E6%96%B9%E5%92%8C%E4%B8%8A%E6%96%B9%E7%9A%84%E7%A9%BA%E9%97%B4.png)
下面是我的代码:
\documentclass[11pt,oneside,openany]{book}
\usepackage[a4paper, left=1.5cm, right=1.5cm, top=3cm, bottom=3cm]{geometry}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{longtable}
\begin{document}
\begin{longtable}{|p{1.7cm}|p{3.6cm}|p{2.8cm}|p{4cm}|}
\hline
\bfseries $ t $&\bfseries $ D_{t} $&\bfseries $ ABCD $&\bfseries $ sdf$ \\ \hline \hline
\endfirsthead
\hline
\bfseries $ t $&\bfseries $ D_{t} $&\bfseries $ TV=P_{n_{1}+n_{2}} $&\bfseries $ PV $ \\ \hline \hline
\endhead
\hline \multicolumn{4}{r}{\emph{Continued on next page}}
\endfoot
\hline
\endlastfoot
1& & &$ \dfrac{D_{1}}{(1+K_{r_{1}})} $ \\
\hline
$x $&& &$ \dfrac{D_{1}}{(1+K_{r_{1}})^{n_{1}}} $
\end{longtable}
\end{document}
答案1
由于某种原因,标准工具(cellspace
)在这里不起作用,但\setcellgapes{some value}\makegapedcells}
包中的替代工具makecell
可以起作用。
我冒昧地稍微简化了您的代码。特别是,amsfonts
加载时无需加载amssymb
。
\documentclass[11pt,oneside,openany]{book}
\usepackage[a4paper, hmargin=1.5cm, vmargin=3cm]{geometry}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{longtable}
\usepackage{makecell}
\begin{document}
\setcellgapes{6pt}\makegapedcells
\begin{longtable}{|p{1.7cm}|p{3.6cm}|p{2.8cm}| p{4cm} |}
\hline
\bfseries $ t $&\bfseries $ D_{t} $&\bfseries $ ABCD $&\bfseries $ sdf$ \\ \hline \hline
\endfirsthead
\hline
\bfseries $ t $&\bfseries $ D_{t} $&\bfseries $ TV=P_{n_{1}+n_{2}} $&\bfseries $ PV $ \\ \hline \hline
\endhead
\hline \multicolumn{4}{r}{\emph{Continued on next page}}
\endfoot
\hline
\endlastfoot
1& & &$ \dfrac{D_{1}}{(1+K_{r_{1}})} $ \\
\hline
$x $&& &$ \dfrac{D_{1}}{(1+K_{r_{1}})^{n_{1}}} $
\end{longtable}
\end{document}