对多行环境进行编号

对多行环境进行编号

我如何对多行环境(例如数组而不是方程式)进行编号,以便将编号放置在右下角?这就是我想要实现的

这是文档中代码的一部分,其结果如图所示,但没有编号(1.1.8)

$
\begin{array}{lll}  
\displaystyle\max_{x} & \sum\limits_{j=1}^n\ (\textstyle\sum_{p=1}^P c_{p}C_{pj})x_{j}\   &  \textnormal{[profit to be maximized]}  \\  
\textnormal{subject to} & &  \\
 & \sum\limits_{j=1}^n A_{rj}x_{j}\leq b_{r},  1\leq r\leq R & \textnormal{[upper bounds on consumed resources should be met]}  \\
 & \sum\limits_{j=1}^n C_{pj}x_{j}\geq d_{r},  1\leq p\leq P & \textnormal{[lower bounds on products' yield should be met]} \\
 & \left.
\begin{array}{ll}
\sum\limits_{j=1}^n x_{j}\leq 1 \\
x_{j}\geq 0, 1\leq j \leq n
\end{array}\right\} 
&
\left[
\begin{array}{ll}
\text{total intensity should be } \leq 1 \text{ and} \\
\text{intensities must be nonnegative}
\end{array}\right] 
\end{array}
$

答案1

我不确定我是否理解了你想要的问题

\documentclass{book}
\usepackage{lipsum}

\usepackage{amsmath}
\usepackage[a4paper]{geometry}
\makeatletter
\@addtoreset{equation}{section}
\renewcommand\theequation{\thesection.\@arabic\c@equation}
\makeatother


\begin{document}
\chapter{Foo}
\section{Foo bar}
\begin{equation}
\begin{array}{lll}  
\displaystyle\max_{x} & \sum\limits_{j=1}^n\ (\textstyle\sum_{p=1}^P c_{p}C_{pj})x_{j}\   &  \textnormal{[profit to be maximized]}  \\  
\textnormal{subject to} & &  \\
 & \sum\limits_{j=1}^n A_{rj}x_{j}\leq b_{r},  1\leq r\leq R & \textnormal{[upper bounds on consumed resources should be met]}  \\
 & \sum\limits_{j=1}^n C_{pj}x_{j}\geq d_{r},  1\leq p\leq P & \textnormal{[lower bounds on products' yield should be met]} \\
 & \left.
\begin{array}{ll}
\sum\limits_{j=1}^n x_{j}\leq 1 \\
x_{j}\geq 0, 1\leq j \leq n
\end{array}\right\} 
&
\left[
\begin{array}{ll}
\text{total intensity should be } \leq 1 \text{ and} \\
\text{intensities must be nonnegative}
\end{array}\right] 
\end{array}
\end{equation}
\end{document}

当公式大于文本宽度时,这是正常的。

我认为每次有多行方程时你都需要这样做,不是吗?请注意,你这样做不是格式化多行方程的好方法,请参阅amsmath 文档

\documentclass{book}
\usepackage{lipsum}

\usepackage{amsmath}
\usepackage[a4paper]{geometry}
\makeatletter
\@addtoreset{equation}{section}
\renewcommand\theequation{\thesection.\@arabic\c@equation}
\makeatother


\begin{document}
\chapter{Foo}
\section{Foo bar}   

\begin{align*}
x& = y_1-y_2+y_3-y_5+y_8-\dots
&& \text{total intensity should be}\\
& = y'\circ y^* && \text{total intensity}\\
& = y(0) y' && \text {total} \\
& && \refstepcounter{equation}\tag{\theequation}
\end{align*}
\end{document}

最后这是你使用的示例align*

\documentclass{book}
\usepackage{lipsum}

\usepackage{amsmath}
\usepackage[a4paper]{geometry}
\makeatletter
\@addtoreset{equation}{section}
\renewcommand\theequation{\thesection.\@arabic\c@equation}
\makeatother


\begin{document}
\chapter{Foo}
\section{Foo bar}

\begin{align*} 
&\max_{x}
&  
& \sum\limits_{j=1}^n\ (\textstyle\sum_{p=1}^P c_{p}C_{pj})x_{j}
& 
&\textnormal{[profit to be maximized]}  \\  
&\textnormal{subject to} 
& 
&
&
&\\
&
& 
&\sum\limits_{j=1}^n A_{rj}x_{j}\leq b_{r},  1\leq r\leq R 
&
& \textnormal{[upper bounds on consumed resources should be met]}  \\
&
& 
&\sum\limits_{j=1}^n C_{pj}x_{j}\geq d_{r},  1\leq p\leq P 
&
& \textnormal{[lower bounds on products' yield should be met]} \\
& 
&
&\left.
\begin{array}{ll}
\sum\limits_{j=1}^n x_{j}\leq 1 \\
x_{j}\geq 0, 1\leq j \leq n
\end{array}\right\} 
&
&
\left[
\begin{array}{ll}
\text{total intensity should be } \leq 1 \text{ and} \\
\text{intensities must be nonnegative}
\end{array}\right] \\
& & & &  & \refstepcounter{equation}\tag{\theequation}
\end{align*}

\end{document}

相关内容