2

I want to align three elements inside a pmatrix around a character that is inside a \left( ... \right) construction. Comments here have told me that the & alignment character does not work inside such a construction, which is why I get an error message reading "Misplaced &" when I attempt it.

Here's what I'm typesetting:

$$
Q_F = \begin{pmatrix}\begin{aligned}
 (1 + a) × \left(\frac{\sqrt{1}}{2} × &f(u, v) × \left(\frac{h(u)}{g(u)} - \frac{h(u)}{g(u)}\right)\right), \\
 (1 + a) × \left(\frac{\sqrt{3}}{2} × &f(u, v) × \left(\frac{h(u)}{g(u)} + \frac{h(u)}{g(u)}\right) - \frac{2 \sqrt{3} + \sqrt{6}}{6}\right), \\
-(1 + a) × \left(\frac{\sqrt{3}}{2} × &f(u, v) × \left(\frac{h(u)}{g(u)} × \frac{h(u)}{g(u)}\right) - \frac{2 \sqrt{3} - \sqrt{6}}{6} - 1\right)
\end{aligned}\end{pmatrix}
$$

And here's what I want it to look like, approximated by adding a bunch of \; space characters: Image of aligned expression

Is there a better way to line up the elements on the "f(u, v)" text instead of throwing in a bunch of extra space characters to force the issue?

Lawton
  • 123

2 Answers2

4

There are several issues here

  • align cannot be used inside display math like this (was in an earlier version of the question)
  • use aligned instead
  • you cannot use \left( ... & ... \right) that hides the & from the macros that looks for it. Move it up before (1+a)
  • You might get into problems with systems not understanding × in the input. I've replaced it with \times.

This works just fine in LaTeX (with amsmath loaded) and in mathjax with the proper setup:

$$
Q_F = \begin{pmatrix}\begin{aligned}
 &(1 + a) \times  \left(\frac{\sqrt{1}}{2} \times f(u, v) \times \left(\frac{h(u)}{g(u)} - \frac{h(u)}{g(u)}\right)\right), \\
 &(1 + a) \times  \left(\frac{\sqrt{3}}{2} \times f(u, v) \times \left(\frac{h(u)}{g(u)} + \frac{h(u)}{g(u)}\right) - \frac{2 \sqrt{3} + \sqrt{6}}{6}\right), \\
-&(1 + a) \times  \left(\frac{\sqrt{3}}{2} \times  f(u, v) \times \left(\frac{h(u)}{g(u)} \times \frac{h(u)}{g(u)}\right) - \frac{2 \sqrt{3} - \sqrt{6}}{6} - 1\right)
\end{aligned}\end{pmatrix}
$$
daleif
  • 54,450
0

Based on the specific material, you can take as alignment point the \times symbol.

However, without \times seems better.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation} Q_F = \begin{pmatrix} \begin{aligned} (1 + a) &\times \left(\frac{\sqrt{1}}{2} \times f(u, v) \times \left(\frac{h(u)}{g(u)} - \frac{h(u)}{g(u)}\right)\right), \ (1 + a) &\times \left(\frac{\sqrt{3}}{2} \times f(u, v) \times \left(\frac{h(u)}{g(u)} + \frac{h(u)}{g(u)}\right) - \frac{2 \sqrt{3} + \sqrt{6}}{6}\right), \ -(1 + a) &\times \left(\frac{\sqrt{3}}{2} \times f(u, v) \times \left(\frac{h(u)}{g(u)} \times \frac{h(u)}{g(u)}\right) - \frac{2 \sqrt{3} - \sqrt{6}}{6} - 1\right) \end{aligned} \end{pmatrix} \end{equation}

\begin{equation} Q_F = \begin{pmatrix} \begin{aligned} (1 + a) & \biggl(\frac{\sqrt{1}}{2} f(u, v) \left(\frac{h(u)}{g(u)} - \frac{h(u)}{g(u)}\right)\biggr), \[\jot] (1 + a) & \biggl(\frac{\sqrt{3}}{2} f(u, v) \left(\frac{h(u)}{g(u)} + \frac{h(u)}{g(u)}\right) - \frac{2 \sqrt{3} + \sqrt{6}}{6}\biggr), \[\jot] -(1 + a) & \biggl(\frac{\sqrt{3}}{2} f(u, v) \left(\frac{h(u)}{g(u)} \frac{h(u)}{g(u)}\right) - \frac{2 \sqrt{3} - \sqrt{6}}{6} - 1\biggr) \end{aligned} \end{pmatrix} \end{equation}

\end{document}

enter image description here

egreg
  • 1,121,712