如何更改表格中数字的字体

如何更改表格中数字的字体

我如何才能不仅更改表格中下一个字体,而且还更改数字的字体?我使用以下几行来更改表格的字体:

\renewcommand{\rmdefault}{phv} 
\renewcommand{\sfdefault}{phv}

非常感谢您的每一条建议!

谢谢,

朱莉娅

这是我的完整代码:

\documentclass[a4paper]{article}
\usepackage[left=35mm,top=26mm,right=26mm,bottom=15mm]{geometry}
\usepackage[hmargin=2.5cm]{geometry} 
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{dcolumn,tabularx,ragged2e,caption}
\renewcommand{\rmdefault}{phv} 
\renewcommand{\sfdefault}{phv}
\captionsetup{singlelinecheck = false, justification=justified}
\newcolumntype{d}[1]{D..{#1}}
\newcolumntype{L}{>{\RaggedRight\arraybackslash\hspace{0pt}}X}
\newcommand\sym[1]{^{#1}}

\begin{document}
\begin{table}[h!tbp]
\caption{Regression Coefficients Predicting Distress} \label{add_label}
\begin{tabularx}{\textwidth}{@{} L *{4}{d{2.5}d{1.3}} @{}}
\toprule
Predictions
& \multicolumn{2}{c}{Step 1} & \multicolumn{2}{c}{Step 2} 
& \multicolumn{2}{c}{Step 3} & \multicolumn{2}{c@{}}{Step 4} \\
 \cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7} \cmidrule(l)   {8-9} 
   & \multicolumn{1}{c}{Beta} & \multicolumn{1}{c}{SE} 
    & \multicolumn{1}{c}{Beta} & \multicolumn{1}{c}{SE} 
   & \multicolumn{1}{c}{Beta} & \multicolumn{1}{c}{SE} 
    & \multicolumn{1}{c}{Beta} & \multicolumn{1}{c@{}}{SE} \\
    \midrule
 \textbf{Sex \scriptsize[1]} & 0.292 & 0.088 & 0.341\sym{****}& 0.088 &   0.363\sym{****}& 0.088 & 0.245 \sym{**}& 0.092 \\
\textbf{Age} & -0.012\sym{***}& 0.044 & 0.018 & 0.044 & 0 & 0.044 & -0.039  & 0.047 \\
\textbf{xxxxxxxxxxxxxxn \scriptsize[2]} & 0.009 & 0.111 & 0.019 & 0.11 & 0.038 & 0.11 & 0.172 & 0.112 \\
\textbf{Hxxxxxxxxxxxxxx \scriptsize[2]} & -0.088 & 0.114 & -0.064 & 0.114 & 0.008 & 0.113 & 0.227 & 0.12 \\
\textbf{xxxxxxxxxxxxxx} & 1.165\sym{****}& 0.071 & -1.149\sym{****}& 0.071 & -1.11\sym{****}& 0.071 & -1.064\sym{****}& 0.071 \\
\textbf{xxxxxxxxxxxxxx} & -0.006 & 0.005 & -0.005 & 0.005 & -0.007 & 0.005 & -0.009 & 0.005 \\
\textbf{Txxxxxxxxxxxxxxny} & -0.126\sym{*} & 0.44 & -0.119& 0.044 & -0.083 & 0.044 & 0.03 & 0.048 \\
\midrule
 \textbf{Txxxxxxxxxxxxxxt \scriptsize[3]} &       &       & -0.252 & 0.159 & -0.099  & 0.16 & -0.078 & 0.159 \\
\textbf{Nxxxxxxxxxxxxxxs \scriptsize[4]} &       &       & 0.635\sym{****}& 0.103 & 0.579\sym{****}& 0.102 & 0.632\sym{****}& 0.102 \\
\textbf{Nxxxxxxxxxxxxxxht exp \scriptsize[4]} &       &       & 0.256\sym{*} & 0.102 & 0.245\sym{*} & 0.101 & 0.2\sym{*} & 0.046 \\
\textbf{xxxxxxxxxxxxxx \scriptsize[5]} &       &       &       &       & 0.555\sym{*}& 0.24 & 0.52\sym{*} & 0.239 \\
\textbf{Sxxxxxxxxxxxxxxn} &  &       &       &       & 0.827\sym{**}& 0.306 & 0.771 \sym{*}& 0.305 \\
\textbf{Axxxxxxxxxxxxxxng} &     &       &       &       & 0.68\sym{****}& 0.086 & 0.562\sym{****}& 0.093 \\
\textbf{Sxxxxxxxxxxxxxxon \scriptsize[6]} &       &       &       &       & 0.759\sym{****}  & 0.134 & 0.698\sym{****}& 0.144 \\
\midrule
\textbf{Pxxxxxxxxxxxxxxm. w/ref \scriptsize[7]} &       &       &       &       &       &       & -0.492\sym{****}& 0.106 \\
\textbf{Pxxxxxxxxxxxxxxm. w.o./ref \scriptsize[7]} &       &       &       &       &       &       & -0.474\sym{****}& 0.111 \\
\textbf{Cuxxxxxxxxxxxxxxion} &       &       &       &       &       &       &  0.246 & 0.189 \\
\textbf{Cuxxxxxxxxxxxxxxing \scriptsize[8]} &       &       &       &       &       &       & -0.245 & 0.146 \\ 
\textbf{Nxxxxxxxxxxxxxxrk \scriptsize[8]} &       &       &       &       &       &       &  0.192 & 0.166 \\
\textbf{Cxxxxxxxxxxxxxxon} &       &       &       &       &       &       & -0.072 & 0.046 \\
\textbf{Timxxxxxxxxxxxxxxigin} &       &       &       &       &       &       & -0.071 & 0.045 \\
\textbf{Txxxxxxxxxxxxxxans} &       &       &       &       &       &       & -0.17\sym{****}& 0.046 \\
\textbf{Txxxxxxxxxxxxxxat} &       &       &       &       &       &       & -0.028 & 0.047 \\
\textbf{Gxxxxxxxxxxxxxxity} &       &       &       &       &       &       & -0.112\sym{*} & 0.053 \\
\midrule
$R^2$        & 0.074 & & 0.083 & & 0.102 & & 0.117  \\
$\Delta R^2$ &             & & 0.01\sym{****}        & & 0.018\sym{****}       & & 0.008\sym{****}    \\
 \bottomrule
 \end{tabularx}
\end{table}
 \footnotesize{Multipe regression coefficients, pooled across ten imputed datasets, calculated from standardized predictors. Error bars show 95\% confidence intervals. [1] reference category: male, [2] reference category: low level of education, [3] reference category: flight reason not life threatening,  [4] reference category: no negative flight experiences, [5] reference category: refugee or asylee status granted, [6] reference category: not seeking reunification with spouse or child under age 18, [7] reference category: communal housing, [8] reference category: not working but seeking work, [9] reference category: no regular leisure activities.}

答案1

有很多方法可以获得无衬线数学,请参阅用无衬线字体排版数学符号吗?

举个例子:

\documentclass[a4paper]{article}
\usepackage[left=35mm,top=26mm,right=26mm,bottom=15mm]{geometry}
%\usepackage[hmargin=2.5cm]{geometry} 
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{dcolumn,tabularx,ragged2e,caption}
\renewcommand{\rmdefault}{phv} 
\renewcommand{\sfdefault}{phv}
\captionsetup{singlelinecheck = false, justification=justified}
\newcolumntype{d}[1]{D..{#1}}
\newcolumntype{L}{>{\RaggedRight\arraybackslash\hspace{0pt}}X}
\newcommand\sym[1]{^{#1}}

\usepackage[helvet]{sfmath}

\begin{document}
\begin{table}[h!tbp]
\caption{Regression Coefficients Predicting Distress} \label{add_label}
\begin{tabularx}{\textwidth}{@{} L *{4}{d{2.5}d{1.3}} @{}}
\toprule
Predictions
& \multicolumn{2}{c}{Step 1} & \multicolumn{2}{c}{Step 2} 
& \multicolumn{2}{c}{Step 3} & \multicolumn{2}{c@{}}{Step 4} \\
\cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7} \cmidrule(l)   {8-9} 
& \multicolumn{1}{c}{Beta} & \multicolumn{1}{c}{SE} 
& \multicolumn{1}{c}{Beta} & \multicolumn{1}{c}{SE} 
& \multicolumn{1}{c}{Beta} & \multicolumn{1}{c}{SE} 
& \multicolumn{1}{c}{Beta} & \multicolumn{1}{c@{}}{SE} \\
\midrule
\textbf{Sex \scriptsize[1]} & 0.292 & 0.088 & 0.341\sym{****}& 0.088 &   0.363\sym{****}& 0.088 & 0.245 \sym{**}& 0.092 \\
\textbf{Age} & -0.012\sym{***}& 0.044 & 0.018 & 0.044 & 0 & 0.044 & -0.039  & 0.047 \\
\textbf{xxxxxxxxxxxxxxn \scriptsize[2]} & 0.009 & 0.111 & 0.019 & 0.11 & 0.038 & 0.11 & 0.172 & 0.112 \\
\textbf{Hxxxxxxxxxxxxxx \scriptsize[2]} & -0.088 & 0.114 & -0.064 & 0.114 & 0.008 & 0.113 & 0.227 & 0.12 \\
\textbf{xxxxxxxxxxxxxx} & 1.165\sym{****}& 0.071 & -1.149\sym{****}& 0.071 & -1.11\sym{****}& 0.071 & -1.064\sym{****}& 0.071 \\
\textbf{xxxxxxxxxxxxxx} & -0.006 & 0.005 & -0.005 & 0.005 & -0.007 & 0.005 & -0.009 & 0.005 \\
\textbf{Txxxxxxxxxxxxxxny} & -0.126\sym{*} & 0.44 & -0.119& 0.044 & -0.083 & 0.044 & 0.03 & 0.048 \\
\midrule
 \textbf{Txxxxxxxxxxxxxxt \scriptsize[3]} &       &       & -0.252 & 0.159 & -0.099  & 0.16 & -0.078 & 0.159 \\
\textbf{Nxxxxxxxxxxxxxxs \scriptsize[4]} &       &       & 0.635\sym{****}& 0.103 & 0.579\sym{****}& 0.102 & 0.632\sym{****}& 0.102 \\
\textbf{Nxxxxxxxxxxxxxxht exp \scriptsize[4]} &       &       & 0.256\sym{*} & 0.102 & 0.245\sym{*} & 0.101 & 0.2\sym{*} & 0.046 \\
\textbf{xxxxxxxxxxxxxx \scriptsize[5]} &       &       &       &       & 0.555\sym{*}& 0.24 & 0.52\sym{*} & 0.239 \\
\textbf{Sxxxxxxxxxxxxxxn} &  &       &       &       & 0.827\sym{**}& 0.306 & 0.771 \sym{*}& 0.305 \\
\textbf{Axxxxxxxxxxxxxxng} &     &       &       &       & 0.68\sym{****}& 0.086 & 0.562\sym{****}& 0.093 \\
\textbf{Sxxxxxxxxxxxxxxon \scriptsize[6]} &       &       &       &       & 0.759\sym{****}  & 0.134 & 0.698\sym{****}& 0.144 \\
\midrule
\textbf{Pxxxxxxxxxxxxxxm. w/ref \scriptsize[7]} &       &       &       &       &       &       & -0.492\sym{****}& 0.106 \\
\textbf{Pxxxxxxxxxxxxxxm. w.o./ref \scriptsize[7]} &       &       &       &       &       &       & -0.474\sym{****}& 0.111 \\
\textbf{Cuxxxxxxxxxxxxxxion} &       &       &       &       &       &       &  0.246 & 0.189 \\
\textbf{Cuxxxxxxxxxxxxxxing \scriptsize[8]} &       &       &       &       &       &       & -0.245 & 0.146 \\ 
\textbf{Nxxxxxxxxxxxxxxrk \scriptsize[8]} &       &       &       &       &       &       &  0.192 & 0.166 \\
\textbf{Cxxxxxxxxxxxxxxon} &       &       &       &       &       &       & -0.072 & 0.046 \\
\textbf{Timxxxxxxxxxxxxxxigin} &       &       &       &       &       &       & -0.071 & 0.045 \\
\textbf{Txxxxxxxxxxxxxxans} &       &       &       &       &       &       & -0.17\sym{****}& 0.046 \\
\textbf{Txxxxxxxxxxxxxxat} &       &       &       &       &       &       & -0.028 & 0.047 \\
\textbf{Gxxxxxxxxxxxxxxity} &       &       &       &       &       &       & -0.112\sym{*} & 0.053 \\
\midrule
$R^2$        & 0.074 & & 0.083 & & 0.102 & & 0.117  \\
$\Delta R^2$ &             & & 0.01\sym{****}        & & 0.018\sym{****}       & & 0.008\sym{****}    \\
 \bottomrule
\end{tabularx}
\end{table}
{\footnotesize Multipe regression coefficients, pooled across ten imputed datasets, calculated from standardized predictors. Error bars show 95\% confidence intervals. [1] reference category: male, [2] reference category: low level of education, [3] reference category: flight reason not life threatening,  [4] reference category: no negative flight experiences, [5] reference category: refugee or asylee status granted, [6] reference category: not seeking reunification with spouse or child under age 18, [7] reference category: communal housing, [8] reference category: not working but seeking work, [9] reference category: no regular leisure activities.}
\end{document}

在此处输入图片描述

相关内容