# Aligning mathematical equations throughout paper

I am wondering how I can get vertical alignment of the equations spread out over multiple align-environments:

\begin{align*}
\mathbf{y}_{t} &= \mathbf{A'} \cdot \mathbf{x}_{t} + \mathbf{H'} \cdot \boldsymbol{\xi}_{t} + \textbf{v}_{t},\\
\boldsymbol{\xi}_{t} &= \mathbf{F} \cdot \boldsymbol{\xi}_{t-1} + \varepsilon_{t},
\end{align*}

Here, $\mathbf{y}_{t}$ is a vector of observed contemporaneous variables; $\mathbf{x}_{t}$ is a vector of observed exogenous and lagged exogenous variables, and  $\boldsymbol{\xi}_{t}$ is the vector of unobserved states. The vectors of stochastic disturbances are assumed to be Gaussian and mutually uncorrelated, with mean zero and covariance matrices $\mathbf{R}$ and $\mathbf{Q}$, respectively:

\begin{align*}
\mathbf{v}_{t} & \sim \mathcal{N}(0, \mathbf{R})\\
\boldsymbol{\varepsilon}_{t} & \sim \mathcal{N}(0, \mathbf{Q})
\end{align*}

The first-stage model is represented by the following matrices:

\begin{align*}
\mathbf{y}_{t} &=   \begin{bmatrix}
y_{t} & \pi_{t}
\end{bmatrix}\\
\mathbf{x}_{t} &=   \begin{bmatrix}
y_{t-1} & y_{t-2} & \pi_{t-1} \pi_{t-2,4}
\end{bmatrix}\\
\boldsymbol{\xi}_{t} &=     \begin{bmatrix}
y^{*}_{t} & y^{*}_{t-1} & y^{*}_{t-2}
\end{bmatrix}\\
\end{align*}


To clarify, the equations, from a vertical point of view, the equations do not start at the same point in the page: they are centered on the page according to their length. I would like all equations to have the same starting point on the page, such that they 'vertically align'.

Furthermore, how does one impose a matrix transpose in the bmatrix environment?

Thanks!

• You don't really want to align all equations throughout a paper, do you? – Bernard Jun 3 '18 at 10:56
• @Bernard just per section would be great. – Sean Jun 3 '18 at 10:58
• Also, please only ask one question per post. What do you mean by "matrix transpose in the bmatrix environment" ? – BambOo Jun 3 '18 at 10:59
• If you know the widest left and right side expressions, you can make all the equations think they are the same width by using \phantom, \mathrlap and \mathllap (mathtools). Or \settowidth and \makebox. – John Kormylo Jun 3 '18 at 11:43
• Off-topic: In the expression for \mathbf{x}_t, is an & symbol missing between \pi_{t-1} and \pi_{t-2,4}? – Mico Jun 3 '18 at 11:58

You can use a single align environment and the \intertext command for the text between groups of alignments, but it's designed for short sentences, so, in case a \intertext happens at the bottom of a page, it may go to the next page, leaving an unwanted blank space at the bottom of the page.

I don't think this is a good idea – one aligns only equations which are tightly linked: what would be the meaning of aligning, say, the formula for the discriminant of a quadratic equation and a trigonometric identity? Equations are not a marching troop.

Anyway, for what it's worth, here is a code:

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

\begin{document}

\begin{align*}
\mathbf{y}_{t} &= \mathbf{A'}\mathbf{x}_{t} + \mathbf{H'}\boldsymbol{\xi}_{t} + \textbf{v}_{t},\\
\boldsymbol{\xi}_{t} &= \mathbf{F}\boldsymbol{\xi}_{t-1} + \varepsilon_{t},
\intertext{Here, $\mathbf{y}_{t}$ is a vector of observed contemporaneous variables; $\mathbf{x}_{t}$ is a vector of observed exogenous and lagged exogenous variables, and $\boldsymbol{\xi}_{t}$ is the vector of unobserved states. The vectors of stochastic disturbances are assumed to be Gaussian and mutually uncorrelated, with mean zero and covariance matrices $\mathbf{R}$ and $\mathbf{Q}$, respectively:}
\mathbf{v}_{t} & \sim \mathcal{N}(0, \mathbf{R})\\
\boldsymbol{\varepsilon}_{t} & \sim \mathcal{N}(0, \mathbf{Q})
\intertext{The first-stage model is represented by the following matrices:}
\mathbf{y}_{t} &= \begin{bmatrix}
y_{t} & \pi_{t}
\end{bmatrix}\\
\mathbf{x}_{t} &= \begin{bmatrix}
y_{t-1} & y_{t-2} & \pi_{t-1} \pi_{t-2,4}
\end{bmatrix}\\
\boldsymbol{\xi}_{t} &= \begin{bmatrix}
y^{*}_{t} & y^{*}_{t-1} & y^{*}_{t-2}
\end{bmatrix}\\
\end{align*}

\end{document} • Aside: I would also recommend dropping the \cdot directives -- they're neither required nor particularly helpful. – Mico Jun 3 '18 at 11:58
• @Mico: I didn't focus on this aspect of the problem, but you're right. I've changed the code. – Bernard Jun 3 '18 at 12:04
• @Bernard this is great! thanks. But you suggest that I watch out with using \intertext close to the end of the page? – Sean Jun 3 '18 at 12:13
• Unless you're OK with possibly large blank spaces at the bottom of pages… – Bernard Jun 3 '18 at 12:15
• @Bernard It appears that my file does not respond to \intertext, I do have the mathtools package though – Sean Jun 3 '18 at 12:20

If you want every equation environment to be left aligned, you can add the option fleqn when loading the amsmath package

\usepackage[fleqn]{amsmath}


or use flalign or flalign* environments instead if you only want this locally.

\documentclass[10pt]{article}
\usepackage[fleqn]{amsmath}

\begin{document}
\makeatletter \@mathmargin=10pt\makeatother % to set flalign margin to 10 pt
\begin{flalign}
1+2=3
\end{flalign}
\end{document}

• I took a look, but I would prefer the equations still to be centered and vertically aligned within a section. fleqn aligns everything to the left. Thanks! – Sean Jun 3 '18 at 10:59
• if the fleqn option is set, it should be possible to set the left margin for math with the following: \makeatletter \@mathmargin=<amount of indent> \makeatother. this muxt be done after \begin{document}. (not tested.) – barbara beeton Jun 3 '18 at 18:39
• @barbarabeeton I just tested your solution and it works ! Big thanks for the advice – BambOo Jun 3 '18 at 19:58