为什么我的表格的某一部分是斜体?

为什么我的表格的某一部分是斜体?

我只是想知道为什么在下表中,“男性”和“黑人”这两个词是斜体,而第 3 级不是?我希望第 3 级是斜体,但我不知道为什么“男性”和“黑人”首先是斜体的......

在此处输入图片描述

我的表格代码如下(我没有发布 MWE,因为我认为问题一定包含在这段代码中):

\begin{table}[htbp]
\small
\caption{Regression Results}
\label{table:RegressionResults}
\centering
\begin{tabular}{
!{\extracolsep{\fill}}
p{0.23\textwidth}
*{7}{S[table-format=2.5, table-align-text-post=false, parse-numbers=false]}
}
\toprule
{\bfseries\small Variable} & {\bfseries\small Base} & {\bfseries\small All}  & {\bfseries\small Commerce} & {\bfseries\small B.Bus.Sci} &      {\bfseries\small BCom} & {\bfseries\small EBE} & {\bfseries\small Science} \\
\midrule
{\small Female} & Male & {\small 1.953\textsuperscript{\textdaggerdbl}} &   {\small 1.711\textsuperscript{\textdaggerdbl}} &  1.626\textsuperscript{\textdaggerdbl} & 1.617\textsuperscript{\textdaggerdbl} & 1.005 & 1.793\textsuperscript{\textdaggerdbl} \\
 & & {\small(0.137)} & {\small(0.194)} & (0.269) & (0.269) & (0.162) & (0.253) \\
{\small Age} && 1.010 & 0.920 & 0.761\textsuperscript{\textdaggerdbl} & 1.288\textsuperscript{\textdagger} & 1.066 & 1.072 \\
 & & (0.039) & (0.065) & (0.071) & (0.160) & (0.080) & (0.075) \\
Coloured & Black & 1.099 & 1.122 & 1.482 & 0.774 & 1.048 & 1.276 \\
& & (0.186) & (0.327) & (0.600) & (0.340) & (0.354) & (0.461) \\
Indian/Asian & Black & 0.670\textsuperscript{\textdagger} &  0.488\textsuperscript{\textdagger} & 1.021 &   0.337\textsuperscript{\textdaggerdbl} &  0.565\textsuperscript{\textasteriskcentered} & 0.947 \\
& & (0.114) & (0.137) & (0.443) & (0.137) & (0.187) & (0.384) \\
White & Black & 5.123\textsuperscript{\textdaggerdbl} &  2.953\textsuperscript{\textdaggerdbl} & 3.510\textsuperscript{\textdaggerdbl} & 2.679\textsuperscript{\textdagger} & 4.748\textsuperscript{\textdaggerdbl} & 12.548\textsuperscript{\textdaggerdbl} \\
& & (0.841) & (0.817) & (1.361) & (1.112) & (1.465) & (4.620) \\
Financial Aid && 0.678\textsuperscript{\textdaggerdbl} &  0.397\textsuperscript{\textdaggerdbl} & 0.420\textsuperscript{\textdaggerdbl} & 0.400\textsuperscript{\textdaggerdbl} & 0.754\textsuperscript{\textasteriskcentered} & 0.706\textsuperscript{\textdagger} \\
 & &(0.056) & (0.054) & (0.077) & (0.081) & (0.129) & (0.118) \\
\multirow{2}{30mm}{Academic Development} && 0.911 & 0.930 & 1.116 & 0.783 & 0.897 & 0.574\textsuperscript{\textdaggerdbl} \\
 & & (0.083) & (0.132) & (0.211) & (0.175) & (0.184) & (0.124) \\
\addlinespace
\multirow{2}{30mm}{English Home Language} && 1.401\textsuperscript{\textdagger} & 1.716\textsuperscript{\textdaggerdbl} & 1.472 & 2.265\textsuperscript{\textdaggerdbl} & 1.739\textsuperscript{\textasteriskcentered} & 1.293 \\
& & (0.208) & (0.433) & (0.512) & (0.864) & (0.493) & (0.418) \\
\addlinespace
{\small School Quintile 1} & {Quintile 3}& 1.016 & 1.051 & 1.250 & 0.516 & 0.794 & 1.469 \\
& & (0.244) & (0.456) & (0.610) & (0.783) & (0.375) & (0.627) \\
{\small School Quintile 2} & {Quintile 3}& 1.291 & 1.161 & 0.966 & 1.653 &  1.846\textsuperscript{\textasteriskcentered} & 0.968 \\
& & (0.242) & (0.449) & (0.455) & (1.175) & (0.634) & (0.307) \\
{\small School Quintile 4} & {Quintile 3}& 0.920 & 0.771 & 0.818 & 0.559 & 0.827 & 0.744 \\
&& (0.140) & (0.211) & (0.276) & (0.287) & (0.252) & (0.206) \\
{\small School Quintile 5} & {Quintile 3}& 1.760\textsuperscript{\textdaggerdbl}   & 1.351 & 1.412 & 1.616 & 1.845\textsuperscript{\textdagger} &  1.527\textsuperscript{\textasteriskcentered} \\
 & & (0.218) & (0.301) & (0.390) & (0.687) & (0.465) & (0.362) \\
