# aligning equations in smallmatrix environment

So for example, in the next code I get my equations in center aligment, I'd like to have them aligned to the left.

$(a_{2})_{pq}=\left \{ \begin{smallmatrix} (a_{1})_{pq} ,p\neq i \\ (ca_{1})_{pj}+(a_{1})_{pq},p\neq i \end{smallmatrix}\right.$


Note: I'm using smallmatrix environmet so I can have my definition inline, I mean like being part of the same line.

• smallmatrix is intended for setting matrices, for groups of equations you want something like aligned Feb 13, 2013 at 18:14

You can get the alignment as in cases by adding "fill" glue:

$(a_{2})_{pq}= \left\{ \begin{smallmatrix} (a_{1})_{pq},\hfill&p\neq i\hfill\\ (ca_{1})_{pj}+(a_{1})_{pq},\hfill& p\neq i\hfill \end{smallmatrix}\right.$


However, such constructs are best placed in a display. See the result as a witness.

• This is pretty useful. It might be a good idea for the amsmath guide to mention this.
– MSC
May 9, 2013 at 15:39

I'd say use cases. (You need the amsmath package for this.)

Here an example:

Code

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$(a_{2})_{pq}= \begin{cases} (a_{1})_{pq} & p\neq i \\ (ca_{1})_{pj}+(a_{1})_{pq} & p\neq i \end{cases}$
\end{document}


Result

• The thing is that I'm using smallmatrix environmet so I can have my definition inline, I mean like being part of the same line. If I do this then my definition is not on the same line and it is not as small as it is produced by using smallmatrix environment. Feb 13, 2013 at 18:24
• Well, I guess you could just change $...$ to $...$. Feb 13, 2013 at 18:30
• Yes, Almost, except for the size. Feb 13, 2013 at 18:35