4

Say I have a basis u, v, w and a triangular matrix M. I want to write the action of M on these vectors in the form Mu = au + bv + cw etc. I would like to align the equals signs and the basis vectors. My best guess so far is

\begin{align}
Mu &= & & a &w\\
Mv &= & b &v + c &w\\
Mu &= d &u + e &v + f &w
\end{align}

However, I don't know how to get the coefficients to stay attached to the basis vector they belong with instead of getting aligned with the previous part. This approach is also just generally messy. What am I doing wrong? Is there a better approach, say using the matrix environment for alignment?

My desired output is:

Mu =           aw
Mv =      bv + cw
Mw = du + ev + fw

But note that the actual coefficients are more complex expressions than just a,b,c,d,e,f.

EDIT: To clarify, I don't want to change the order of the equations or the basis. So the first line needs the RHS right aligned.

2
  • welcome to TeX.SE! should this be matrix equation?(vector Mu, Mv, Mu) = matrix)? than the borders of matrix is missing. if this is set of equation, than many operators + or - is missing. please, clarify.
    – Zarko
    Apr 2, 2017 at 14:08
  • Essentially it's a matrix equation, but I would like to typeset it 3 separate equations (one per basis vector) as shown above, rather than as matrix * column vector = column vector.
    – Alex
    Apr 2, 2017 at 14:14

3 Answers 3

6

This is what alignat is for:

\documentclass{article}
\pagestyle{empty}
\usepackage{amsmath}
\begin{document}
\begin{alignat}{4}
Mu &=    & &    & & a w\\
Mv &=    & & bv &{}+{}& c w\\
Mu &= du &{}+{}& ev &{}+{}& f w
\end{alignat}
\end{document}

enter image description here

(Corrected per @barbarabeeton advice)

5
  • Thanks, this is what I was looking for. Any way to fix the alignment of the a?
    – Alex
    Apr 2, 2017 at 14:20
  • please see edited - I fixed the columns
    – Boris
    Apr 2, 2017 at 14:32
  • shouldn't there be a bit more space around the plus signs, as in {}+{}? Apr 2, 2017 at 15:15
  • @barbarabeeton you are right. What is the AMS' recommended way to use binary operators with alignat? {}+{} is a liittle bit hackish, is not it?
    – Boris
    Apr 2, 2017 at 16:04
  • that's the only way i really know; i've asked david c and egreg to correct me if i'm wrong. Apr 2, 2017 at 16:14
4

A better alignment and spacings with alignat and 3 columns.

I also mention another solution, simpler to code, with the systeme package, but the counter is different from the equation counter, the numbers are not aligned on the right margin and the l.h.s. and r.h.s. have to be swapped.

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{amsmath}

\usepackage{systeme}

\begin{document}

\begin{alignat}{3}
  Mu & = & & & & aw \\
  Mv & = & & b v & {}+{} & cw \\
  Mu & = d u & {}+{} & ev & {}+{} & f w
\end{alignat}

\[ \sysautonum{(**)}\sysdelim.. \systeme[uvw]{aw = Mu, bv + cw = Mv, du + ev + fw = Mu} \]

\end{document} 

enter image description here

2

If you don't need to number each line, you can use autoaligne:

\documentclass{article}
\usepackage{autoaligne}

\begin{document}

\[
\catcode` =9 % don't bother with spaces
\aavcoeff{1.2}
\autoaligne[gd]{
  Mu=  +  +aw \\
  Mv=  +bv+cw \\
  Mw=du+ev+fw
}
\]

\[
\catcode` =9 % don't bother with spaces
\aavcoeff{1.2}
\autoaligne[gd]{
  Mu=  +  +{(a_1+a_2)}w \\
  Mv=  +b^2tv+cw \\
  Mw=du+ev+{(f-k)}w
}
\]

\end{document}

enter image description here

You must log in to answer this question.

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