valores centrais do dólar na coluna da tabela siunitx S

valores centrais do dólar na coluna da tabela siunitx S

Como faço para \$centralizar os valores corretamente nesta tabela?

insira a descrição da imagem aqui

Isso deveria ser simples, mas uma pesquisa frustrante neste site e na siunitxdocumentação não me ajudou. Claro que posso sempre colocar as unidades na linha do cabeçalho, como na primeira coluna, mas estou curioso.

MWE:

\documentclass{article}

\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}

\begin{tabular}{cS[table-format=3.2]S[table-format=2.0]S[table-format=4.2]}
\toprule
Plan & {Phone cost (\$)} & {Monthly charge} & {Two year cost} \\
\midrule
Cricket Wireless & 499.99 & \$55 & \$1,819.99 \\
Virgin Mobile &  649 & \$30 & \$1,369 \\
\bottomrule
\end{tabular}

\end{document}

Responder1

O melhor é adicionar ($) a todos os cabeçalhos: repetir $ em várias células é chato e enfadonho.

\documentclass{article}

\usepackage{booktabs}
\usepackage{siunitx}

\sisetup{
  group-separator={,},
  group-four-digits,
}

\begin{document}

\begin{tabular}{
  l
  S[table-format=3.2]
  S[table-format=2.0]
  S[table-format=4.2]
}
\toprule
Plan & {Phone cost} & {Monthly charge} & {Two year cost} \\
& {(\$)} & {(\$)} & {(\$)} \\
\midrule
Cricket Wireless & 499.99 & 55 & 1819.99 \\
Virgin Mobile &  649 & 30 & 1369 \\
\bottomrule
\end{tabular}

\end{document}

insira a descrição da imagem aqui

Maneira não recomendada:

\documentclass{article}

\usepackage{booktabs}
\usepackage{siunitx}

\sisetup{
  group-separator={,},
  group-four-digits,
}

\begin{document}

\begin{tabular}{
  l
  S[table-format=3.2]
  S[table-format=2.0,table-space-text-pre={\$}]
  S[table-format=4.2,table-space-text-pre={\$}]
}
\toprule
Plan & {Phone cost (\$)} & {Monthly charge} & {Two year cost} \\
\midrule
Cricket Wireless & 499.99 & {\$}55 & {\$}1819.99 \\
Virgin Mobile &  649 & {\$}30 & {\$}1369 \\
\bottomrule
\end{tabular}

\end{document}

insira a descrição da imagem aqui

informação relacionada