11

The display pdf is ok but i receive the following error message :

! Package amsmath Error: \begin{aligned} allowed only in math mode.

\documentclass[10pt,a4paper]{book}

\usepackage[utf8x]{inputenc}
\usepackage[greek]{babel}
\usepackage{amssymb,amsmath,latexsym,amsfonts,amsthm,cleveref}
\newcommand{\abs}[1]{ \left\lvert#1\right\rvert} 
\newcommand{\norm}[1]{\left\lVert#1\right\rVert} 

\begin{document}

\begin{aligned}
\norm{xy}_{\mathbb{H}}^4 ={} &  \abs{z+w}^4 + 16(x_3 + y_3 - \frac{1}{2}Im(z\bar{w}))^2  \\
     & = \abs{ \abs{z+w}^2 + 4i(x_3 + y_3 - \frac{1}{2}Im(z\bar{w}))}^2}) \\
      & = \abs{ \abs{z}^2 + 4ix_3 + 2z\bar{w} + \abs{w}^2+ 4iy_3 }^2 \\
      & \leq (\abs{ \abs{z}^2 + 4ix_3} + 2\abs{\bar{z}}\abs{w} + \abs{ \abs{w}^2 +4iy_3})^2 \\ & = (\norm{x}_\mathbb{H}^2 + 2 \abs{\bar{z}}\abs{w} + \norm{y}_\mathbb{H}^2)^2 \\
      & \leq ( \norm{x}_\mathbb{H} + \norm{y}_\mathbb{H})^4. 
\end{aligned}

\end{document}
6
  • I wonder you could get a correct pdf if you have that error. Enclose the aligned environment with $...$ pair.
    – user31729
    Commented Jul 24, 2015 at 21:08
  • i can't see why the question is downvoted
    – touhami
    Commented Jul 24, 2015 at 21:14
  • @touhami: There were two downvotes some minutes ago, however, not by me...
    – user31729
    Commented Jul 24, 2015 at 21:15
  • i did enclosed with $ .. $ but now i receive :! Incomplete \ifodd; all text was ignored after line 25.
    – blackjack
    Commented Jul 24, 2015 at 21:17
  • @blackjack: Yes, there are more errors inside ;-) The typesetting is quite messy, actually
    – user31729
    Commented Jul 24, 2015 at 21:19

4 Answers 4

7

Use \begin{align*} ... \end{align*} instead of aligned so you won't need to put everything inside math mode.

0
5

Here's a solution with \begin{math}...\end{math} wrapping and some improvements for typesetting.

The left ) in the second line is wrong, in my opinion.

\documentclass[10pt,a4paper]{book}

\usepackage[utf8x]{inputenc}
\usepackage[greek]{babel}
\usepackage{amssymb,amsmath,latexsym,amsfonts,amsthm}
\usepackage{mathtools}
\usepackage{cleveref}
\DeclareMathOperator{\Imag}{Im}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\DeclarePairedDelimiter{\norm}{\lvert\lvert}{\rvert\rvert}

%\newcommand{\abs}[1]{ \left\lvert#1\right\rvert} 
%\newcommand{\norm}[1]{\left\lVert#1\right\rVert} 

\begin{document}
\begin{math}
\begin{aligned}
  \norm{xy}_{\mathbb{H}}^{4}  &=  \abs{z+w}^4 + 16(x_{3} + y_{3} - \frac{1}{2} \Imag(z\bar{w}))^{2}  \\
  & = \abs{ \abs{z+w}^{2} + 4i(x_3 + y_3 - \frac{1}{2}\Imag(z\bar{w}))}^2) \\
    & = \abs{ \abs{z}^2 + 4ix_3 + 2z\bar{w} + \abs{w}^2+ 4iy_3 }^2 \\
    & \leq (\abs{ \abs{z}^2 + 4ix_3} + 2\abs{\bar{z}}\abs{w} + \abs{ \abs{w}^2 +4iy_3})^2 \\ & = (\norm{x}_\mathbb{H}^2 + 2 \abs{\bar{z}}\abs{w} + \norm{y}_\mathbb{H}^2)^2 \\
    & \leq ( \norm{x}_\mathbb{H} + \norm{y}_\mathbb{H})^4. 
\end{aligned}
\end{math}
\end{document}
2
  • this will be in-line math, which is probably not what is wanted. Commented Jul 25, 2015 at 9:56
  • @barbarabeeton: Perhaps. I could do of course use \[...\], but as long as there is no other information from the O.P. I will keep it this way, stating however, I would not use it this way too
    – user31729
    Commented Jul 26, 2015 at 8:58
4

If you are using {aligned}You must enclose your formula in \[...\] like:

\[
\begin{aligned}
y &= mx+c \\
z &= nw+d
\end{aligned}
\]

\[...\]is not required if you are using {align}

1
  • 6
    Please don't advise $$...$$ -- that's outdated syntax
    – user31729
    Commented Jul 31, 2016 at 13:07
0

Package amsmath Error: \begin{aligned} allowed only in math mode.

The error is self-explaining, \begin{aligned} should be used only in math mode. You need to know what is math mode first:

LaTeX allows two writing modes for mathematical expressions: the inline math mode and display math mode:

  • inline math mode is used to write formulas that are part of a paragraph
  • display math mode is used to write expressions that are not part of a paragraph, and are therefore put on separate lines

Inline math mode delimiters

  1. \(...\)
  2. $...$
  3. \begin{math}...\end{math}

Display math mode delimiters

  1. \[...\]
  2. \begin{displaymath}...\end{displaymath}
  3. \begin{equation}...\end{equation}

In a word, you need write \begin{aligned} inside one of these math mode delimiters.

You must log in to answer this question.

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