1

I'm new to latex – I just want to generate a paper for my physics class. I have a derivation of an equation I need to split onto multiple lines but keep getting this error. I thought using an

\begin{align*} 
    \displaybreak[4]\\
\end{align*}

would work. But I get the error:

! Package amsmath Error: \displaybreak cannot be applied here.
l.110   } \displaybreak[4]

Here's my code, which I thought would work

\begin{align*}
  \vec{r} &= \|\vec{P}(\theta_j) - \vec{P}(\theta_i)\| \\
  &= \|(R\cos\theta_j, R\sin\theta_j) - (R\cos\theta_i, R\sin\theta_i) \\
  &= R \sqrt{
    \cos^2\theta_j -2 \cos\theta_j\cos\theta_i +  \cos^2\theta_i
    + \sin^2\theta_j -2 \sin\theta_j \sin\theta_i +  \sin^2\theta_i
  } \\
  &= R\sqrt{
    1-\sin^2\theta_j +1-\sin^2\theta_i  +  \sin^2\theta_j +  \sin^2\theta_i
    -2(\cos\theta_j\cos\theta_i+ \sin\theta_j \sin\theta_i)
  } \\
  &= R\sqrt{
    2-2(\cos\theta_j \cos\theta_i + \sin\theta_j \sin\theta_i)
  }\\
  \displaybreak[4]\\
  &= R\sqrt{
    2-2(\cos(\theta_j-theta_i))
  } \\
  &= R\sqrt{
    2-2(1-2sin\cos(\theta_j-theta_i))
  } \\
  & = 2R\sin\frac{\theta_j}{2}\\
  \therefore \vec{r} &= 2R\sin\left(\frac{\theta_j}{2}\right)
\end{align*}
4
  • Why don't you use the directive \allowdisplaybreaks and let LaTeX decide where it will cut the displayed equations?
    – Bernard
    Commented Feb 15, 2017 at 2:36
  • I did that in my preamble. Please please respond soon. This is due tomorrow. Commented Feb 15, 2017 at 2:41
  • Why do you typeset squares and square roots with unicode symbols? (La)TeX was designed for typesetting stuff like this: x^{y} will typeset x to the power of y and \sqrt{x} will typeset the square root of x using the proper font.
    – user10274
    Commented Feb 15, 2017 at 3:23
  • @null: I think this addresses my answer. I forgot to check the code. The reason is I have an editor which displays some unicode characters to have a better readibility of the contents of formulae (a sort of pretty-printing), yet saves in traditional code so there's no problem with the compiler. The answer is fixed now.
    – Bernard
    Commented Feb 15, 2017 at 11:14

1 Answer 1

1

This code does what you want on my system. It took the liberty to use the \vv command for vectors (from package esvect to have nice vector arrows) and to correct some typos (missing backslashes). In my opinion, this computation could be shortened, and I don't see the necessity of the last line, just to add a pair of parentheses.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry}%
\usepackage{mathtools, amssymb, amsfonts}
\usepackage[b]{esvect} %
\usepackage{lipsum}%
\allowdisplaybreaks

\begin{document}

\lipsum[1-5]
\begin{align*}
  \vv{r}            & = \|\vv{P}(\theta_j) - \vv{P}(\theta_i)\|                                     \\
                    & = \lVert(R\cos\theta_j, R\sin\theta_j) - (R\cos\theta_i, R\sin\theta_i)\rVert \\
                    & = R \sqrt{                                                                    
  \cos^2\theta_j -2 \cos\theta_j\cos\theta_i + \cos^2\theta_i
  + \sin^2\theta_j -2 \sin\theta_j \sin\theta_i + \sin^2\theta_i
  } \\
                    & = R\sqrt{                                                                     
  1-\sin^2\theta_j +1-\sin^2\theta_i + \sin^2\theta_j + \sin^2\theta_i
  -2(\cos\theta_j\cos\theta_i+ \sin\theta_j \sin\theta_i)
  } \\
                    & = R\sqrt{                                                                     
  2-2(\cos\theta_j \cos\theta_i + \sin\theta_j \sin\theta_i)
  }\\
                    & = R\sqrt{                                                                     
  2-2(\cos(\theta_j-\theta_i))
  } \\
                    & = R\sqrt{                                                                     
  2-2(1-2\sin\cos(\theta_j-\theta_i))
  } \\
                    & = 2R\sin\frac{\theta_j}{2}                                                    \\
  \therefore \vv{r} & = 2R\sin\left(\frac{\theta_j}{2}\right)                                       
\end{align*}

\end{document} 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .