3

What is wrong with this alignment?


Context:


First, apologies for the lengthy post.

So I'm using the alignment environment for the first time in my LaTex article document, but not with much success. Here is my preamble for my article document:

\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{parskip}
\usepackage[margin=1.25in]{geometry}
\usepackage[shortlabels]{enumitem}
\usepackage{graphicx}
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{1pt}
\addtolength\parskip{3ex}
\fancyhfoffset{0.2cm}
\pagestyle{fancy}
\rfoot{Redacted}
\setcounter{secnumdepth}{4}
\addtolength{\footskip}{0.2in}
\newtheorem*{theorem}{\sc{Theorem}}
\newtheorem*{definition}{\sc{Definition}}
\newtheorem*{proposition}{\sc{Proposition}}
\newtheorem*{corollary}{\sc{Corollary}}
\newtheorem*{claim}{\sc{Claim}}
\newtheorem*{properties}{\sc{Properties}}
\newtheorem*{remark}{\sc{Remark}}
\DeclareMathOperator{\N}{\mathbb{N}}
\DeclareMathOperator{\Z}{\mathbb{Z}}
\DeclareMathOperator{\Q}{\mathbb{Q}}
\DeclareMathOperator{\R}{\mathbb{R}}
\DeclareMathOperator{\C}{\mathbb{C}}
\begin{document}


Question


In this article, I wanted to align some equations, so I used the following code based off some guides online:


We can now use the Pythagorean Theorem to find PE in two different equations which utilise $x$ and hence solve for $x$:

\emph{From $\triangle$PEB:}

\begin{align*}
PE &= $\sqrt{BP^2 - x^2}$ \\
&= $\sqrt{10^2 - x^2}$ \\
&= $\sqrt{100 - x^2}$
\end{align*}

However, I get this as the result: Result

And the error log seems too be correcting itself correcting me (i.e. it corrects something then tries to correct that correction which it thinks is incorrect... you know what? Just look at the log :)

! Missing } inserted.
<inserted text> 
                }
l.65 \end{align*}
                 
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Missing $ inserted.
<inserted text> 
                $
l.65 \end{align*}
                 
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

! Missing { inserted.
<inserted text> 
                {
l.65 \end{align*}
                 
I've put in what seems to be necessary to fix
the current column of the current alignment.
Try to go on, since this might almost work.

! Extra }, or forgotten $.
<recently read> }
                 
l.65 \end{align*}
                 
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

! Missing $ inserted.
<inserted text> 
                $
l.65 \end{align*}
                 
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

! Missing } inserted.
<inserted text> 
                }
l.65 \end{align*}
                 
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Missing } inserted.
<inserted text> 
                }
l.65 \end{align*}
                 
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Missing $ inserted.
<inserted text> 
                $
l.65 \end{align*}
                 
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

! Missing { inserted.
<inserted text> 
                {
l.65 \end{align*}
                 
I've put in what seems to be necessary to fix
the current column of the current alignment.
Try to go on, since this might almost work.

! Extra }, or forgotten $.
<recently read> }
                 
l.65 \end{align*}
                 
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

! Missing $ inserted.
<inserted text> 
                $
l.65 \end{align*}
                 
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

! Missing } inserted.
<inserted text> 
                }
l.65 \end{align*}
                 
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Missing } inserted.
<inserted text> 
                }
l.65 \end{align*}
                 
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Missing $ inserted.
<inserted text> 
                $
l.65 \end{align*}
                 
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

! Missing { inserted.
<inserted text> 
                {
l.65 \end{align*}
                 
I've put in what seems to be necessary to fix
the current column of the current alignment.
Try to go on, since this might almost work.

! Extra }, or forgotten $.
<recently read> }
                 
l.65 \end{align*}
                 
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

! Missing $ inserted.
<inserted text> 
                $
l.65 \end{align*}
                 
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

! Missing } inserted.
<inserted text> 
                }
l.65 \end{align*}
                 
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Missing } inserted.
<inserted text> 
                }
l.65 \end{align*}
                 
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Missing $ inserted.
<inserted text> 
                $
l.65 \end{align*}
                 
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

! Extra }, or forgotten $.
<recently read> }
                 
l.65 \end{align*}
                 
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

