I want to make a table which
1) aligns the decimal input for which I use dcolumn
2) gives some color to some numbers
The code (see below) works, but it gives 20 errors. Anybody has a clue to get rid of the error messages?
Thanks a lot,
Stefan Lehmann
Code: Select all
\documentclass{book}
\usepackage{tabularx, multirow, booktabs}
\usepackage{xcolor}
\usepackage{tabu}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\makeatletter
\def\DC@endright{$\hfil\egroup\@dcolcolor\box\z@\box\tw@\dcolreset$}
\def\dcolcolor#1{\gdef\@dcolcolor{\color{#1}}}
\def\dcolreset{\dcolcolor{black}}
\dcolcolor{black}
\makeatother
\begin{document}
\begin{document}
\begin{tabu}{cd{3}}
note & 1.32\\
\color{red}note & 1.32 \\
note & \dcolcolor{red} 1.3 \\
\multicolumn{2}{r}{ \begin{tabular}{d{3}} \dcolcolor{blue}{12.12} \end{tabular} }\\
note & 1.32\\
note & \dcolcolor{red}-1.32\\
\multicolumn{2}{r}{ \begin{tabular}{d{3}} 1.1 \end{tabular} } \\
\textcolor{red}{note} & 1.5 \\
\end{tabu}
\end{document}