[Tex/LaTex] Aligning the currency symbol in a tabular environment

siunitxtables

Friends, I have to create some sort of a balance sheet, so my first sketch is using a tabular environment. I also have to follow some styling rules.

One of the styles rules I need to obey is the presence of the currency symbol in every single monetary description. I defined \brl (to be expanded as R$) to make my life easier. Besides that, all currency symbols need to be vertically aligned.

Most of the work is wonderfully made by the siunitx package. Consider the following code:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{siunitx}

\newcommand{\brl}{R\$}

\sisetup{output-decimal-marker={,},group-separator ={.},group-minimum-digits=4}

\begin{document}

\begin{table*}[h]
\centering
\begin{tabular}{p{.35\textwidth}S}
Item 1\dotfill\brl & 10.00\\
Item 2\dotfill\brl & 100.00\\
Item 3\dotfill\brl & 1000.00\\
Item 4\dotfill\brl & 10000.00
\end{tabular}
\end{table*}

\end{document}

That's the workaround I came up. The output is as follows:

Output

I also need to use \dotfill. The dots are part of the styling rules as well.

TBH, I'm not proud of my solution. =P I'm sure there are better approaches than mine. I suspect siunitx can easily solve this issue of currency symbol alignment, but I'm stuck.

Any ideas on how to improve my code?

UPDATE: Sorry if I didn't make myself clear. I was thinking about a currency symbol configuration in the number column itself, something like \money{1000.00} instead of putting the \brl symbol in the previous column.

Best Answer

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{siunitx}

\newcommand{\brl}{R\$}

\sisetup{output-decimal-marker={,},group-separator ={.},group-minimum-digits=4}

\begin{document}

\begin{table*}[h]
\centering
\begin{tabular}{p{.35\textwidth}<{\dotfill\brl}S}
Item 1 & 10.00\\
Item 2 & 100.00\\
Item 3 & 1000.00\\
Item 4 & 10000.00
\end{tabular}
\end{table*}

\end{document}
Related Question