如何在公式中多行和左调整

如何在公式中多行和左调整

我正在尝试使一组方程式看起来更整洁,但需要进入下一个类似并向左调整,如下所示:

在此处输入图片描述

这是我目前所拥有的,我刚刚用 \quad 填充,但我认为它看起来不太干净:

\begin{equation}
    \begin{aligned} 
        \label{eq:model-3-intercept+time}
        q_{rs}(t) &= \exp(\beta_{rs} + \alpha_{rs}t + \gamma_{rs}drug) \quad \text{for } (r,s) \in \{(1,2), (2,3), (3,4)\} \text{ where } \gamma_{23} = \gamma_{34} \\ \\
        q_{rs}(t) &= \exp(\beta_{rs} + \alpha_{D}t + \gamma_{D}drug) \quad \text{for } (r,s) \in \{(1,5), (2,5), (3,5), (4,5)\} \\ \\
        q_{rs}(t) &= \exp(\beta_{rs} + \alpha_{B}t)  \quad \quad \quad \quad \quad \enspace \text{for } (r,s) \in \{(2,1), (3,2), (4,3)\}
    \end{aligned}
\end{equation}

在此处输入图片描述

有什么建议吗?谢谢!

答案1

像这样吗?

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath} % for 'aligned' environment
\usepackage{newtxtext,newtxmath} % optional, for Times Roman text and math font
\begin{document}

\begin{equation}\label{eq:model-3-intercept+time}
\begin{aligned} 
   q_{rs}(t) &= \exp(\beta_{rs} + \alpha_{rs}t + \gamma_{rs}\mathit{drug}) \\
             &\qquad\qquad\text{for $(r,s)\in\{(1,2), (2,3), (3,4)\}$, 
              where $\gamma_{23} = \gamma_{34}$} \\[1ex]
   q_{rs}(t) &= \exp(\beta_{rs} + \alpha_{D}t + \gamma_{D}\mathit{drug}) \\
             &\qquad\qquad\text{for $(r,s)\in\{(1,5), (2,5), (3,5), (4,5)$\}} \\[1ex]
   q_{rs}(t) &= \exp(\beta_{rs} + \alpha_{B}t)  \\
             &\qquad\qquad\text{for $(r,s)\in\{(2,1), (3,2), (4,3)\}$}
\end{aligned}
\end{equation}

\end{document}

答案2

基于以下的解决方案alignedat

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
    \begin{alignedat}{2}
        \label{eq:model-3-intercept+time}
        q_{rs}(t) &= \exp(\beta_{rs} & & + \alpha_{rs}t + \gamma_{rs}\text{drug})\\
          & & & \text{for } (r,s) \in \{(1,2), (2,3), (3,4)\}, \text{ where } \gamma_{23} = \gamma_{34} \\[0.5ex]
        q_{rs}(t) &= \exp(\beta_{rs} & & + \alpha_{D}t + \gamma_{D}\text{drug})\\
          & & & \text{for } (r,s) \in \{(1,5), (2,5), (3,5), (4,5)\} \\[0.5ex]
        q_{rs}(t) &= \exp(\beta_{rs} & & + \alpha_{B}t) \\
         & & & \text{for } (r,s) \in \{(2,1), (3,2), (4,3)\}
    \end{alignedat}
\end{equation}

\end{document} 

在此处输入图片描述

相关内容