I would like to align numbers of the form 1/10 and 20/1,256 on the forward slash character. I have tried to use dcolumn, specifically the D command, but I clearly don't understand it:


When I try to use the new column specifier ds, e.g.

\begin{tabular}{l*{8}{|ds{3.6}}|} \hline

where the intention of the numbers is to specify up to 3 characters to the left of / and up to six to the right, I get

Package array Error: Illegal pream-token (3.6): `c' used.

and a lot of follow-on errors. It doesn't matter if I change the numbers.

Any help appreciated.

1 Answer 1


The problem seems to be that new column types can only have a single character as the notation. Then, you have two choices to achieve your desired result, which I call column types f and g, depending on whether you want the input syntax to use a . or a /. In either case, the typeset output uses a /.


\begin{tabular}{|f{3.6}|f{3.6}|} \hline
3.46 & 23.5\\
43.5 & 4.78\\\hline

\begin{tabular}{|g{3.6}|g{3.6}|} \hline
3/46 & 23/5\\
43/5 & 4/78\\\hline

enter image description here

  • In hindsight the single character restriction should have been more obvious to me :-) Thanks!! Commented Jan 20 at 2:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .