GeneralProblems with align

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
-Niels
Posts: 5
Joined: Thu Jun 19, 2008 2:03 pm

Problems with align

Post by -Niels »

I seem to be getting excactly 100 errors with my align enviroment, at texnicCenter is trying to convince me that the problem is around the \end{align} - line. My code is as follows:
\begin{subequations}
\begin{align}
det(\underline{\underline{A}}_3-\lambda\underline{\underline{I}}) &= (-\lambda)((-1)^{1+1}(\emph{\lambda^2+b_1\lambda+b_2})+0\cdot(\underline{\underline{A}}_{21})+(-b_3((-1)^{3+1}\cdot1)) \\
det(\underline{\underline{A}}_3-\lambda\underline{\underline{I}}) &=(-\lambda)(\emph{\lambda^2+b_1\lambda+b2})-b_3 \\
det(\underline{\underline{A}}_3-\lambda\underline{\underline{I}}) &= -\lambda^3 - b_1\lambda^2 - b_2\lambda - b_3 \\
det(\underline{\underline{A}}_3-\lambda\underline{\underline{I}}) &= -(\lambda^3 + b_1\lambda^2 + b_2\lambda + b_3)
\end{align}
\end{subequations}

Could the problem be that the equations are too large? I'm lost at this problem, hope someone can help.

Recommended reading 2024:

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

NEW: TikZ book now 40% off at Amazon.com for a short time.

Ted
Posts: 94
Joined: Sat Jun 23, 2007 4:11 pm

Problems with align

Post by Ted »

-Niels wrote:Could the problem be that the equations are too large? I'm lost at this problem, hope someone can help.
It's the presence of the two \emph macros. You can only use \emph in text mode (i.e., not display/math mode).

Note that you should also be using \det instead of det, but that won't give you an error either way.

Also make SURE you have a \usepackage{amsmath} somewhere up top or else you won't be able to use align.
-- Ted [home/blog]
-Niels
Posts: 5
Joined: Thu Jun 19, 2008 2:03 pm

Re: Problems with align

Post by -Niels »

How can i emphasize elements in display math then?
Ted
Posts: 94
Joined: Sat Jun 23, 2007 4:11 pm

Problems with align

Post by Ted »

-Niels wrote:How can i emphasize elements in display math then?
I'm not quite sure why you'd ever want to. Think about exactly what you're doing --- are you sure that the math equivalent of "\emph" is what you really want? (remember that "\emph" in text mode will italicize upright text and upright italicized text)

You can use the mathematical "font" macros:
  • \mathrm (note: most people use \mathrm when they SHOULD be using \operatorname)
  • \mathbf (bold)
  • \boldsymbol (from amsmath)
  • \mathit (italicized)
  • \mathcal (caligraphic, which gets redefined by several packages)
  • \mathfrak (Fraktur --- from amsfonts)
  • \mathbb (blackboard bold)
  • \boxed (puts a box around things (good solution for your case?))
However, you shouldn't use these to "emphasize" text. You should use these to create new symbols. For example, \mathbf{v} might be a vector while v might be a scalar and \mathbb{V} might be a field and \mathcal{V} might be some set. Often you make your own macros (like a \set macro) that call these underneath so that you can change your style later.

[ Note that there is also a \vec macro that, unless redefined, puts a small arrow over top of "vectors". ]

If you want to draw attention to part of your formula, it's better to use things like \underbrace and \overbrace. For example...

Code: Select all

\begin{equation*}
x = A + \overbrace{C + D}^{\text{Some stuff}}\end{equation*}
Because I used \text, you need the AMS packages loaded. You could replace it with \mbox for the more conventional way to do it, but you might not like the font size. Technically, I should probably make sure that the displaystyle treats the overbrace as an ordinary character so that it doesn't screw up the spacing next to the plus, so I might use...

Code: Select all

\begin{equation*}
x = A + \mathord{\overbrace{C + D}^{\text{Some stuff}}}\end{equation*}
There are lots of other ways of drawing attention to parts of your formulas. I recommend only using changes in the shape of characters when you want to define a different KIND.

So try using \boxed in place of your \emph. If you don't like that, consider \underbrace or \overbrace or split things up onto multiple lines or add more space or.... etc. etc.
-- Ted [home/blog]
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

Problems with align

Post by Juanjo »

From a mathematical standpoint, I don't really understand why you write four equations that you can simply express as a single chain of equalities. Try this, which in addition corrects some obvious missprints:

Code: Select all

\documentclass{article}

\usepackage{amsmath}
\usepackage{accents}

\begin{document}

\newcommand{\uuline}[1]{\underaccent{\bar}{\underaccent{\bar}{#1}}}

\begin{equation}
   \begin{split}
      \det(\uuline{A}_3-\lambda\uuline{I})&= (-\lambda)(-1)^{1+1}
        (\lambda^2+b_1\lambda+b_2)+0\cdot(\uuline{A}_{21})+\bigl(-b_3((-1)^{3+1}\cdot1)\bigr) \\
      &=(-\lambda)(\lambda^2+b_1\lambda+b_2)-b_3 \\
      &= -\lambda^3 - b_1\lambda^2 - b_2\lambda - b_3 \\
      &= -(\lambda^3 + b_1\lambda^2 + b_2\lambda + b_3)
   \end{split}
\end{equation}

\end{document}
You can even reduce it a bit more (or you may need to break the first line if the line width is small). Please note the command \uuline, which could be a convenient replacement of your \undeline{\underline{...}} scheme.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
Post Reply