2

How can I have these two features at the same time in a table: dashed lines, and numbers aligned on their decimal points?

MWE (except it doesn't work):

\documentclass[12pt,a4paper]{article}
\usepackage{arydshln} % for \hdashline
\usepackage{siunitx} % for column type S
\begin{document}
\begin{tabular}{S[table-format=2.1]}
14\\
\hdashline
9.5
\end{tabular}
\end{document}

This gives the error:

7
Undefined control sequence.
\adl@hline ...mpcnta \xdef \adl@rowsL {\adl@rowsL 
                                                  (#1/\number \@tempcnta );}...

l.7 \hdashline

Perhaps arydshln was the wrong package to use for the dashed line? \hdashrule in package dashrule, as far as I can tell, can't produce a rule confined to a table.

Perhaps siunitx was the wrong package to use for point-aligning? I tried package dcolumn and column type D{.}{.}{1} but that failed, too.

1 Answer 1

2

If you load the siunitx package before arydshln the MWE works. See also the related question: Dotted vertical line in math array + siunitx?

enter image description here

\documentclass[12pt,a4paper]{article}
\usepackage{siunitx} % for column type S
\usepackage{arydshln} % for \hdashline
\begin{document}
\begin{tabular}{S[table-format=2.1]}
14\\
\hdashline
9.5
\end{tabular}
\end{document}

Alternatively, you can also load the array package before arydshln:

\documentclass[12pt,a4paper]{article}
\usepackage{array}
\usepackage{arydshln} % for \hdashline
\usepackage{siunitx} % for column type S
\begin{document}
\begin{tabular}{S[table-format=2.1]}
14\\
\hdashline
9.5
\end{tabular}
\end{document}
1
  • 1
    Your earlier suggestion of \usepackage{array} before \usepackage{arydshln} might also be worth putting onto the record. A rule "If you use package Y, use package X first" seems easy to work with, provided X doesn't introduce its own conditions. But a rule "If you use packages Y and Z, use Y before Z" might contribute to later grief if many such dependencies arise and interact.
    – Rosie F
    Commented Jun 30, 2019 at 16:35

You must log in to answer this question.

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