
英語は私の母国語ではありませんが、できる限り最善の方法で質問を説明するように努めます。
私の問題は、L 列と T 列の間に余分なスペースがあることです。これは、私が科学モードで数字を書いたときに発生するようです。このような科学的な数字を作成し、コンマで揃え、列の間隔をより正常に (小さく) する方法はありますか?
前文:
\documentclass[12pt,twoside]{report}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage[a4paper,width=150mm,top=25mm,bindingoffset=6mm]{geometry}
\usepackage{amsmath}
\sisetup{input-symbols = ()}
テーブルコード:
\begin{table}[ht]\centering
\caption[caption]{caption}\label{reg_basis1}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\sisetup{table-space-text-post = \sym{***}}
\begin{tabular}{l*{5}{S[table-align-text-post=false]}}
\toprule
\multicolumn{1}{l}{\textbf{}}&\multicolumn{1}{c}{\textbf{L}}&
\multicolumn{1}{c}{\textbf{T}}&\multicolumn{1}{c}{\textbf{n}}&
\multicolumn{1}{c}{\textbf{\(R^{2}\)}}&
\multicolumn{1}{c}{\textbf{Justert $R^{2}$}}\\
\midrule
1997 - 2008 & 0.207 \sym{***} & 3.5\num{1e-4} \sym{***} & {623} & 0.27 & 0.21 \\
& (0.049) & (0.8\num{1e-4}) & & & \\
\addlinespace
2009 - 2015 &&&&& \\
&&&&& \\
\addlinespace
\bottomrule
\multicolumn{5}{l}{\footnotesize Estimerte standardavvik er gitt i parenteser}\\
\multicolumn{5}{l}{\footnotesize \sym{*} $p<0.05$, \sym{**} $p<0.01$, \sym{***} \ $p<0.001$}\\
\end{tabular}
\end{table}
誰か答えてくれる時間があればいいのですが。検索やグーグル検索をしてみましたが、問題を解決するために使える具体的なものは見つかりませんでした。
答え1
あなたの主な問題は(丸)括弧数字を囲むのに使用されます。これは、数字のエラーを示すコマンドの自然な入力としても使用されるためです\num
。そのため、(丸)括弧を中括弧で囲んで保護する必要があります。
(私はあなたの解決策を使用して に追加することはしませんinput-symbols
。そうすると、テストしていない望ましくない副作用が発生する可能性があるからです。)
適切な間隔を設定するのは非常に簡単で、例えばすでに答えが出ています。ここS
列にある「要素」を、指定子のオプションに指定しますtable-format
。(siunitx
マニュアルv2.6の47ページの表25)。
メインの表から気を散らさないように少し短縮した次のコードをご覧ください。
\documentclass[border=2mm]{standalone}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{siunitx}
\begin{document}
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\sisetup{
table-align-text-post=false,
}
\begin{tabular}{
l
S[table-format=1.3, table-space-text-pre={(},table-space-text-post={\sym{***}}]
S[table-format=1.1e-1,table-space-text-pre={(},table-space-text-post={\sym{***}}]
S[table-format=3]
S[table-format=1.2]
S[table-format=1.2]
}
\toprule
& {\textbf{L}} & {\textbf{T}} & {\textbf{n}}
& {\textbf{$R^{2}$}}
& {\textbf{Justert $R^{2}$}} \\
\midrule
1997 -- 2008 & 0.207 \sym{***} & 3e-4 \sym{***} & 623 & 0.27 & 0.21 \\
& {(}0.049{)} & {(}0.8e-4{)} & & & \\
\addlinespace
2009 -- 2015 & & & & & \\
& & & & & \\
\addlinespace
\bottomrule
\multicolumn{5}{l}{\footnotesize Estimerte standardavvik er gitt i parenteser}\\
\multicolumn{5}{l}{\footnotesize
\sym{*} $p < \num{0.05}$,
\sym{**} $p < \num{0.01}$,
\sym{***} $p < \num{0.001}$}\\
\end{tabular}
\end{document}