Independent & {\small Quintile 3}& 1.663\textsuperscript{\textdaggerdbl} & 1.203 & 1.312 & 1.626 & 1.789\textsuperscript{\textdagger} & 1.335 \\
 & & (0.219) & (0.284) & (0.399) & (0.708) & (0.472) & (0.338) \\
Western Cape && 1.145 & 1.275\textsuperscript{\textasteriskcentered} & 1.144 & 1.661\textsuperscript{\textdagger} & 1.073 & 0.950 \\
& &  (0.099) & (0.183) & (0.235) & (0.358) & (0.192) & (0.167) \\
Grade 12 GPA && 1.119\textsuperscript{\textdaggerdbl} &  1.119\textsuperscript{\textdaggerdbl} & 1.156\textsuperscript{\textdaggerdbl} & 1.111\textsuperscript{\textdaggerdbl} & 1.148\textsuperscript{\textdaggerdbl} & 1.134\textsuperscript{\textdaggerdbl} \\
 && (0.007) & (0.011) & (0.017) & (0.016) & (0.014) & (0.014) \\
Mathematics Mark && 1.007\textsuperscript{\textdagger} & 1.012\textsuperscript{\textdagger} & 1.005 & 1.048\textsuperscript{\textdaggerdbl} & 1.054\textsuperscript{\textdaggerdbl} & 1.022\textsuperscript{\textdaggerdbl} \\
&& (0.003) & (0.006) & (0.008) & (0.009) & (0.008) & (0.006) \\
English Mark && 1.013\textsuperscript{\textdaggerdbl} & 1.012 & 1.006 & 1.038\textsuperscript{\textdaggerdbl} & 1.007 & 1.003 \\
&& (0.004) & (0.008) & (0.011) & (0.012) & (0.009) & (0.008) \\
Science && --- & 1.053 & 1.352\textsuperscript{\textasteriskcentered} & 1.239 & ---  & 1.252 \\
& &  & (0.136) & (0.233) & (0.255) &  & (0.557) \\
Residence && 1.117 & 1.401\textsuperscript{\textdagger} & 1.240 & 1.061 & 1.019 & 0.937 \\
& & (0.102) & (0.209) & (0.259) & (0.238) & (0.195) & (0.169) \\
\midrule
Controls for Time && {Yes} & {Yes} & {Yes} & {Yes} & {Yes} & {Yes} \\
Observations && {36 333} & {20 409}  &{7 408}    & {13 001}  & {9 169}&  {6 755} \\
Pseudo \(R^{2}\) && {0.397} & {0.451} & {0.420} & {0.574} & {0.419} & {0.431} \\
\bottomrule
\multicolumn{7}{l}{\footnotesize Standard errors in parentheses}\\
\multicolumn{7}{l}{\footnotesize * \(p<0.05\), \textsuperscript{\textdagger}   \(p<0.01\), \textsuperscript{\textdaggerdbl} \(p<0.001\)}\\
\end{tabular}
\end{table}

答案1

S即使第二列中没有数字需要按小数点对齐,您仍将第二列的列类型设置为。因此,该列中的某些条目(例如“男性”和“黑人”)以数学斜体显示;其他条目(例如“Quintile 3”)已括在花括号中,因此根据siunitx包的语法规则,它们被视为居中文本。我建议您l对第二列使用简单的列类型。

您的代码中有很多冗余\small语句;请删除它们。要使---某一S列排版为居中的长划线而不是三个单独的减号,请将其括在花括号中。

在此处输入图片描述

\documentclass{article}

\usepackage{siunitx,booktabs,caption}
\usepackage[margin=1in]{geometry}  % set page margins to suit your needs
\begin{document}    

\begin{table}[htbp]
\small
\setlength\tabcolsep{0pt}
\sisetup{table-format=2.5, 
         table-align-text-post=false, 
         parse-numbers=false}

\captionsetup{font=small} % same font size for caption as as rest of table
\caption{Regression Results} 
\label{table:RegressionResults}

