4

My table has numbers in a same cell as follows: 23,3 (3,5). When I try to align decimals with siunitx, it gives me the following message:

Duplicate decimal marker token ',' in input.

Where lies the error?

\documentclass[12pt,oneside,letterpaper]{article}

\usepackage{siunitx}
\sisetup{table-number-alignment = center, input-symbols=(), output-decimal-marker={,}}

\begin{document}


\begin{landscape}

\begin{longtable}[c]{l
S[table-format=3.1]
S[table-format=3.1]
S[table-format=1.3]}


\caption{my-caption). \label{long-representativity}}\\

\toprule
 \multicolumn{1}{c}{{}} & \multicolumn{1}{c}{{LTF\textsuperscript{a} at 3 years (n = 129)}}  & \multicolumn{1}{c}{{Still followed at 3 years (n = 246)}} & \multicolumn{1}{c}{{p-value}}\\ \midrule
\endfirsthead

\multicolumn{4}{l}{Sociodemographics}                                                                                                                                                                                                                                                                                                                                                                                                                                                                \\ \midrule
                                                                                                                                                       \\
Age, mean (s.d)                                            & 23,3 (3,5)              & 23,3 (3,6)                        & 0,849   \\
5

siunitx will scan for a decimal marker which is the comma. You cannot have two commas in one entry unless you enclose one of them in a group.

\documentclass[12pt,oneside,letterpaper]{article}

\usepackage{pdflscape}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{siunitx}
\sisetup{table-number-alignment = center, input-symbols=(), output-decimal-marker={,}}

\begin{document}

\begin{landscape}
  \begin{longtable}[c]{l
      S[table-format=3.1]
      S[table-format=3.1]
      S[table-format=1.3]}
    \caption{my-caption). \label{long-representativity}}\\
    \toprule
    \multicolumn{1}{c}{{}} &
    \multicolumn{1}{c}{{LTF\textsuperscript{a} at 3 years (n = 129)}} &
    \multicolumn{1}{c}{{Still followed at 3 years (n = 246)}} &
    \multicolumn{1}{c}{{p-value}} \\
    \midrule
    \endfirsthead

    \multicolumn{4}{l}{Sociodemographics} \\
    \midrule
    \\
    Age, mean (s.d) & 23,3 {(3,5)} & 23,3 {(3,6)} & 0,849 \\
  \end{longtable}
\end{landscape}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.