Math & SciencePage break within the array.

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Pushpkant
Posts: 7
Joined: Wed Jul 25, 2012 8:22 pm

Page break within the array.

Post by Pushpkant »

I am using array environment for mathematical derivations. Although this environment produce beautiful equation with perfect spacing but it also produce very much white space which is undesirable.
Is there any way to produce such derivation but allowing column and page breaks as well as the normal Tex matter does.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Page break within the array.

Post by cgnieder »

I guess you're looking for \allowdisplaybreaks. Have a look at mathmode and amsmath for details.

Regards
site moderator & package author
Pushpkant
Posts: 7
Joined: Wed Jul 25, 2012 8:22 pm

Re: Page break within the array.

Post by Pushpkant »

this command doesn't work with arrays.
I have tried this.
is there any other solution for this.
Or can I use other environment for writing these equation in more beautiful manner.
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Page break within the array.

Post by cgnieder »

Would you please add a Infominimal working example showing more precisely what you like to achieve? (It's quite unclear what you mean by “these equations”, for instance).

Regards
site moderator & package author
Pushpkant
Posts: 7
Joined: Wed Jul 25, 2012 8:22 pm

Page break within the array.

Post by Pushpkant »

here is my code:

Code: Select all

\begin{array}{rrlr}
    && \sin{20\degree}\cdot\sin{40\degree}
       \cdot\sin{60\degree}\cdot\sin{80\degree}\\
= && \frac{1}{2}\left[\cos{20\degree}-\cos{60\degree}
     \right]\cdot\frac{\sqrt{3}}{2}\sin{80\degree}\\
= && \frac{\sqrt{3}}{4}\left[\cos{20\degree}
     -\frac{1}{2}\right]\cdot\sin{80\degree}\\
= && \frac{\sqrt{3}}{4}\left[\cos{20\degree}\cdot
     \sin{80\degree}-\frac{1}{2}
     \sin{80\degree}\right]\\
= && \frac{\sqrt{3}}{8}\left[\sin{100\degree}+
     \sin{60\degree}-\sin{80\degree}\right]\\
= && \frac{\sqrt{3}}{8}\left[\sin\left(180\degree
     -100\degree\right)+\sin{60\degree}-
     \sin{80\degree}\right]\\
= && \frac{\sqrt{3}}{8}\left[\sin{80\degree}
     +\frac{\sqrt{3}}{2}-\sin{80\degree}\right]\\
= && \frac{3}{16}\\
\end{array}

Code: Select all

\begin{array}{rrlr}
    & \frac{\left(1+x\right)^2}
      {\left(1-x\right)^2}
         &=\left(1+x\right)^2\left(1-x\right)^{-2}\\
\RA & \frac{\left(1+x\right)^2}
      {\left(1-x\right)^2}
   &=\left(1+2x+x^2\right)\\
   &&\qquad    \left(1+2x+3x^2+4x^3+\dots\right.\\
   &&\qquad\left.+9x^8+10x^9+11x^{10}+\dots\right)\\
\end{array}
these are small examples, there are much more large such type of equation in my document.
this code produce the equations as I like, but this not allow the pagebreak??????????? :?: :?: :?: :?: :?:
PLz HeLp
User avatar
Stefan Kottwitz
Site Admin
Posts: 10359
Joined: Mon Mar 10, 2008 9:44 pm

Page break within the array.

Post by Stefan Kottwitz »

Better use amsmath multi-line environments instead of arrays. Then \allowdisplaybreaks works, as Clemens recommended. Example for you to test:

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\usepackage{gensymb}
\allowdisplaybreaks
\begin{document}
\vspace*{.8\textheight}
\begin{align}
  & \quad \sin{20\degree}\cdot\sin{40\degree}
    \cdot\sin{60\degree}\cdot\sin{80\degree}\\
  & = \frac{1}{2}\left[\cos{20\degree}-\cos{60\degree}
      \right]\cdot\frac{\sqrt{3}}{2}\sin{80\degree}\\
  & = \frac{\sqrt{3}}{4}\left[\cos{20\degree}
         -\frac{1}{2}\right]\cdot\sin{80\degree}\\
  & = \frac{\sqrt{3}}{4}\left[\cos{20\degree}\cdot
      \sin{80\degree}-\frac{1}{2}
      \sin{80\degree}\right]\\
  & = \frac{\sqrt{3}}{8}\left[\sin{100\degree}+
         \sin{60\degree}-\sin{80\degree}\right]\\
  & = \frac{\sqrt{3}}{8}\left[\sin\left(180\degree
      -100\degree\right)+\sin{60\degree}-
      \sin{80\degree}\right]\\
  & = \frac{\sqrt{3}}{8}\left[\sin{80\degree}
      +\frac{\sqrt{3}}{2}-\sin{80\degree}\right]\\
  & = \frac{3}{16}\\
\end{align}
\end{document}
Follow the links Clemens provided, to understand such environments and the alignment.

Stefan
LaTeX.org admin
Pushpkant
Posts: 7
Joined: Wed Jul 25, 2012 8:22 pm

Page break within the array.

Post by Pushpkant »

Thank's a lot Stefan_K
This is much better to use align instead of arrays.
But here a new question arises, I have to add a "&" at starting of all the equation I have written. And the document is about 250 pages, is there any other way to do so.

Here is the old code

Code: Select all

\begin{array}{rrlc}
\because & f(x) &=a+ bx +cx^2\\
\therefore &\lintegral{0}{1}{f(x)}{x}
       &=\lintegral{0}{1}{\left(a+bx+cx^2\right)}{x}\\
\RA  &\lintegral{0}{1}{f(x)}{x}
     &=\left[ax+\frac{bx^2}{2}+\frac{cx^3}{3}
       \right]^{1}_{0}\\
\RA &\lintegral{0}{1}{f(x)}{x}
     &= a+ \frac{b}{2}+\frac{c}{3}
     &\dots(1)\\
\end{array}
to produce exactly the same thing with align I have to put a "&" at starting of each and every line of equation.

Code: Select all

\begin{align*}
&\because & f(x) &=a+ bx +cx^2\\
&\therefore &\lintegral{0}{1}{f(x)}{x}
       &=\lintegral{0}{1}{\left(a+bx+cx^2\right)}{x}\\
&\RA  &\lintegral{0}{1}{f(x)}{x}
     &=\left[ax+\frac{bx^2}{2}+\frac{cx^3}{3}
       \right]^{1}_{0}\\
&\RA &\lintegral{0}{1}{f(x)}{x}
     &= a+ \frac{b}{2}+\frac{c}{3}
     &\dots(1)\\
\end{align*}
User avatar
Stefan Kottwitz
Site Admin
Posts: 10359
Joined: Mon Mar 10, 2008 9:44 pm

Page break within the array.

Post by Stefan Kottwitz »

The common use of align is with just one & symbol, which marks the position for alignment at the relation symbol, which follows the &. That's why it's good for multiple line equations with alignment. The left term is right aligned, the right side is left aligned, and the relation symbols are above and below each other. It's specifically for equations and relations, less for array-like alignment.

Stefan
LaTeX.org admin
Pushpkant
Posts: 7
Joined: Wed Jul 25, 2012 8:22 pm

Page break within the array.

Post by Pushpkant »

Is there any way to toggle the left and right alignment of the "align".

The first column of "align" is right aligned the second is left and so on.
I want first column to left aligned then second is right and so on.

The second problem is I want to make newenvironment for this, so that I don't have to change whole document. But the "\align" is showing the equation number and "\align*" is not working.

here is the code:

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage[fleqn]{amsmath}
\newenvironment{alg}
{
\align
}
{
\endalign
}

\begin{document}
\begin{align}
 & \Rightarrow & \sin\theta &=\sin\frac{\phi}{2}\\
\end{align}
\end{document}
this code works but I don't want equation numbers.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10359
Joined: Mon Mar 10, 2008 9:44 pm

Page break within the array.

Post by Stefan Kottwitz »

You could use an alignat environment, it's similar to align but aligning at several places. Also this is explained in the amsmath manual.

It's aligning rlrlrl... too, but if you start with an &, it becomes lrlrlr...

Stefan
LaTeX.org admin
Post Reply