\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} ll *{6}{S} }
\toprule
\textbf{Variable} & \textbf{Base} 
& {\bfseries All}  & {\bfseries Commerce} & {\bfseries B.Bus.Sci} 
& {\bfseries BCom} & {\bfseries EBE} & {\bfseries Science} \\
\midrule
Female & Male & 1.953\textsuperscript{\textdaggerdbl} &   1.711\textsuperscript{\textdaggerdbl} &  1.626\textsuperscript{\textdaggerdbl} & 1.617\textsuperscript{\textdaggerdbl} & 1.005 & 1.793\textsuperscript{\textdaggerdbl} \\
 & & (0.137) & (0.194) & (0.269) & (0.269) & (0.162) & (0.253) \\
Age && 1.010 & 0.920 & 0.761\textsuperscript{\textdaggerdbl} & 1.288\textsuperscript{\textdagger} & 1.066 & 1.072 \\
 & & (0.039) & (0.065) & (0.071) & (0.160) & (0.080) & (0.075) \\
Coloured & Black & 1.099 & 1.122 & 1.482 & 0.774 & 1.048 & 1.276 \\
& & (0.186) & (0.327) & (0.600) & (0.340) & (0.354) & (0.461) \\
Indian/Asian & Black & 0.670\textsuperscript{\textdagger} &  0.488\textsuperscript{\textdagger} & 1.021 &   0.337\textsuperscript{\textdaggerdbl} &  0.565\textsuperscript{\textasteriskcentered} & 0.947 \\
& & (0.114) & (0.137) & (0.443) & (0.137) & (0.187) & (0.384) \\
White & Black & 5.123\textsuperscript{\textdaggerdbl} &  2.953\textsuperscript{\textdaggerdbl} & 3.510\textsuperscript{\textdaggerdbl} & 2.679\textsuperscript{\textdagger} & 4.748\textsuperscript{\textdaggerdbl} & 12.548\textsuperscript{\textdaggerdbl} \\
& & (0.841) & (0.817) & (1.361) & (1.112) & (1.465) & (4.620) \\
Financial Aid && 0.678\textsuperscript{\textdaggerdbl} &  0.397\textsuperscript{\textdaggerdbl} & 0.420\textsuperscript{\textdaggerdbl} & 0.400\textsuperscript{\textdaggerdbl} & 0.754\textsuperscript{\textasteriskcentered} & 0.706\textsuperscript{\textdagger} \\
 & &(0.056) & (0.054) & (0.077) & (0.081) & (0.129) & (0.118) \\
Academic && 0.911 & 0.930 & 1.116 & 0.783 & 0.897 & 0.574\textsuperscript{\textdaggerdbl} \\
Development & & (0.083) & (0.132) & (0.211) & (0.175) & (0.184) & (0.124) \\
\addlinespace
English Home && 1.401\textsuperscript{\textdagger} & 1.716\textsuperscript{\textdaggerdbl} & 1.472 & 2.265\textsuperscript{\textdaggerdbl} & 1.739\textsuperscript{\textasteriskcentered} & 1.293 \\
Language& & (0.208) & (0.433) & (0.512) & (0.864) & (0.493) & (0.418) \\
\addlinespace
School Quintile 1 & Quintile 3& 1.016 & 1.051 & 1.250 & 0.516 & 0.794 & 1.469 \\
& & (0.244) & (0.456) & (0.610) & (0.783) & (0.375) & (0.627) \\
School Quintile 2 & Quintile 3& 1.291 & 1.161 & 0.966 & 1.653 &  1.846\textsuperscript{\textasteriskcentered} & 0.968 \\
& & (0.242) & (0.449) & (0.455) & (1.175) & (0.634) & (0.307) \\
School Quintile 4 & Quintile 3& 0.920 & 0.771 & 0.818 & 0.559 & 0.827 & 0.744 \\
&& (0.140) & (0.211) & (0.276) & (0.287) & (0.252) & (0.206) \\
School Quintile 5 & Quintile 3& 1.760\textsuperscript{\textdaggerdbl}   & 1.351 & 1.412 & 1.616 & 1.845\textsuperscript{\textdagger} &  1.527\textsuperscript{\textasteriskcentered} \\
 & & (0.218) & (0.301) & (0.390) & (0.687) & (0.465) & (0.362) \\
Independent & Quintile 3& 1.663\textsuperscript{\textdaggerdbl} & 1.203 & 1.312 & 1.626 & 1.789\textsuperscript{\textdagger} & 1.335 \\
 & & (0.219) & (0.284) & (0.399) & (0.708) & (0.472) & (0.338) \\
