두 개의 분수를 만들었지만(아래 예 참조) 분모가 나누기 막대에 너무 가깝습니다. 어떻게든 이걸 바꿀 수 있을까요?
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Combining two Gaussians with mean $\mu_1, \mu_2$ and variance $\sigma_1^2, \sigma_2^2$ yields a new Gaussian with mean $\mu = \frac{\sigma_2^2 \mu_1 + \sigma_1^2 \mu_2}{\sigma_1^2 + \sigma_2^2}$ and variance $\sigma^2 = \frac{1}{\frac{1}{\sigma_1^2} + \frac{1}{\sigma_2^2}}$
\end{document}
답변1
두 가지 주요 옵션이 있습니다.
\frac{...}{...}
-표기법에서 인라인 분수 표기법으로 전환\mu
및 에 대한 수식을 조판하기 위해 수학 표시로 전환합니다\sigma^2
.
\documentclass{article}
\usepackage{amsmath} % for "\text" macro
\begin{document}
\noindent
1. OP's original version:
Combining two Gaussians with mean $\mu_1, \mu_2$ and variance $\sigma_1^2, \sigma_2^2$ yields a new Gaussian with mean $\mu = \frac{\sigma_2^2 \mu_1 + \sigma_1^2 \mu_2}{\sigma_1^2 + \sigma_2^2}$ and variance $\sigma^2 = \frac{1}{\frac{1}{\sigma_1^2} + \frac{1}{\sigma_2^2}}$.
\medskip\noindent
2. Partial switch to inline-math notation
Combining two Gaussians with mean $\mu_1, \mu_2$ and variance
$\sigma_1^2, \sigma_2^2$ yields a new Gaussian with mean
$\mu = \frac{\sigma_2^2 \mu_1 + \sigma_1^2 \mu_2}{\sigma_1^2 + \sigma_2^2}$
and variance $\sigma^2 = \frac{1}{1/\sigma_1^2 + 1/\sigma_2^2}$.
\medskip\noindent
3. Full switch to inline math notation
Combining two Gaussians with means $\mu_1$ and $\mu_2$ and
variances $\sigma_1^2$ and $\sigma_2^2$ yields a new Gaussian
with mean $\mu = (\sigma_2^2 \mu_1 + \sigma_1^2 \mu_2)/(\sigma_1^2 +
\sigma_2^2)$ and variance $\sigma^2 = 1/(1/\sigma_1^2 + 1/\sigma_2^2)$.
\medskip\noindent
4. Switch to display math
Combining two Gaussians with means $\mu_1$ and $\mu_2$ and
variances $\sigma_1^2$ and $\sigma_2^2$ yields a new Gaussian
with mean $\mu$ and variance $\sigma^2$ given by
\[
\mu=\frac{\sigma_2^2 \mu_1 + \sigma_1^2 \mu_2}{\sigma_1^2 + \sigma_2^2}
\quad\text{and}\quad
\sigma^2 = \frac{1}{1/\sigma_1^2 + 1/\sigma_2^2}\,.
\]
\end{document}
답변2
여기서는 기본적으로 분수를 유지 \textstyle
하지만 선택적 인수로 변경할 수 있는 각 분수의 분자와 분모 위와 아래에 (기본) 1pt 버퍼를 추가합니다. 나는 그것을 부른다 \qfrac[]{}{}
. MWE는 전후를 보여줍니다.
\documentclass{article}
\usepackage{stackengine,scalerel}
\stackMath
\newcommand\qfrac[3][1pt]{\frac{%
\ThisStyle{\addstackgap[#1]{\SavedStyle#2}}}{%
\ThisStyle{\addstackgap[#1]{\SavedStyle#3}}%
}}
\usepackage{amsmath}
\begin{document}
Combining two Gaussians with mean $\mu_1, \mu_2$ and variance $\sigma_1^2,
\sigma_2^2$ yields a new Gaussian with mean $\mu = \frac{\sigma_2^2 \mu_1 +
\sigma_1^2 \mu_2}{\sigma_1^2 + \sigma_2^2}$ and variance $\sigma^2 =
\frac{1}{\frac{1}{\sigma_1^2} + \frac{1}{\sigma_2^2}}$
Combining two Gaussians with mean $\mu_1, \mu_2$ and variance $\sigma_1^2,
\sigma_2^2$ yields a new Gaussian with mean $\mu = \qfrac{\sigma_2^2 \mu_1 +
\sigma_1^2 \mu_2}{\sigma_1^2 + \sigma_2^2}$ and variance $\sigma^2 =
\qfrac[.5pt]{1}{\qfrac{1}{\sigma_1^2} + \qfrac{1}{\sigma_2^2}}$
\end{document}
답변3
또는 \raisebox를 사용하세요.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Combining two Gaussians with mean $\mu_1, \mu_2$ and variance $\sigma_1^2, \sigma_2^2$ yields a new Gaussian with mean $\mu = \frac{\raisebox{.2in}{$\sigma_2^2 \mu_1 + \sigma_1^2 \mu_2$}}{\raisebox{-.2in}{$\sigma_1^2 + \sigma_2^2$}}$ and variance $\sigma^2 = \frac{\raisebox{.2in}{$1$}}{\raisebox{-.2in}{$\frac{1}{\sigma_1^2} + \frac{1}{\sigma_2^2}$}}$
\end{document}