! Missing $ inserted.
<inserted text> 
                $
l.65 \end{align*}
                 
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

! Missing \endgroup inserted.
<inserted text> 
                \endgroup 
l.65 \end{align*}
                 
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Missing } inserted.
<inserted text> 
                }
l.65 \end{align*}
                 
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Misplaced \omit.
\math@cr@@@ ...@ \@ne \add@amps \maxfields@ \omit 
                                                  \kern -\alignsep@ \iftag@ ...
l.65 \end{align*}
                 
I expect to see \omit only after tab marks or the \cr of
an alignment. Proceed, and I'll ignore this case.

! Missing { inserted.
<inserted text> 
                {
l.65 \end{align*}
                 
I've put in what seems to be necessary to fix
the current column of the current alignment.
Try to go on, since this might almost work.

! Missing } inserted.
<inserted text> 
                }
l.65 \end{align*}
                 
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Missing $ inserted.
<inserted text> 
                $
l.65 \end{align*}
                 
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

! Extra }, or forgotten $.
<recently read> }
                 
l.65 \end{align*}
                 
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

! Missing $ inserted.
<inserted text> 
                $
l.65 \end{align*}
                 
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

! Missing \endgroup inserted.
<inserted text> 
                \endgroup 
l.65 \end{align*}
                 
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Missing } inserted.
<inserted text> 
                }
l.65 \end{align*}
                 
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Misplaced \omit.
\math@cr@@@ ...@ \@ne \add@amps \maxfields@ \omit 
                                                  \kern -\alignsep@ \iftag@ ...
l.65 \end{align*}
                 
I expect to see \omit only after tab marks or the \cr of
an alignment. Proceed, and I'll ignore this case.

! Missing { inserted.
<inserted text> 
                {
l.65 \end{align*}
                 
I've put in what seems to be necessary to fix
the current column of the current alignment.
Try to go on, since this might almost work.

! Missing } inserted.
<inserted text> 
                }
l.65 \end{align*}
                 
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Missing $ inserted.
<inserted text> 
                $
l.65 \end{align*}
                 
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

! Extra }, or forgotten $.
<recently read> }
                 
l.65 \end{align*}
                 
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

! Missing $ inserted.
<inserted text> 
                $
l.65 \end{align*}
                 
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.

! Missing \endgroup inserted.
<inserted text> 
                \endgroup 
l.65 \end{align*}
                 
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Missing } inserted.
<inserted text> 
                }
l.65 \end{align*}
                 
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.

! Misplaced \omit.
\math@cr@@@ ...@ \@ne \add@amps \maxfields@ \omit 
                                                  \kern -\alignsep@ \iftag@ ...
l.65 \end{align*}
                 
I expect to see \omit only after tab marks or the \cr of
an alignment. Proceed, and I'll ignore this case.

! Missing { inserted.
<inserted text> 
                {
l.65 \end{align*}
                 
I've put in what seems to be necessary to fix
the current column of the current alignment.
Try to go on, since this might almost work.

So basically all the error log did was confuse me, and I'm not quite sure what to do. Help appreciated to fix this!


Thanks!


2
  • 6
    align is already math mode, so don't use $ within it. Also, don't leave a blank line before an align. Aug 22, 2020 at 3:42
  • Thank you @PeterGrill!!!
    – global05
    Aug 22, 2020 at 3:44

1 Answer 1

4

So, as pointed out in the comments, this is a relatively simple fix - in other words a relatively short answer for a long post :) :

The align environment, by its very nature, is already math mode, so don't use $ within it. Removing the $ yields your desired output.

i.e.

We can now use the Pythagorean Theorem to find PE in two different equations which utilise $x$ and hence solve for $x$:

\emph{From $\triangle$PEB:}

\begin{align*}
PE &= \sqrt{BP^2 - x^2} \\
&= \sqrt{10^2 - x^2} \\
&= \sqrt{100 - x^2}
\end{align*}

Solution

2
  • You still have a blank line before the align, and that leaves more space than desirable between the text and the math display. Aug 22, 2020 at 19:50
  • Answering the question only required one to make the align work. The blank space might've been personal preference, and so I did not bother with it @barbarabeeton
    – global05
    Aug 22, 2020 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.