1

I have the following table, and would like to decimal align all the numbers. Can you please suggest how to do it?

\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}
  • Welcome to TeX-sx! In your example you've not actually got any use of the dcolumn package: what did you try so far? – Joseph Wright Mar 6 '15 at 14:56
  • I tried to add this before begin document: \usepackage{booktabs,dcolumn} and tried this line in the table \begin{tabular}{@{}l*{2}{D{.}{.}{7}}@{} l p{2cm} p{2cm} p{2cm} p{2cm} p{2cm} } \hline\hline – ganga rocks Mar 6 '15 at 14:59
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Reinstate Monica - M. Schröder Sep 2 '15 at 23:25
4

Please always post complete documents not fragments using commands from unspecified packages.

enter image description here

\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}
  • Thanks so much David. But the real titles behind "Taxation1", "Taxation2" etc are each 4-5 words long. If I put in the actual titles, only the first 2 columns of the table are visible on the page. Could you please suggest how I can modify this? – ganga rocks Mar 6 '15 at 15:12
  • use multiline titles, eg replace \textit{#1} by \textit{\begin{tabular}{@{}c@{}}#1\end{tabular}} then you can use \hd{my\\long\\title\\here} – David Carlisle Mar 6 '15 at 15:42
  • Thank you for the quick help David! I'm able to create the table exactly the way I want. I have a wide variety of tables, let me go and do the same with all of them. Thanks again! – ganga rocks Mar 6 '15 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.