Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to make \displaybreak work?

1,038 views
Skip to first unread message

happytex

unread,
Sep 22, 2002, 5:24:29 AM9/22/02
to
here is a example:
$${\allowdisplaybreaks\begin{array}{ll}
\begin{array}{rl}
(1)\max z &= x_1 + 2x_2 \\
\raisebox{3ex}{s.t.}&\left\{\begin{array}{l}2x_1 - 3x_2 \le 6\\
x_1 + 2x_2 \le 10\\
x_1 ,x_2 \ge 0\end{array}\right.\end{array}&
\begin{array}{rl}
(2)\min z &= 5x_1 + 4x_2 \\
\raisebox{3ex}{s.t.}&\left\{\begin{array}{l} 6x_1+5x_2\ge 18\\
2x_1 + 7x_2 \ge 16\\
x_1 ,x_2 \ge 0
\end{array}\right.\end{array}\displaybreak[0]\\
\begin{array}{rl}
(3)\max z &= 2x_1 - 4x_2 + 3x_3\\
\raisebox{4ex}{s.t.}&\left\{\begin{array}{l}x_1 - 3x_2 + 2x_3 \le 12\\
2x_2 + x_3 \ge 10\\
x_1-2x_3=15\\
x_1 \ge 0,x_2 \le 0,x_3~ \mbox{no constraint}
\end{array}\right.\end{array}&
\begin{array}{rl}
(4)\min z &=\sum\limits_{i = 1}^m {\sum\limits_{j = 1}^n {c_{ij}
x_{ij} } }\\
\raisebox{3ex}{s.t.}&\left\{\begin{array}{l}\sum\limits_{i = 1}^m
{x_{ij} = b_j (j
= 1, \cdots ,n)}\\
\sum\limits_{j = 1}^n {x_{ij} = a_i (i = 1, \cdots ,m)}
\end{array}\right.\end{array}\displaybreak[0]\\
\begin{array}{cl}
(5)\max &cx\\ &\left\{\begin{array}{l} Ax=b\\ x \ge a
\end{array}\right.\end{array}&
\begin{array}{cl}
(6)\max &cx \\
&\left\{\begin{array}{l}
Ax=b \\
1 \le x \le u\end{array}\right.\end{array}\displaybreak[0]\\
\begin{array}{cl} (3)\min &cx\\
&\left\{\begin{array}{l} A_1 x = b_1 \\A_2 x \ge b_2\\x \ge 0
\end{array}\right.\end{array}&
\begin{array}{cl}(4)\min& cx+dy \\
&\left\{\begin{array}{l}
Ax+By=a \\
Ex+Gy \ge b \\
x \ge 0,
y\mbox{free variables}\end{array}\right.\end{array}\displaybreak[0]\\
\begin{array}{rl}
(7)&\min z=\sum\limits_{i = 1}^m \sum\limits_{j = 1}^n
c_{ij}x_{ij}\\
&\left\{ \begin{array}{l}
\sum\limits_{j = 1}^n x_{ij} = a_i \quad(i = 1, \cdots ,m) \\
\sum\limits_{i = 1}^m x_{ij} = b_j \quad(j = 1, \cdots ,n) \\
x_{ij} \ge 0 (i = 1, \cdots ,m;j = 1, \cdots n) \\
\end{array} \right.\end{array}&\begin{array}{rl}
(8)&\max z=\sum\limits_{j = 1}^n c_{j}x_{j} \\
&\left\{ {\begin{array}{ll}
\sum\limits_{j = 1}^n a_{ij} x_j \le b_i & (i = 1, \cdots ,m_1 < m)
\\
\sum\limits_{j = 1}^n a_{ij} x_j = b_i & (i = m_1 + 1, \cdots ,m) \\
x_j \ge 0& (j = 1, \cdots ,n_1 < n) \\
x_j \mbox{no constraint}&(j = n_1 + 1, \cdots ,n) \\
\end{array}} \right. \end{array}\end{array}
}$$


! Package amsmath Error: \displaybreak cannot be applied here.

See the amsmath package documentation for explanation.
Type H <return> for immediate help.
...

l.636 ...right.\end{array}\displaybreak[0]

why \displaybreak cannot be applied here? I want to make (1)and
(2)etc. to two column, so other packages, such as split, align didn't
work. So array is required here. Thanks for any suggestions.

Michael J Downes

unread,
Sep 23, 2002, 10:38:25 AM9/23/02
to
huzh...@openmba.com (happytex) wrote:

> ! Package amsmath Error: \displaybreak cannot be applied here.

...
> l.636 ...right.\end{array}\displaybreak[0]
>
> why \displaybreak cannot be applied here? I want to make (1)and
> (2)etc. to two column, so other packages, such as split, align didn't
> work. So array is required here.

If you must use "array", then you will have to be content with the
limitations of array. One of the limitations: It wraps an unbreakable
box around the entire contents.

A couple of other comments:

> $${\allowdisplaybreaks\begin{array}{ll}
> \begin{array}{rl}

The notation $$ ... $$ is not documented anywhere in the LaTeX book as a
supported way of writing displayed equations. For example, if you use
that notation the fleqn option does not work.

Also, in math mode, "{...}" creates an unbreakable box around the contents.
So even if array allowed page breaks, the wrapper

{\allowdisplaybreaks ... }

still would prevent it. Better would be something like

\begin{allowdisplaybreaks}%
\begin{gather*}
...
\end{gather*}
\end{allowdisplaybreaks}%

But I think your best bet is to use the amsmath environment "flalign*".
It is not precisely designed for this sort of two-column list but if you
do the equation numbers "by hand" it is not very much extra work.
And it allows page breaking (if \allowdisplaybreaks is used as shown).

------------------------------------------------------------------------
\documentclass{article}
\usepackage{amsmath}

\newcommand{\mynumber}{%
\refstepcounter{equation}%
(\theequation)%
}

\newenvironment{mathlist2}{%
\subequations
\renewcommand{\theequation}{\arabic{equation}}%
\allowdisplaybreaks
}{%
}

\begin{document}
\noindent
Beginning a two-column list of displayed formulas:
\begin{mathlist2}
\begin{flalign*}
&\begin{aligned}
\mynumber\quad


\max z &= x_1 + 2x_2 \\

\text{s.t.}&\begin{cases}


2x_1 - 3x_2 \le 6\\
x_1 + 2x_2 \le 10\\

x_1 ,x_2 \ge 0\end{cases}
\end{aligned}
&&
\begin{aligned}
\mynumber\quad


\min z &= 5x_1 + 4x_2 \\

\text{s.t.}&\begin{cases}


6x_1+5x_2\ge 18\\
2x_1 + 7x_2 \ge 16\\
x_1 ,x_2 \ge 0

\end{cases}
\end{aligned}
\\
&\begin{aligned}
\mynumber\quad


\max z &= 2x_1 - 4x_2 + 3x_3\\

\text{s.t.}&\begin{cases}


x_1 - 3x_2 + 2x_3 \le 12\\
2x_2 + x_3 \ge 10\\
x_1-2x_3=15\\

x_1 \ge 0,x_2 \le 0,x_3~ \text{no constraint}
\end{cases}
\end{aligned}
&&
\begin{aligned}
\mynumber\quad


\min z &=\sum\limits_{i = 1}^m {\sum\limits_{j = 1}^n {c_{ij}
x_{ij} } }\\

\text{s.t.}&\begin{cases}


\sum\limits_{i = 1}^m
{x_{ij} = b_j (j
= 1, \cdots ,n)}\\
\sum\limits_{j = 1}^n {x_{ij} = a_i (i = 1, \cdots ,m)}

\end{cases}
\end{aligned}
\\
&\begin{aligned}
\mynumber\quad
\max cx &
\begin{cases} Ax=b\\ x \ge a
\end{cases}
\end{aligned}
&&
\begin{aligned}
\mynumber\quad
\max cx &
\begin{cases}
Ax=b \\
1 \le x \le u\end{cases}
\end{aligned}
\\
&\begin{aligned}
\mynumber\quad
\min z&=\sum\limits_{i = 1}^m \sum\limits_{j = 1}^n
c_{ij}x_{ij}\\
&\begin{cases}


\sum\limits_{j = 1}^n x_{ij} = a_i \quad(i = 1, \cdots ,m) \\
\sum\limits_{i = 1}^m x_{ij} = b_j \quad(j = 1, \cdots ,n) \\
x_{ij} \ge 0 (i = 1, \cdots ,m;j = 1, \cdots n) \\

\end{cases}
\end{aligned}
&&
\begin{aligned}
\mynumber\quad
\max z&=\sum\limits_{j = 1}^n c_{j}x_{j} \\
&\begin{cases}


\sum\limits_{j = 1}^n a_{ij} x_j \le b_i & (i = 1, \cdots ,m_1 < m)
\\
\sum\limits_{j = 1}^n a_{ij} x_j = b_i & (i = m_1 + 1, \cdots ,m) \\
x_j \ge 0& (j = 1, \cdots ,n_1 < n) \\

x_j \text{no constraint}&(j = n_1 + 1, \cdots ,n) \\
\end{cases}
\end{aligned}
\end{flalign*}
\end{mathlist2}
And then
some following text to check what the vertical spacing looks like.
\end{document}

happytex

unread,
Sep 23, 2002, 10:32:10 PM9/23/02
to
It's wonderful, thanks a lot. one can't make this before he knows the
amsmath package indeed. I search through the google and amsmath help
files and can't do this, it's really difficulty for me. Thanks once
more.
0 new messages