如何使用对齐环境继续以下页面中的一组方程式

如何使用对齐环境继续以下页面中的一组方程式

我有这个 Latex 代码来定义一组方程式:

\begin{equation}
    \min~(Cost, P^{Peak}) \label{eq:objective_function}
\end{equation}

subject to:

\begin{align}
    &T^{min}_{b} \leq T^{Building}_{t,b} \leq T^{max}_{b} \label{eq:temperature_balance} \\
    &V^{DHWmin}_{b} \leq V^{DHW}_{t,b} \leq V^{DHWmax}_{b} \label{eq:DHW_balance} \\
    & T^{Building}_{Z,b} \geq T^{Building}_{1,b} \cdot d^{Building} \label{eq:Tempeature_End_Value} \\
    & V^{DHW}_{Z,b} \geq V^{DHW}_{1,b} \cdot d^{DHW} \label{eq:DHW_End_Value} \\
    &T^{Building}_{t,b} = T^{Building}_{t-1, b} + \frac{Q_{t,b}^{SH} - Q_{t,b}^{DemandSH} -  Q_{t,b}^{LossesSH}}{V^{UFH}_b \cdot  \rho^{Concrete} \cdot c^{Concrete}} \label{eq:temperature_difference_equation} \\
    &V^{DHW}_{t,b} = V^{DHW}_{t-1, b} + \frac{Q_{t,b}^{DHW} - Q_{t,b}^{DemandDHW} -  Q_{t,b}^{LossesDHW}}{T^{DHW} \cdot  \rho^{Water} \cdot c^{Water}} \label{eq:volume_difference_equation} \\
    &Q_{t,b}^{SH} = x_{t,b} \cdot P^{HP}_b  \cdot COP_{t,b} \cdot \Delta t \label{eq:heating_energy_HP_SH} \\
    &Q_{t,b}^{SH} = y_{t,b} \cdot P^{HP}_b  \cdot COP_{t,b} \cdot \Delta t \label{eq:heating_energy_HP_DHW} \\
    &h_{t-1,b}^{runSH} + h_{t-1,b}^{runDHW} \leq h_{t,b}^{runSH} + h_{t,b}^{runDHW} + h_{t,b}^{switchedOff} \label{eq:numer_of_switch_offs_1} \\
    &h_{t,b}^{runSH} + h_{t,b}^{runDHW} \leq 1 \label{eq:numer_of_switch_offs_2} \\
    & \sum_{t=1}^{T} h_{t,b}^{switchedOff} \leq k_b \label{eq:numer_of_switch_offs_3} \\
    &x_{t,b} \leq h_{t,b}^{runSH} \label{eq:min_mod_SH_1} \\
    &x_{t,b} \geq h_{t,b}^{runSH} \cdot mod^{min} \label{eq:min_mod_SH_2} \\
    &y_{t,b} \leq h_{t,b}^{runDHW} \label{eq:min_mod_DHW_1} \\
    &y_{t,b} \geq h_{t,b}^{runDHW} \cdot mod^{min} \label{eq:min_mod_DHW_1} \\
    &P_{t,b}^{EV} \leq P_{t,b}^{EVMax} \cdot a_{t,b} \label{eq:max_power_EV} \\
    %&0 \leq SOC_{t,b} \leq 1 \label{eq:SOC_Balance} \\
    %& SOC_{Z,b} \geq SOC_{1,b} \cdot d^{SOC} \label{eq:SOC_End_Value} \\
    & SOC_{t,b} = SOC_{t-1,b} + \frac{P_{t,b}^{EV} \cdot \eta{b} \cdot \Delta t - P_{t,b}^{EVDrive} \cdot \Delta t}{C^{EV}_b} \label{eq:soc_difference_equation} \\
    &Cost = \sum_{t=1}^{Z} \sum_{b=1}^{B} ((x_{t,b} + y_{t,b}) \cdot P^{HP}_b + P_{t,b}^{EV} + P_{t,b}^{el}) \cdot \Delta t \cdot p_t   \label{eq:objective_cost} \\
    %&P^{Peak} =  \max_{t} \Bigg\{\sum_{b=1}^{B} ((x_{t,b} + y_{t,b}) \cdot P^{HP}_b + P_{t,b}^{EV} + P_{t,b}^{el})\Bigg\} \label{eq:peak} \\
    &\begin{aligned}
    &x_{t,b} \in [0,1], &\quad &y_{t,b} \in [0,1], \\
    &h_{t,b}^{runSH} \in \{0,1\}, & &h_{t,b}^{runDHW} \in \{0,1\}, \quad h_{t,b}^{switchedOff} \in \{0,1\}
    \end{aligned} 
\end{align}

我注释掉了一些方程式,但输出结果很好,正如您在屏幕截图中看到的那样。 在此处输入图片描述

然而,当添加这些进一步的方程式时,输出看起来非常奇怪,如下面的屏幕截图所示 在此处输入图片描述

奇怪的是,Latex 会用方程式开始一个新页面,更奇怪的是,即使到达页面边界,它仍会继续写方程式。这太奇怪了(我想不出任何排版工具为什么会这样做)。那么我该如何告诉 Latex 继续在下一页写方程式呢?

答案1

实施@DavidCarlisle 的两个建议,可以得到:

在此处输入图片描述

