![使用方程式打破投影仪中的框架](https://linux22.com/image/461507/%E4%BD%BF%E7%94%A8%E6%96%B9%E7%A8%8B%E5%BC%8F%E6%89%93%E7%A0%B4%E6%8A%95%E5%BD%B1%E4%BB%AA%E4%B8%AD%E7%9A%84%E6%A1%86%E6%9E%B6.png)
我有以下 MWE:
\documentclass[10pt]{beamer}
\usetheme{Warsaw}
\useoutertheme{infolines}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{array}
\usepackage{color,colortbl}
\allowdisplaybreaks[1] %to allow automatic page breaks for formulas written with \alignat
\begin{document}
\begin{frame}[allowframebreaks]{Mathematical model}
\textbf{Modelo matemático:}
\begin{alignat}{2}
\mbox{maximize } z_1 = & \sum_{i \in V} \sum_{k \in V} \left( p_{ki} + q_i \right)~y_{ki} \label{Obj1} \\
\hspace{-0.5cm}\mbox{minimize } z_2 = & \sum_{(i,j) \in A} c_{ij}~x_{ij} \label{Obj2} \\
\mbox{subject to} &
&& \nonumber \\
& \sum_{j:(1,j) \in A} x_{1j} = 1, && j \in V \label{Restricao1} \\
& \sum_{i:(i,1) \in A} x_{i1} = 1, && i \in V \label{Restricao2} \\
& \sum_{j \in V} x_{ij} - \sum_{k \in V} y_{ki} = 0, \qquad && i \in V \label{Restricao3} \\
& \sum_{i \in V} x_{ij} - \sum_{k \in V} y_{kj} = 0, && j \in V \label{Restricao4} \\
& x_{ij} - y_{1j} = 0, && j \in V \label{Restricao5} \\
& x_{ij} +1 \geq y_{ki} + y_{(k+1)j}, && (i,j) \in A, \quad k \in V \label{Restricao6} \\
& w_j \geq w_0 + e_{1j} \cdot x_{1j} - M \cdot (1-x_{1j}) && (1,j) \in A \label{Restricao7} \\
& w_j \geq w_i + \left( e_{ij} + d_i \right)\cdot x_{ij} - M \cdot (1-x_{ij}) \quad \quad && (i,j) \in A, \quad i \neq 1 \label{Restricao8} \\
& \sum_{t \in T} \phi_{it} - \sum_{k \in V} y_{ki} = 0 && i \in V \label{Restricao9} \\
& z_{it} \leq M \cdot \phi_{it} && i \in V, \quad t \in T \label{Restricao10} \\
& w_i - \sum_{t \in T} z_{it} = 0 && i \in V \label{Restricao11} \\
& a_{it} \cdot \phi_{it} \leq z_{it} \leq b_{it} \cdot \phi_{it} && i \in V, \quad t \in T \label{Restricao12}\\
& \alpha_t \leq \sum_{i \in B} \phi_{it} \leq \beta_t && t \in T \label{Restricao13}\\
& \sum_{i \in R_t} \phi_{it} =1 && t \in T \label{Restricao14}\\
& \sum_{i \in H_t} \phi_{it} =1 && t \in T\setminus{|T|} \label{Restricao15}\\
& \sum_{i \in V} y_{ki} \geq \sum_{i \in V} y_{(k+1)i} && k \in V\setminus \{n\} \label{Restricao16}\\
& \sum_{i \in V} y_{ki} \leq 1 && k \in V \label{Restricao17}\\
& \sum_{k \in V} y_{ki} \leq 1 && i \in V \label{Restricao18}\\
& x_{ij} \in \{0,1\} && (i,j) \in A \label{Restricao19}\\
& y_{ki} \in \{0,1\} && i \in V, \quad k \in V \label{Restricao20}\\
& \phi_{it} \in \{0,1\} && i \in V, \quad t \in T \label{Restricao21}\\
& w_{i} \geq 0 && i \in V \label{Restricao22}\\
& z_{it} \geq 0 && i \in V, \quad t \in T. \label{Restricao23}
\end{alignat}
\end{frame}
\end{document}
其结果不理想:
我想将我的数学模型(在环境中alignat
)分解为两个或更多框架。我尝试使用allowframebreaks
选项,但没有用。有人能帮我吗?
答案1
我不会依赖自动框架中断。我进一步建议您将 23 个限制放在双列column
环境中。这样您就可以在两个框架中排版所有 25 个方程式。
旁白:你确定把所有 25 个方程式都讲给听众是个好主意吗?你认为在演讲结束后,听众们会记住哪些方程式(如果有的话!)?
\documentclass[10pt]{beamer}
\usetheme{Warsaw}
\useoutertheme{infolines}
\usepackage[english]{babel}
%\usepackage[utf8]{inputenc} % that's the default nowadays
\usepackage[T1]{fontenc}
\usepackage{mathtools,amssymb,array,xcolor,colortbl}
\begin{document}
\begin{frame}{Modelo matemático I}
\begin{align}
\max z_1 &= \sum_{i \in V} \sum_{k \in V} ( p_{ki} + q_i )\,y_{ki} \label{Obj1} \\
\min z_2 &= \sum_{\mathclap{(i,j) \in A}} c_{ij}\,x_{ij} \label{Obj2}
\end{align}
subject to
\small
\begin{columns}[t]
\column{0.45\textwidth}
\begin{align}
&\sum_{\mathclap{j:(1,j) \in A}} x_{1j} = 1, \quad j\in V \label{Restricao1} \\
&\sum_{\mathclap{i:(i,1) \in A}} x_{i1} = 1, \quad i\in V \label{Restricao2} \\
& \sum_{j \in V} x_{ij} - \sum_{k \in V} y_{ki} = 0, \quad i \in V \label{Restricao3}
\end{align}
\column{0.55\textwidth}
\begin{align}
& \sum_{i \in V} x_{ij} - \sum_{k \in V} y_{kj} = 0, \quad j \in V \label{Restricao4} \\[\jot]
& x_{ij} - y_{1j} = 0, \quad j \in V \label{Restricao5} \\[3\jot]
& x_{ij} +1 \geq y_{ki} + y_{(k+1)j}, \label{Restricao6} \\
&\qquad (i,j) \in A, \ k \in V \notag
\end{align}
\end{columns}
\end{frame}
\begin{frame}{Modelo matemático II}
\small
\begin{columns}
\column{0.52\textwidth}
\begin{align}
& w_j \geq w_0 + e_{1j} x_{1j} - M (1-x_{1j}), \label{Restricao7} \\
& \qquad (1,j) \in A \notag\\
& w_j \geq w_i + ( e_{ij} + d_i ) x_{ij} \label{Restricao8} \\
& \qquad - M (1-x_{ij}) (i,j),
\quad i\in A, \ i \neq 1 \notag\\
& \sum_{t \in T} \phi_{it} - \sum_{k \in V} y_{ki} = 0,
\quad i \in V \label{Restricao9} \\
& z_{it} \leq M \phi_{it}, \quad i \in V, \ t \in T \label{Restricao10} \\
& w_i - \sum_{t \in T} z_{it} = 0, \quad i \in V \label{Restricao11} \\
& a_{it} \phi_{it} \leq z_{it} \leq b_{it} \phi_{it},
\quad i \in V, \ t \in T \label{Restricao12} \\
& \alpha_t \leq \sum_{i \in B} \phi_{it} \leq \beta_t,
\quad t \in T \label{Restricao13} \\
& \sum_{i \in R_t} \phi_{it} =1, \quad t \in T \label{Restricao14}
\end{align}
\column{0.48\textwidth}
\begin{align}
& \sum_{i \in H_t} \phi_{it} =1, \quad t\in T\setminus{|T|} \label{Restricao15}\\
& \sum_{i \in V} y_{ki} \geq \sum_{i \in V} y_{(k+1)i},
\ k \in V \setminus \{n\} \label{Restricao16}\\
& \sum_{i \in V} y_{ki} \leq 1, \quad k \in V \label{Restricao17}\\
& \sum_{k \in V} y_{ki} \leq 1, \quad i \in V \label{Restricao18}\\
& x_{ij} \in \{0,1\}, \quad (i,j) \in A \label{Restricao19}\\
& y_{ki} \in \{0,1\}, \quad i \in V, \ k \in V \label{Restricao20}\\
& \phi_{it} \in \{0,1\}, \quad i \in V, \ t \in T \label{Restricao21}\\
& w_{i} \geq 0, \quad i \in V \label{Restricao22}\\
& z_{it} \geq 0, \quad i \in V, \ t \in T. \label{Restricao23}
\end{align}
\end{columns}
\end{frame}
\end{document}
答案2
您应该使用@Mico 的答案,您将通过手动构建的框架获得更好的结果。
只是为了完整性:理论上你可以使用该allowdisplaybreaks
选项来允许在数学内容中进行分页:
\documentclass[10pt]{beamer}
\usetheme{Warsaw}
\useoutertheme{infolines}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{array}
\usepackage{color,colortbl}
\allowdisplaybreaks[1] %to allow automatic page breaks for formulas written with \alignat
\begin{document}
\begin{frame}[allowframebreaks,allowdisplaybreaks]{Mathematical model}
\textbf{Modelo matemático:}
\begin{alignat}{2}
\mbox{maximize } z_1 = & \sum_{i \in V} \sum_{k \in V} \left( p_{ki} + q_i \right)~y_{ki} \label{Obj1} \\
\hspace{-0.5cm}\mbox{minimize } z_2 = & \sum_{(i,j) \in A} c_{ij}~x_{ij} \label{Obj2} \\
\mbox{subject to} &
&& \nonumber \\
& \sum_{j:(1,j) \in A} x_{1j} = 1, && j \in V \label{Restricao1} \\
& \sum_{i:(i,1) \in A} x_{i1} = 1, && i \in V \label{Restricao2} \\
& \sum_{j \in V} x_{ij} - \sum_{k \in V} y_{ki} = 0, \qquad && i \in V \label{Restricao3} \\
& \sum_{i \in V} x_{ij} - \sum_{k \in V} y_{kj} = 0, && j \in V \label{Restricao4} \\
& x_{ij} - y_{1j} = 0, && j \in V \label{Restricao5} \\
& x_{ij} +1 \geq y_{ki} + y_{(k+1)j}, && (i,j) \in A, \quad k \in V \label{Restricao6} \\
& w_j \geq w_0 + e_{1j} \cdot x_{1j} - M \cdot (1-x_{1j}) && (1,j) \in A \label{Restricao7} \\
& w_j \geq w_i + \left( e_{ij} + d_i \right)\cdot x_{ij} - M \cdot (1-x_{ij}) \quad \quad && (i,j) \in A, \quad i \neq 1 \label{Restricao8} \\
& \sum_{t \in T} \phi_{it} - \sum_{k \in V} y_{ki} = 0 && i \in V \label{Restricao9} \\
& z_{it} \leq M \cdot \phi_{it} && i \in V, \quad t \in T \label{Restricao10} \\
& w_i - \sum_{t \in T} z_{it} = 0 && i \in V \label{Restricao11} \\
& a_{it} \cdot \phi_{it} \leq z_{it} \leq b_{it} \cdot \phi_{it} && i \in V, \quad t \in T \label{Restricao12}\\
& \alpha_t \leq \sum_{i \in B} \phi_{it} \leq \beta_t && t \in T \label{Restricao13}\\
& \sum_{i \in R_t} \phi_{it} =1 && t \in T \label{Restricao14}\\
& \sum_{i \in H_t} \phi_{it} =1 && t \in T\setminus{|T|} \label{Restricao15}\\
& \sum_{i \in V} y_{ki} \geq \sum_{i \in V} y_{(k+1)i} && k \in V\setminus \{n\} \label{Restricao16}\\
& \sum_{i \in V} y_{ki} \leq 1 && k \in V \label{Restricao17}\\
& \sum_{k \in V} y_{ki} \leq 1 && i \in V \label{Restricao18}\\
& x_{ij} \in \{0,1\} && (i,j) \in A \label{Restricao19}\\
& y_{ki} \in \{0,1\} && i \in V, \quad k \in V \label{Restricao20}\\
& \phi_{it} \in \{0,1\} && i \in V, \quad t \in T \label{Restricao21}\\
& w_{i} \geq 0 && i \in V \label{Restricao22}\\
& z_{it} \geq 0 && i \in V, \quad t \in T. \label{Restricao23}
\end{alignat}
\end{frame}
\end{document}