siunitx S 테이블 열의 중앙 달러 값

siunitx S 테이블 열의 중앙 달러 값

\$이 테이블의 중앙에 값을 올바르게 배치하려면 어떻게 해야 합니까 ?

여기에 이미지 설명을 입력하세요

이것은 간단해야 하지만 이 사이트와 설명서에서 검색한 실망스러운 결과 siunitx는 나에게 도움이 되지 않았습니다. 물론 첫 번째 열과 마찬가지로 항상 머리글 행에 단위를 넣을 수 있지만 궁금합니다.

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}

답변1

가장 좋은 방법은 모든 헤더에 ($)를 추가하는 것입니다. 여러 셀에서 $를 반복하는 것은 지루하고 지루합니다.

\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}

여기에 이미지 설명을 입력하세요

권장되지 않는 방법:

\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}

여기에 이미지 설명을 입력하세요

관련 정보