如何使用 dcolumn 包对表格进行十进制对齐

如何使用 dcolumn 包对表格进行十进制对齐

我有下表,想将所有数字按十进制对齐。您能建议如何操作吗?

\newpage
\begin{table}[htb]
\centering 
\begin{changemargin}{0.0cm}{0.5cm}
\caption{Sample title }
\end{changemargin} 

\begin{tabular}{ l  p{2cm} p{2cm} p{2cm} p{2cm} p{2cm} } \hline\hline
 & \textit{Taxation1}  & \textit{Taxation2}  & \textit{Taxation3}
& \textit{Taxation4}   & \textit{Taxation5$^1$}  \\ \hline
\textbf{Marginal Tax Rates} & & & & &  \\ \hline

Labor & 27.37& 26.77& 27.37&26.84 &26.92 \\ 

  &     &(-0.60) & & (-0.53)&(-0.45)\\ 

Dividends & 23.44& 22.92&23.44 & 22.98&23.05 \\ 
 & &(-0.52) & & (-0.46)&(-0.39)\\ 


Interest &28.06 &27.44 &28.06 & 27.51 &27.60\\ 
  & &(-0.62) & & (-0.55)&(-0.46)\\ 


Capital Gains &19.00 &18.58 & 19.00& 18.63 &18.69\\ 
 & &(-0.42) & & (-0.37)&(-0.31)\\ 


Corporate & 46.00 & 46.00& 37.96& 45.10 &46.00\\ 
 & & & (-8.04) &(-0.90) & \\ 
\hline
\end{tabular}
\\
\begin{enumerate} [ $^1$ ]
%\item [\text{Note: }]
\item Footnote1
\item Footnote2

\end{enumerate}

\end{table}

答案1

请始终发布完整的文档,而不是使用未指定软件包的命令发布的片段。

在此处输入图片描述

\documentclass{article}
\usepackage{dcolumn,enumerate}
\begin{document}

\begin{table}[htbp]
\centering 
\setlength\tabcolsep{4pt}
\newcommand\hd[1]{\multicolumn{1}{c}{\textit{#1}}}

\caption{Tax Rates and Rates Reductions under Alternative Revenue-Recycling Methods }

\bigskip

\begin{tabular}{ l *{5}{D..{-1} }} \hline\hline
 & \hd{Taxation1}  & \hd{Taxation2}  & \hd{Taxation3}
& \hd{Taxation4}   & \hd {Taxation5$^1$}  \\ \hline
\multicolumn{6}{l}{\textbf{Marginal Tax Rates}}\\ \hline
Labor & 27.37& 26.77& 27.37&26.84 &26.92 \\ 
  &     &(-0.60) & & (-0.53)&(-0.45)\\ 
Dividends & 23.44& 22.92&23.44 & 22.98&23.05 \\ 
 & &(-0.52) & & (-0.46)&(-0.39)\\ 
Interest &28.06 &27.44 &28.06 & 27.51 &27.60\\ 
  & &(-0.62) & & (-0.55)&(-0.46)\\ 
Capital Gains &19.00 &18.58 & 19.00& 18.63 &18.69\\ 
 & &(-0.42) & & (-0.37)&(-0.31)\\ 
Corporate & 46.00 & 46.00& 37.96& 45.10 &46.00\\ 
 & & & (-8.04) &(-0.90) & \\ 
\hline
\end{tabular}

\begin{enumerate} [ $^1$ ]
%\item [\text{Note: }]
\item Footnote1
\item Footnote2

\end{enumerate}

\end{table}

\end{document}

相关内容