\documentclass{article}
\usepackage{amsmath} % for \displaybreaks macro and 'align' a safe environment
\allowdisplaybreaks
\newcommand\vn[1]{\mathrm{#1}} % "vn": short for "variable name"

\begin{document}

\begin{equation}\label{eq:objective_function}
    \min (\vn{Cost}, P^{\vn{Peak}}) 
\end{equation}
subject to:
\begin{align}
    &T^{\min}_{b} \leq T^{\vn{Building}}_{t,b} \leq T^{\max}_{b} 
       \label{eq:temperature_balance} \\
    &V^{\vn{DHWmin}}_{b} \leq V^{\vn{DHW}}_{t,b} \leq V^{\vn{DHWmax}}_{b} 
       \label{eq:DHW_balance} \\
    & T^{\vn{Building}}_{Z,b} \geq T^{\vn{Building}}_{1,b} \cdot d^{\vn{Building}} 
       \label{eq:Tempeature_End_Value} \\
    & V^{\vn{DHW}}_{Z,b} \geq V^{\vn{DHW}}_{1,b} \cdot d^{\vn{DHW}} 
       \label{eq:DHW_End_Value} \\
    &T^{\vn{Building}}_{t,b} = T^{\vn{Building}}_{t-1,b} 
        + \frac{Q_{t,b}^{\vn{SH}} - Q_{t,b}^{\vn{DemandSH}} -  Q_{t,b}^{\vn{LossesSH}}}%
               {V^{\vn{UFH}}_b \cdot  \rho^{\vn{Concrete}} \cdot c^{\vn{Concrete}}} 
       \label{eq:temperature_difference_equation} \\
    &V^{\vn{DHW}}_{t,b} = V^{\vn{DHW}}_{t-1, b} 
       + \frac{Q_{t,b}^{\vn{DHW}} - Q_{t,b}^{\vn{DemandDHW}} -  Q_{t,b}^{\vn{LossesDHW}}}%
              {T^{\vn{DHW}} \cdot  \rho^{\vn{Water}} \cdot c^{\vn{Water}}} 
       \label{eq:volume_difference_equation} \\
    &Q_{t,b}^{\vn{SH}} = x_{t,b} \cdot P^{\vn{HP}}_b  \cdot \vn{COP}_{t,b} \cdot \Delta t 
       \label{eq:heating_energy_HP_SH} \\
    &Q_{t,b}^{\vn{SH}} = y_{t,b} \cdot P^{\vn{HP}}_b  \cdot \vn{COP}_{t,b} \cdot \Delta t 
       \label{eq:heating_energy_HP_DHW} \\
    &h_{t-1,b}^{\vn{runSH}} + h_{t-1,b}^{\vn{runDHW}} 
       \leq h_{t,b}^{\vn{runSH}} + h_{t,b}^{\vn{runDHW}} + h_{t,b}^{\vn{switchedOff}} 
       \label{eq:numer_of_switch_offs_1} \\
    &h_{t,b}^{\vn{runSH}} + h_{t,b}^{\vn{runDHW}} \leq 1 
       \label{eq:numer_of_switch_offs_2} \\
    & \sum\nolimits_{t=1}^{T} h_{t,b}^{\vn{switchedOff}} \leq k_b 
       \label{eq:numer_of_switch_offs_3} \\
    &x_{t,b} \leq h_{t,b}^{\vn{runSH}} 
       \label{eq:min_mod_SH_1} \\
    &x_{t,b} \geq h_{t,b}^{\vn{runSH}} \cdot {\vn{mod}}^{\min} 
       \label{eq:min_mod_SH_2} \\
    &y_{t,b} \leq h_{t,b}^{\vn{runDHW}} 
       \label{eq:min_mod_DHW_1} \\
    &y_{t,b} \geq h_{t,b}^{\vn{runDHW}} \cdot {\vn{mod}}^{\min} 
       \label{eq:min_mod_DHW_1} \\
    &P_{t,b}^{\vn{EV}} \leq P_{t,b}^{\vn{EVMax}} \cdot a_{t,b} 
       \label{eq:max_power_EV} \\
    &0 \leq \vn{SOC}_{t,b} \leq 1 
       \label{eq:SOC_Balance} \\
    & \vn{SOC}_{Z,b} \geq \vn{SOC}_{1,b} \cdot d^{\vn{SOC}} 
          \label{SOC_End_Value} \\
    & \vn{SOC}_{t,b} = \vn{SOC}_{t-1,b} 
       +\frac{P_{t,b}^{\vn{EV}} \cdot \eta{b} \cdot \Delta t - P_{t,b}^{\vn{EVDrive}} \cdot \Delta t}%
             {C^{\vn{EV}}_b} 
       \label{eq:soc_difference_equation} \\
    &\vn{Cost} = \sum\nolimits_{t=1}^{Z} \sum\nolimits_{b=1}^{B} 
                 ((x_{t,b} + y_{t,b}) \cdot P^{\vn{HP}}_b + P_{t,b}^{\vn{EV}} + P_{t,b}^{\vn{el}}) 
                 \cdot \Delta t \cdot p_t   
       \label{eq:objective_cost} \\
    &P^{\vn{Peak}} =  \max_{t} \Bigl\{ 
       \sum\nolimits_{b=1}^{B} \bigl((x_{t,b} + y_{t,b}) \cdot P^{\vn{HP}}_b + P_{t,b}^{\vn{EV}} + P_{t,b}^{\vn{el}}\bigr)\Bigr\} \label{eq:peak} \\
    &\begin{aligned}
       &x_{t,b} \in [0,1], 
          && y_{t,b} \in [0,1], \\
       &h_{t,b}^{\vn{runSH}} \in \{0,1\}, 
          && h_{t,b}^{\vn{runDHW}} \in \{0,1\}, 
          && h_{t,b}^{\vn{switchedOff}} \in \{0,1\}
     \end{aligned} 
\end{align}
\end{document}

相关内容