# aligning vector column

I have the next latex code:

\begin{align*}\pi(X)f(x) = \frac{d}{dt}\Pi(e^{tX})\vert_{t=0} f(x) &= \frac{d}{dt} (\Pi(e^{tX})f(x))\vert_{t=0})= \\ &=\frac{d}{dt}(f(e^{-tX}x))\vert_{t=0} & \\ &= \nabla_{\xi} f \lenter code hereeft(-$\left( \begin{array}{ccc} X_{11} & \cdots & X_{1n} \\ \vdots & \cdots & \vdots \\ X_{n1} & \cdots & X_{nn} \end{array} \right)$ \right) $\left( \begin{array}{ccc} \xi_1 \\ \vdots \\ \xi_n \end{array} \right)$ &\\ &= -\sum_{i,j}X_{ij}\xi_j \frac{\partial f}{\partial \xi_i} &\end{align*}


and the attached pic of what is shown:

My problems are:

1. there's a missing right bracket for the matrix with the minus sign symbol, how do I fix this?

2. the \xi's column vector is not placed at the right place it should be to right after the second right bracket which is missing from the output, and not placed above there, how to fix this?

3. the last equality should be aligned with the rest of the equalities i.e the equality should be placed beneath the rest of the equalities and not as it's displayed.

Any ideas as to how to fix this?

-

\begin{align*}
\pi(X)f(x) = \frac{d}{dt}\Pi(e^{tX})\vert_{t=0} f(x) &= \frac{d}{dt}(\Pi(e^{tX})f(x))\vert_{t=0})= \\
&=\frac{d}{dt}(f(e^{-tX}x))\vert_{t=0}\\
&= \nabla_{\xi} f \left(-
\left( \begin{array}{ccc}
X_{11} & \cdots & X_{1n} \\
\vdots & \cdots & \vdots \\
X_{n1} & \cdots & X_{nn}
\end{array} \right)
\left( \begin{array}{c}
\xi_1 \\
\vdots \\
\xi_n
\end{array} \right)
\right)\\
&= -\sum_{i,j}X_{ij}\xi_j \frac{\partial f}{\partial \xi_i}
\end{align*}


-
Instead of array, it is better to use the amsmathenvironment pmatrix (with this you save the use of \left( and \right). Additionally, it is a good practice to keep track of the indentation when writing your code, although the compiler understand it as it is, by indenting the code is more human readable (look a python code for example). –  Dox Aug 22 '13 at 13:09
• $$...$$ for displayed equations should not be used with LaTeX at all.
• Displayed equation environments cannot be nested, your example had nested three kinds of them: $$...$$, \begin{align*}...\end{align*} and $...$. The example below uses environment align* only, because you wants to have aligned equation symbols.
• Package amsmath provides several environments for matrices. In your case, environment pmatrix automatically adds parentheses and simplifies the input.
• The vertical lines can be increased by \left/\right. In the first case it matches the size of the parentheses before. It also uses e-TeX's \middle. In the second case, an invisible left delimiter is needed \left.. It adds a space that is removed by \kern-\nulldelimiterspace.
• At some places I have inserted \, (thin space) to increase the readability.
• In the case of the parentheses around the matrices, I hope I have guessed the location of the outer parentheses correctly.
• \ddots is used in the middle of the larger matrix.

Example file:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{align*}
\pi(X)\,f(x)
& = \frac{d}{dt}\,\Pi(e^{tX})\vert_{t=0}\,f(x)
\\
& =\frac{d}{dt}\left(\Pi(e^{tX})\,f(x)\middle)\right\vert_{t=0}
\\
& =\frac{d}{dt}
\kern-\nulldelimiterspace\left.f(e^{-tX}x)\right\vert_{t=0} & \\
& = \nabla_{\xi} f
\left(-
\begin{pmatrix}
X_{11} & \cdots & X_{1n} \\
\vdots & \ddots & \vdots \\
X_{n1} & \cdots & X_{nn}
\end{pmatrix}
\begin{pmatrix}
\xi_1 \\
\vdots \\
\xi_n
\end{pmatrix}
\right)
\\
& = -\sum_{i,j}X_{ij}\xi_j \frac{\partial f}{\partial \xi_i}
\end{align*}

\end{document}


-
I must say that this alignment looks more aesthetically pleasing than the one suggested by the questioner. Furthermore, I like the way you have arranged the code. –  Svend Tveskæg Aug 22 '13 at 9:13

Let's start from the equation environment. First we have

Why is $...$ preferable to $$...$$?

Then align and the starred version switch to mathmode themselves so it's not correct to put them in $...$ pair. Also array environment takes the mandatory position arguments {ccc}. The number of c defines the number of columns. Whenyou have a vector you need only one.

Finally, as given in the link above \[ means something else hence the square brackets don't need a backslash. In fact you don't need them here anyway.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{align*}
\pi(X)f(x) = \frac{d}{dt}\Pi(e^{tX})\vert_{t=0} f(x) &= \frac{d}{dt}(\Pi(e^{tX})f(x))\vert_{t=0}) \\
&= \frac{d}{dt}(f(e^{-tX}x))\vert_{t=0} \\
&= \nabla_{\xi} f \left(-\left(
\begin{array}{ccc}
X_{11} & \cdots & X_{1n} \\
\vdots & \ddots & \vdots \\
X_{n1} & \cdots & X_{nn}
\end{array}
\right)
\right)
\left( \begin{array}{c}
\xi_1\\
\vdots\\
\xi_n
\end{array}
\right) \\
&= -\sum_{i,j}X_{ij}\xi_j \frac{\partial f}{\partial \xi_i}
\end{align*}

\end{document}


-