0

I have read posts describing how to align equations vertically and horizontally. Unfortunately it does not work. Does anyone know how to fix the following code?

\begin{equation}
\begin{aligned}
  w_1 &= u_1,
&
 v1 = w1 / \left\lVert w_1\right\rVert
\\
  w_2 &= u_2 - \langle u_2, v_1\rangle v_1, 
&
  v_2 = w2 / \left\lVert w_2\right\rVert
\\\\
  w_p = u_p - \sum_{i=1}^{p-1} \langle u_p, v_i\rangle v_i, 
&
  v_p &= w_p / \left\lVert w_p\right\rVert
\end{aligned}
\end{equation}

Additionally, I would like to add a vertically dotted line between the equations:

w2 = u2 - ... and wp = up - ...

and

v2 = w2/... and vp = wp/...

2 Answers 2

4

You simply forgot that two alignment points per line require 3 &. Here is a solution using the \vdotswithin command, from mathtools, to align the vertical dots with the = signs, and some vertical adjustment:

\documentclass{article}

\usepackage{mathtools}
\DeclarePairedDelimiter{\norm} \lVert \rVert
\DeclarePairedDelimiter{\innerp} \langle \rangle

    \begin{document}

   \begin{equation}
\begin{aligned}
  w_1 &= u_1,
&
 v_1 & = w1 / \norm*{w_1}
\\
  w_2 &= u_2 - \innerp{u_2, v_1} v_1,
&
  v_2 & = w_2 / \norm{w_2}
\\[-0.5ex]
 & \vdotswithin{=} & & \vdotswithin{=} \\
  w_p & = u_p - \smash[t]{\sum_{i=1}^{p-1}}\innerp*{u_p, v_i}v_i
& v_p &= w_p / \norm{w_p}
\end{aligned}
\end{equation}

\end{document} 

enter image description here

0

Something like this?

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
  w_1 & = u_1,
&
 v_1 & = w_1 / \lVert w_1 \rVert
\\
  w_2 & = u_2 - \langle u_2, v_1\rangle v_1, 
&
  v_2 & = w_2 / \lVert w_2 \rVert
\\ & \vdots && \vdots \\
  w_p & = u_p - \sum_{i=1}^{p-1} \langle u_p, v_i\rangle v_i, 
&
  v_p & = w_p / \lVert w_p \rVert
\end{align*}
\end{document}

Also, it's not related with your specific question, but the \left and \right commands used here are useless, since the vertical bars from \lVert and \rVert do not have to get any bigger to fit their content.

You must log in to answer this question.

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