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?

10
  • 3
    Note that pure mathjax questions are off topic but you can probably formulate that as a latex question Commented Jan 24, 2024 at 14:24
  • 4
    align is a top level display element you can not use it inside anything else perhaps you meant to use aligned Commented Jan 24, 2024 at 14:25
  • 1
    It would be better to completely remove the reference to mathjax and just focus on the LaTeX aspect of your question. Commented Jan 24, 2024 at 14:42
  • 3
    And your ` ×` does not map to anything usable Commented Jan 24, 2024 at 14:45
  • 4
    Does this answer your question? Using \left( & \right) around amsmath's align delimiter ("&"). Either use fixed size brackets, or placing the & outside the first \left will give essentially the same result. Commented Jan 24, 2024 at 14:46

2 Answers 2

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} $$ 
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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.