
나는 LaTeX에서 (회귀 출력에서) 다음 방정식을 복제하려고 노력해 왔습니다.
tabular
사용해 보았지만 align
여전히 비슷한 모양을 얻을 수 없습니다. 특히 괄호 안의 수량은 계수 바로 아래에 있고 소수점 이하 자릿수는 정렬됩니다. 그것을 달성하는 방법에 대한 단서가 있습니까?
편집: 내 시도를 MWE로 포함하겠다고 생각했습니다.
\documentclass{article}
\usepackage{amsmath}
\newcommand{\ti}[1]{\textit{#1}}
\begin{document}
\begin{alignat*}{9}
\widehat{\ti{math}4} & = 24.49 & {} - .274 & \ti{pctsgle} & {} - .422 & \ti{free} & {} - .752 & \ti{lmedinc} & {} + 9.01 & \ti{lexppp} \\
& \phantom{{} = {}} (59.24) & (.161) & & (.071) & & (5.358) & & (4.04) \\
n & = 299, R^2 = .472
\end{alignat*}
\end{document}
답변1
. array
숫자 표기법이 약간 변경되었습니다(소수점 앞은 항상 숫자임).
\documentclass{article}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{mathabx} % for widehat
\newcommand{\ti}[1]{\textit{#1}}
\usepackage{siunitx}
\begin{document}
\[\setlength\arraycolsep{2pt}
\sisetup{input-symbols = {( )}}
\begin{array}{r c
S[table-format=2.2] c
S[table-format=1.3]l c
S[table-format=1.3]l c
S[table-format=1.3]l c
S[table-format=1.2]l
}
\widehat{\ti{math}4}
& =
& 24.49 & - & 0.274 & \ti{pctsgle} & -
& 0.422 & \ti{free} & -
& 0.752 & \ti{lmedinc} & +
& 9.01 & \ti{lexppp} \\
&
& (59.24) & & (0.161) & &
& (0.071) & &
& (5.358) & &
& (4.04) & \\
n & = & \multicolumn{13}{l}{299,\quad R^2 = 0.472}
\end{array}
\]
\end{document}
답변2
나는 아래쪽 숫자를 더 작게 인쇄할 것이므로 더 가까운 숫자로 분류될 가능성은 없습니다. 이를 통해 \hidewidth
수평 공간을 차지하지 않고 어쨌든 주 계수 아래 중앙에 위치하도록 보장합니다.
\documentclass{article}
\usepackage{amsmath,amssymb}
\newcommand{\tvar}[1]{\operatorname{\mathit{#1}}}
\newcommand{\coeff}[2]{%
\begingroup\renewcommand{\arraystretch}{0.75}%
\begin{array}[t]{@{}c@{}}
#1 \\ % the main number
\scriptstyle \hidewidth(#2)\hidewidth
\end{array}%
\endgroup
}
\begin{document}
\begin{align*}
\widehat{\tvar{math}4}
& = \coeff{24.49}{59.24}
- \coeff{.274}{.161} \tvar{pctsgle}
- \coeff{.422}{.071} \tvar{free}
- \coeff{.752}{5.538} \tvar{lmedinc}
+ \coeff{9.01}{4.04} \tvar{lexppp}
\\
n & = 299,\quad R^2 = .472
\end{align*}
\end{document}