Alignment of table header in column with decimal numbers using siunitx

You can align to the right by using multicolumn:

\documentclass[ngerman]{scrbook}
\usepackage{siunitx}

\begin{document}

\begin{tabular}{l S[table-format=3.4]}
    \textbf{fruit} & \multicolumn{1}{r}{\textbf{\%}} \\         %  
    apple   & 12,34 \\
    banana  & ,1 \\
    cherry  & 1,2345 \\
    coconut & 100 \\
\end{tabular}

\end{document}

I have changed S[table-format=3.2] to S[table-format=3.4] so as to compensate for the entry in cherry..

enter image description here


To center the % symbol in the header row of the second column, you could encase the instruction \textbf{\%} in curly braces, like this:

{\textbf{\%}}

Using \multicolumn{1}{c}{\textbf{\%}} works too...

Tags:

Tables

Siunitx