6

Could you tell me what's wrong with next code? I want to get a three columns tabular where numbers are typeset with typewriter family and centred below its header. Numbers won't have any decimal part, they are integers and their decimal, binary and hexadecimal representation.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{siunitx}
\usepackage{booktabs}
\begin{document}

\sisetup{math-rm=\mathtt, 
        group-digits=false, 
        table-figures-decimal=0, 
        table-number-alignment=center,
        input-digits={0123456789ABCDEF}
        }

\begin{tabular}{SS[minimum-integer-digits=8]S}
\toprule
{Decimal} & {Binary} & {Hexadecimal} \\
\midrule
63 & 00111111 & 3F \\
250 & 11111010 & FA \\
117 & 01110101 & 75 \\
220 & 11011100 & DC \\
171 & 10101011 & AB \\
94 & 01011110 & 5E \\
\bottomrule
\end{tabular}
\end{document}

As you can see, second column doesn't have enough space and second and third column are not correctly aligned. What am I misunderstanding in siunitx guide?

enter image description here

1 Answer 1

7

The binary numbers in the second column are centered with table-format=8.0. Also the overfull \hbox warnings are gone:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{siunitx}
\usepackage{booktabs}
\begin{document}

\sisetup{math-rm=\mathtt,
        group-digits=false,
        table-figures-decimal=0,
        table-number-alignment=center,
        input-digits={0123456789ABCDEF}
        }

\begin{tabular}{SS[minimum-integer-digits=8,table-format=8.0]S[table-format=2.0]}
\toprule
{Decimal} & {Binary} & {Hexadecimal} \\
\midrule
63 & 00111111 & 3F \\
250 & 11111010 & FA \\
117 & 01110101 & 75 \\
220 & 11011100 & DC \\
171 & 10101011 & AB \\
94 & 01011110 & 5E \\
\bottomrule
\end{tabular}
\end{document}

Result

2
  • Thank you. I thought that table-figures-decimal=0 was enough. It looks like I also need to specify table-format. But why first column was well aligned without any other information?
    – Ignasi
    Commented Mar 10, 2014 at 14:29
  • @Ignasi: I think the default setting of table-figures-integer=3 is the reason that the first column is already centered. Commented Mar 10, 2014 at 14:45

You must log in to answer this question.

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