Western Cape && 1.145 & 1.275\textsuperscript{\textasteriskcentered} & 1.144 & 1.661\textsuperscript{\textdagger} & 1.073 & 0.950 \\
& &  (0.099) & (0.183) & (0.235) & (0.358) & (0.192) & (0.167) \\
Grade 12 GPA && 1.119\textsuperscript{\textdaggerdbl} &  1.119\textsuperscript{\textdaggerdbl} & 1.156\textsuperscript{\textdaggerdbl} & 1.111\textsuperscript{\textdaggerdbl} & 1.148\textsuperscript{\textdaggerdbl} & 1.134\textsuperscript{\textdaggerdbl} \\
 && (0.007) & (0.011) & (0.017) & (0.016) & (0.014) & (0.014) \\
Mathematics Mark && 1.007\textsuperscript{\textdagger} & 1.012\textsuperscript{\textdagger} & 1.005 & 1.048\textsuperscript{\textdaggerdbl} & 1.054\textsuperscript{\textdaggerdbl} & 1.022\textsuperscript{\textdaggerdbl} \\
&& (0.003) & (0.006) & (0.008) & (0.009) & (0.008) & (0.006) \\
English Mark && 1.013\textsuperscript{\textdaggerdbl} & 1.012 & 1.006 & 1.038\textsuperscript{\textdaggerdbl} & 1.007 & 1.003 \\
&& (0.004) & (0.008) & (0.011) & (0.012) & (0.009) & (0.008) \\
Science && --- & 1.053 & 1.352\textsuperscript{\textasteriskcentered} & 1.239 & ---  & 1.252 \\
& &  & (0.136) & (0.233) & (0.255) &  & (0.557) \\
Residence && 1.117 & 1.401\textsuperscript{\textdagger} & 1.240 & 1.061 & 1.019 & 0.937 \\
& & (0.102) & (0.209) & (0.259) & (0.238) & (0.195) & (0.169) \\
\midrule
Controls for Time && {Yes} & {Yes} & {Yes} & {Yes} & {Yes} & {Yes} \\
Observations && {36 333} & {20 409}  &{7 408}    & {13 001}  & {9 169}&  {6 755} \\
Pseudo \(R^{2}\) && {0.397} & {0.451} & {0.420} & {0.574} & {0.419} & {0.431} \\
\bottomrule
\addlinespace
\multicolumn{7}{l}{\footnotesize Standard errors in parentheses}\\
\multicolumn{7}{l}{\footnotesize * \(p<0.05\), \textsuperscript{\textdagger}   \(p<0.01\), \textsuperscript{\textdaggerdbl} \(p<0.001\)}\\
\end{tabular*}
\end{table}
\end{document}

答案2

第二列被声明为S,但事实并非如此。

您对项目的支撑也不一致。您可以进行许多简化以简化输入。

\documentclass{article}
\usepackage{amsmath,siunitx,booktabs}

