1

I am new to learning how to use Latex and need some help!

I am trying to either left align a number of equations containing matrices or (preferably) align the equal signs in the equations. The equations are similar to the following two examples:

\[^0T_1 = \begin{pmatrix} 1 & & & q_1 \\ & 1 & & \\ & & 1 & \\ & & & 1 \\ \end{pmatrix} q_1: ss\_fff \\\]
\[^0T_2 = \begin{pmatrix} 333 & & & q_3 \\ & 333333 & & \\ & & 3333 & \\ & & & 1 \\ \end{pmatrix} q_2: tt\_bbb \\\]

I tried using \begin{flushleft} to leftalign but it did not work. Then I tried \begin{flalign} and replacing "=" with "&=" but this lead to a number of error messages.

At the moment the PDF output is this (the whole equation is centred):

enter image description here

Ideally I would be able to align the "=" with each other and also the comments next to the matrices (e.g. "q1: rail_carriage"). Thank you for your help in advance!

2 Answers 2

4

Something like this (align* for unnumbered)? Also, you can give a chance to \mathtt{}.

enter image description here

\documentclass{report}
\usepackage{amsmath}

\begin{document}
\begin{align}
^0T_1 &= \begin{pmatrix} 1 & & & q_1 \\ & 1 & & \\ & & 1 & \\ & & & 1 \\ \end{pmatrix} & q_1&\colon \mathrm{ss\_fff} \\
^0T_2 &= \begin{pmatrix} 333 & & & q_3 \\ & 333333 & & \\ & & 3333 & \\ & & & 1 \\ \end{pmatrix} &q_2&\colon \mathrm{tt\_bbb} 
\end{align}
\end{document}
1
  • Yes that works, thank you!
    – Fee
    Commented Jun 24, 2019 at 15:10
2

The alignat environment enables you to control the spacing between the two columns of the environment:

\documentclass{report}
\usepackage{amsmath}

\begin{document}

\begin{alignat}{2}
^0T_1 &= \begin{pmatrix} 1 & & & q_1 \\ & 1 & & \\ & & 1 & \\ & & & 1 \\ \end{pmatrix} & q_1&\colon \mathrm{ss\_fff} \\[2ex]
^0T_2 &= \begin{pmatrix} 333 & & & q_3 \\ & 333333 & & \\ & & 3333 & \\ & & & 1 \\ \end{pmatrix} &\quad q_2&\colon \mathrm{tt\_bbb}
\end{alignat}

\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 .