对齐方程式的数量

对齐方程式的数量

我有以下代码:

\documentclass{article}
\usepackage{subfigure,graphicx,amsmath,amssymb, amsfonts,physics,empheq}


\begin{document}


    \begin{empheq}[left=\empheqlbrace]{align}
    Q_2(s) &= \frac{k_{21} Q_1(s)}{s+k_{12} + k_{02}} \\
    Q_3(s) &= \frac{k_{31} Q_1(s)}{s+k_{13} + k_{03}} \\
    s \, Q_1(s) + (k_{21} + k_{01}) Q_1(s) - \frac{k_{12}k_{21} Q_1(s)}{s+k_{12} + k_{02}} - \frac{k_{13}k_{31} Q_1(s)}{s+k_{13} + k_{03}} &= U_1(s) \\
    Y_1(s) &= \frac{Q_1(s)}{V_1} \\
    H(s) &= \frac{Y_1(s)}{U_1(s)}
    \end{empheq}



\end{document}

问题是方程式的数字不在同一行,而是在另一行。我该如何修复?

非常感谢您的参与。

答案1

如果您可以加载geometry,则可以获得更合理的边距,并且公式适合文本宽度。除此之外,您可以拆分中间行。在我看来,中间行的长部分应该在右侧,除非您有充分的理由采用另一种方式:

\documentclass{article}
\usepackage{subfigure,graphicx,amssymb, amsfonts,physics,empheq}
\usepackage{geometry}

\begin{document}

    \begin{empheq}[left=\empheqlbrace]{align}
    Q_2(s) &= \frac{k_{21} Q_1(s)}{s+k_{12} + k_{02}} \\
    Q_3(s) &= \frac{k_{31} Q_1(s)}{s+k_{13} + k_{03}} \\
    s \, Q_1(s) + (k_{21} + k_{01}) Q_1(s) - \frac{k_{12}k_{21} Q_1(s)}{s+k_{12} + k_{02}} - \frac{k_{13}k_{31} Q_1(s)}{s+k_{13} + k_{03}} &= U_1(s) \\
    Y_1(s) &= \frac{Q_1(s)}{V_1} \\
    H(s) &= \frac{Y_1(s)}{U_1(s)}
    \end{empheq}
    \bigskip

    \begin{empheq}[left=\empheqlbrace]{align}
    Q_2(s) &= \frac{k_{21} Q_1(s)}{s+k_{12} + k_{02}} \\
    Q_3(s) &= \frac{k_{31} Q_1(s)}{s+k_{13} + k_{03}} \\
    U_1(s)&=s \, Q_1(s) + (k_{21} + k_{01}) Q_1(s) - \frac{k_{12}k_{21} Q_1(s)}{s+k_{12} + k_{02}} - \frac{k_{13}k_{31} Q_1(s)}{s+k_{13} + k_{03}}\\
    Y_1(s) &= \frac{Q_1(s)}{V_1} \\
    H(s) &= \frac{Y_1(s)}{U_1(s)}
    \end{empheq}
    \bigskip

    \begin{empheq}[left=\empheqlbrace]{align}
    Q_2(s) &= \frac{k_{21} Q_1(s)}{s+k_{12} + k_{02}} \\
    Q_3(s) &= \frac{k_{31} Q_1(s)}{s+k_{13} + k_{03}} \\
    U_1(s)&=\begin{multlined}[t] s \, Q_1(s) + (k_{21} + k_{01}) Q_1(s) \\- \frac{k_{12}k_{21} Q_1(s)}{s+k_{12} + k_{02}} - \frac{k_{13}k_{31} Q_1(s)}{s+k_{13} + k_{03}}\end{multlined}\\
    Y_1(s) &= \frac{Q_1(s)}{V_1} \\
    H(s) &= \frac{Y_1(s)}{U_1(s)}
    \end{empheq}

\end{document} 

在此处输入图片描述

无关:该subfigure软件包已过时,不再维护。您应该用软件包subcaption及其subfigure环境替换它。此外,您不必加载amsmath,也不必mathtools使用empheq:它会为您完成。

答案2

您的公式与文本宽度非常接近,这会导致问题,如您所见。这是一个已知问题,不太可能得到修复。

你可以试试这个

\documentclass{article}
\usepackage{subfigure,graphicx,amsmath,amssymb, amsfonts,physics,empheq}
\begin{document}
%show the text width
\noindent\rule\textwidth{2mm}

\begin{empheq}[left=\empheqlbrace]{align}
  Q_2(s) &= \frac{k_{21} Q_1(s)}{s+k_{12} + k_{02}} \\
  Q_3(s) &= \frac{k_{31} Q_1(s)}{s+k_{13} + k_{03}} \\
  \begin{aligned}[b]
    s \, Q_1(s) &+ (k_{21} + k_{01}) Q_1(s)
    \\
    &- \frac{k_{12}k_{21}
      Q_1(s)}{s+k_{12} + k_{02}} - \frac{k_{13}k_{31} Q_1(s)}{s+k_{13}
      + k_{03}}
  \end{aligned}
&= U_1(s) \\
  Y_1(s) &= \frac{Q_1(s)}{V_1} \\
  H(s) &= \frac{Y_1(s)}{U_1(s)}
\end{empheq}
\end{document}

答案3

你可以堆叠长线。

\documentclass{article}
\usepackage{subfigure,graphicx,amsmath,amssymb, amsfonts,physics,empheq}
\usepackage{tabstackengine}
\TABstackMath
\TABstackMathstyle{\displaystyle}
\setstackgap{S}{6pt}
\begin{document}
    \begin{empheq}[left=\empheqlbrace]{align}
    Q_2(s) &= \frac{k_{21} Q_1(s)}{s+k_{12} + k_{02}} \\
    Q_3(s) &= \frac{k_{31} Q_1(s)}{s+k_{13} + k_{03}} \\
    {\tabbedShortstack[l]{s \, Q_1(s) + &(k_{21} + k_{01}) Q_1(s)-\\
     &\frac{k_{12}k_{21} Q_1(s)}{s+k_{12} + k_{02}} - 
     \frac{k_{13}k_{31} Q_1(s)}{s+k_{13} + k_{03}}}} &= U_1(s) \\
    Y_1(s) &= \frac{Q_1(s)}{V_1} \\
    H(s) &= \frac{Y_1(s)}{U_1(s)}
    \end{empheq}
\end{document}

在此处输入图片描述

相关内容