\newcommand{\noteg}[1]{\makebox[0pt][l]{\textsuperscript{#1}}}
\newcommand{\notea}{\noteg{\textasteriskcentered}}
\newcommand{\noted}{\noteg{\textdagger}}
\newcommand{\notedd}{\noteg{\textdaggerdbl}}
\newcommand{\doublerow}[1]{\smash[b]{\begin{tabular}[t]{@{}l@{}}#1\end{tabular}}}

\begin{document}

\begin{table}[htbp]
\small
\caption{Regression Results}
\label{table:RegressionResults}

\centering

\begin{tabular}{
  !{\extracolsep{\fill}}
  ll
  *{6}{
   S[
     table-format=2.4,
     table-align-text-post=false,
     parse-numbers=false,
   ]
  }
}
\toprule
{\bfseries Variable} & {\bfseries Base} & {\bfseries All}  & {\bfseries Commerce} & {\bfseries B.Bus.Sci} &      {\bfseries BCom} & {\bfseries EBE} & {\bfseries Science} \\
\midrule
Female & Male & 1.953\notedd & 1.711\notedd &  1.626\notedd & 1.617\notedd & 1.005 & 1.793\notedd \\
       &      & (0.137) & (0.194) & (0.269) & (0.269) & (0.162) & (0.253) \\
Age && 1.010 & 0.920 & 0.761\notedd & 1.288\noted & 1.066 & 1.072 \\
 & & (0.039) & (0.065) & (0.071) & (0.160) & (0.080) & (0.075) \\
Coloured & Black & 1.099 & 1.122 & 1.482 & 0.774 & 1.048 & 1.276 \\
& & (0.186) & (0.327) & (0.600) & (0.340) & (0.354) & (0.461) \\
Indian/Asian & Black & 0.670\noted &  0.488\noted & 1.021 &   0.337\notedd &  0.565\notea & 0.947 \\
& & (0.114) & (0.137) & (0.443) & (0.137) & (0.187) & (0.384) \\
White & Black & 5.123\notedd &  2.953\notedd & 3.510\notedd & 2.679\noted & 4.748\notedd & 12.548\notedd \\
& & (0.841) & (0.817) & (1.361) & (1.112) & (1.465) & (4.620) \\
Financial Aid && 0.678\notedd &  0.397\notedd & 0.420\notedd & 0.400\notedd & 0.754\notea & 0.706\noted \\
 & &(0.056) & (0.054) & (0.077) & (0.081) & (0.129) & (0.118) \\
\doublerow{Academic \\ Development} && 0.911 & 0.930 & 1.116 & 0.783 & 0.897 & 0.574\notedd \\
 & & (0.083) & (0.132) & (0.211) & (0.175) & (0.184) & (0.124) \\
\addlinespace
\doublerow{English Home \\ Language} && 1.401\noted & 1.716\notedd & 1.472 & 2.265\notedd & 1.739\notea & 1.293 \\
& & (0.208) & (0.433) & (0.512) & (0.864) & (0.493) & (0.418) \\
\addlinespace
School Quintile 1 & Quintile 3 & 1.016 & 1.051 & 1.250 & 0.516 & 0.794 & 1.469 \\
& & (0.244) & (0.456) & (0.610) & (0.783) & (0.375) & (0.627) \\
School Quintile 2 & Quintile 3 & 1.291 & 1.161 & 0.966 & 1.653 &  1.846\notea & 0.968 \\
& & (0.242) & (0.449) & (0.455) & (1.175) & (0.634) & (0.307) \\
School Quintile 4 & Quintile 3 & 0.920 & 0.771 & 0.818 & 0.559 & 0.827 & 0.744 \\
&& (0.140) & (0.211) & (0.276) & (0.287) & (0.252) & (0.206) \\
School Quintile 5 & Quintile 3 & 1.760\notedd   & 1.351 & 1.412 & 1.616 & 1.845\noted &  1.527\notea \\
 & & (0.218) & (0.301) & (0.390) & (0.687) & (0.465) & (0.362) \\
Independent & Quintile 3 & 1.663\notedd & 1.203 & 1.312 & 1.626 & 1.789\noted & 1.335 \\
 & & (0.219) & (0.284) & (0.399) & (0.708) & (0.472) & (0.338) \\
Western Cape && 1.145 & 1.275\notea & 1.144 & 1.661\noted & 1.073 & 0.950 \\
& &  (0.099) & (0.183) & (0.235) & (0.358) & (0.192) & (0.167) \\
Grade 12 GPA && 1.119\notedd &  1.119\notedd & 1.156\notedd & 1.111\notedd & 1.148\notedd & 1.134\notedd \\
 && (0.007) & (0.011) & (0.017) & (0.016) & (0.014) & (0.014) \\
Mathematics Mark && 1.007\noted & 1.012\noted & 1.005 & 1.048\notedd & 1.054\notedd & 1.022\notedd \\
&& (0.003) & (0.006) & (0.008) & (0.009) & (0.008) & (0.006) \\
English Mark && 1.013\notedd & 1.012 & 1.006 & 1.038\notedd & 1.007 & 1.003 \\
&& (0.004) & (0.008) & (0.011) & (0.012) & (0.009) & (0.008) \\
Science && {---} & 1.053 & 1.352\notea & 1.239 & {---}  & 1.252 \\
& &  & (0.136) & (0.233) & (0.255) &  & (0.557) \\
Residence && 1.117 & 1.401\noted & 1.240 & 1.061 & 1.019 & 0.937 \\
& & (0.102) & (0.209) & (0.259) & (0.238) & (0.195) & (0.169) \\
\midrule
Controls for Time && {Yes} & {Yes} & {Yes} & {Yes} & {Yes} & {Yes} \\
Observations && {36\,333} & {20\,409}  & {7\,408}    & {13\,001}  & {9\,169}&  {6\,755} \\
Pseudo \(R^{2}\) && {0.397} & {0.451} & {0.420} & {0.574} & {0.419} & {0.431} \\
\bottomrule
\multicolumn{7}{l}{\footnotesize Standard errors in parentheses}\\
\multicolumn{7}{l}{\footnotesize \notea\ \ \(p<0.05\), \noted\ \ \(p<0.01\), \notedd\ \ \(p<0.001\)}\\
\end{tabular}
\end{table}
\end{document}

在此处输入图片描述

相关内容