
Tenho tentado replicar a seguinte equação em LaTeX (a partir de uma saída de regressão):
Eu tentei usar tabular
e align
mas ainda não consigo obter uma aparência semelhante. Especificamente, as quantidades entre parênteses estão exatamente abaixo dos coeficientes, o alinhamento na casa decimal e assim por diante. Alguma pista sobre como conseguir isso?
Editar: pensei em incluir minha tentativa como 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}
Responder1
Com o uso do array
. A notação dos números foi ligeiramente alterada (antes das vírgulas decimais serem sempre números):
\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}
Responder2
Eu imprimiria os números inferiores menores, então é improvável que eles classifiquem com os mais próximos. Com \hidewidth
garantimos que eles não ocupam espaço horizontal, mas estão centralizados sob o coeficiente principal de qualquer maneira.
\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}