![siunitx で表形式の信頼区間を [x, y] として印刷するにはどうすればいいですか?](https://rvso.com/image/327772/siunitx%20%E3%81%A7%E8%A1%A8%E5%BD%A2%E5%BC%8F%E3%81%AE%E4%BF%A1%E9%A0%BC%E5%8C%BA%E9%96%93%E3%82%92%20%5Bx%2C%20y%5D%20%E3%81%A8%E3%81%97%E3%81%A6%E5%8D%B0%E5%88%B7%E3%81%99%E3%82%8B%E3%81%AB%E3%81%AF%E3%81%A9%E3%81%86%E3%81%99%E3%82%8C%E3%81%B0%E3%81%84%E3%81%84%E3%81%A7%E3%81%99%E3%81%8B%3F.png)
[x, y]
S 列のように信頼区間を印刷するための推奨される方法は何でしょうかsiunitx
? 現時点では、2 つの S 列ソリューションがあります。
\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{table}[h]
\begin{tabular}{cS[table-format = 1.1]
S[table-format = -1.2, table-space-text-pre=[ ]@{}
S[table-format = -1.2, table-space-text-post=[, table-space-text-pre=[ ]
}
A & B & \multicolumn{2}{c}{CI} \\
Values & 2.3 & {[}1.23{,} & 1.23{]} \\
Values & 2.3 & {[}-3.42{,} & -2.43{]} \\
Values & 2.3 & {[}4.12{,} & 7.33{]} \\
Values & 2.3 & {[}-1.03{,} & -9.11{]} \\
\end{tabular}
\end{table}
\end{document}
もっと簡単な方法はありますかsiunitx
?
答え1
table-space-text-pre
とを使ってtable-space-text-post
角括弧のためのスペースを作ることができます。列の前後に括弧を挿入するには、>{...}
と構文を使用します。各行の最後の角括弧の前に間違ったスペースを入れないようにするには、 og の代わりに<{...}
TeX プリミティブを使用する必要があります。\cr
\\
TeX プリミティブを使用する必要があります。これは、のセクション 7.13 で説明されています。siunitx
マニュアル。
列見出しを中央揃えにするには、B
などのグループ内に配置するだけです{B}
。
\documentclass[border=10pt]{standalone}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{
c
S[table-format = 1.1]
>{{[}} % Add square bracket before column
S[table-format = -1.2,table-space-text-pre={[}]
@{,\,} % Add comma and thin-space between the columns
S[table-format = -1.2,table-space-text-post={]}]
<{{]}} % Add square bracket after column
}
A & {B} & \multicolumn{2}{c}{CI} \cr
Values & 2.3 & 1.23 & 1.23 \cr
Values & 2.3 & -3.42 & -2.43 \cr
Values & 2.3 & 4.12 & 7.33 \cr
Values & 2.3 & -1.03 & -9.11 \cr
\end{tabular}
\end{document}
答え2
入力する量を最小限に抑えるために、テーブル定義に括弧[
、およびを入れます。]
\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{table}[h]
\begin{tabular}{cS[table-format = 1.1]
@{\quad[\,}S[table-format = -1.2]@{,\,}S[table-format = -1.2]@{\,]}
}
A & \multicolumn{1}{c@{\quad\space}}{B} & \multicolumn{2}{c}{CI} \\
Values & 2.3 & 1.23 & 1.23 \\
Values & 2.3 & -3.42 & -2.43 \\
Values & 2.3 & 4.12 & 7.33 \\
Values & 2.3 & -1.03 & -9.11 \\
\end{tabular}
\end{table}
\end{document}
これにより、次のものが生成されます。
ここでは、列の間に素材を挿入するために を使用しました@{...}
。正しい場所に配置するためのサイトの工夫に注意してくださいB
。これは のために必要なことです\quad
が、より洗練された解決策があるはずだということを示唆する傾向があります。