下面是我的代码:
\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}