일련의 숫자를 방정식의 계수와 정렬

일련의 숫자를 방정식의 계수와 정렬

다음과 같은 라텍스 방정식을 작성하고 싶습니다. 여기에 이미지 설명을 입력하세요

하지만 일련의 숫자를 계수와 완전히 정렬할 수는 없습니다. 내 코드는 다음과 같습니다.

\begin{equation}
\begin{aligned}
LNEP = & -0.23LNEER & +1.21LNCOST & +1.50LNFD & -1.03LNCP & -9.44 \\
& (0.12) & (0.13) & (0.27) & (0.37) & (1.33)
\end{aligned}
\end{equation}

그리고 그것은 다음과 같습니다: 여기에 이미지 설명을 입력하세요

누군가 나를 도와줄 수 있나요? 많은 감사를 드립니다.

답변1

당신이 사용할 수있는 alignedat.

\documentclass{article}

\usepackage{amsmath}

% Change the multiplication symbol to a centered dot.
\let\xtimes\times
\let\times\cdot

\begin{document}

\begin{equation}
  \begin{alignedat}{5}
    \mathrm{LNEP} 
    = -0&.23 \times \mathrm{LNEER} &{}
    + 1&.21 \times \mathrm{LNCOST} &{}
    + 1&.50 \times \mathrm{LNFD} &{}
    - 1&.03 \times \mathrm{LNCP} &{}
    - 9&.44 \\
    (0&.12)&
    (0&.13)&
    (0&.27)&
    (0&.37)&
    (1&.33)
  \end{alignedat}
\end{equation}

\end{document}

MWE 출력

귀하의 코드를 변경하지 마십시오.

  • 이름(여러 문자 변수를 사용해야 하는 경우)은 에 있어야 합니다 \mathrm.
  • 내 생각에 암시적 곱셈은 그 이름과 혼동스러워 보인다. 명시적으로 사용하는 것이 더 낫다.
  • 및 또는 사이 {}는 연산자 주변의 올바른 간격을 보장합니다.&+-
  • 예시 이미지와는 달리 소수점 이하 숫자를 정렬했습니다.

답변2

n개의 정렬 지점에 2n-1개의 앰퍼샌드가 필요하다는 사실을 잊어버렸습니다. 나는 을 사용하는 솔루션 과 정렬 지점이 필요하지 않은 를 alignedat{5}사용하는 더 간단한 솔루션을 제안합니다.stackengine

\documentclass{article}
\usepackage{geometry}
\usepackage{mathtools}
\usepackage[usestackEOL]{stackengine}
\newcommand{\mystackunder}[2] {\stackMath\stackunder{#1}{\mathclap{#2}}}

\begin{document}

\begin{equation}
\begin{alignedat}[t]{5}
LNEP = -0.23&LNEER &{} +1.21 & LNCOST &{} +1.50 & LNFD &{} -1.03 & LNCP &{} -9.44 & \\
 (0.12) & & (0.13) & & (0.27) & & (0.37) & & (1.33)
\end{alignedat}
\end{equation}
\bigskip

\begin{equation}%
LNEP = \mystackunder{-0.23}{(0.12)} LNEER +\mystackunder{1.21}{ (0.13)}LNCOST +\mystackunder{1.50}{(0.27)} LNFD -\mystackunder{1.03}{(0.37)} LNCP -\mystackunder{9.44}{(1.33)}
\end{equation}

\end{document} 

여기에 이미지 설명을 입력하세요

답변3

계수와 정확도를 함께 유지하십시오. 이렇게 하면 너비가 0인 괄호를 만들 수 있습니다. 더 나은 명확성을 위해 계수와 변수 사이에 얇은 공간을 추가했습니다.

\documentclass{article}
\usepackage{amsmath}

\newcommand{\cfac}[2]{% coefficient with accuracy
  \begingroup\renewcommand{\arraystretch}{0.7}%
  \begin{array}[t]{@{}r@{}}#1\\\makebox[0pt][r]{$($}#2\makebox[0pt][l]{$)$}\end{array}%
  \endgroup
}
\newcommand{\tvar}[1]{\mathrm{#1}}

\begin{document}

\begin{equation}
\tvar{LNEP} =
\cfac{-0.23}{0.12}\,\tvar{LNEER} + \cfac{1.21}{0.13}\,\tvar{LNCOST} +
\cfac{1.50}{0.27}\,\tvar{LNFD}   - \cfac{1.03}{0.37}\,\tvar{LNCP}   - \cfac{9.44}{1.33}
\end{equation}

\end{document}

여기에 이미지 설명을 입력하세요

관련 정보