[Tex/LaTex] Horizontal center vertically aligned equations

alignamsmathhorizontal alignmentvertical alignment

I am using Doxygen to build some C source code documentation. I have the following:

@f{align*}
 R_n = R_{n - 1} \pm \left[(slope \times T) \times \frac{1}{ref}\right], \\
     \forall R \in [0,1)
@f}

Where @f{align*} is equivalent to selecting an environment in the manner of \begin{align*} (and @f} marks the end of the environment).

Or more technically, the Doxygen documentation says:

\f{environment}{

Marks the start of a formula that is in a specific environment.

This is used because I would like the "∀R ∈ [0, 1)" to be on a second line, instead of being on the same line as, and immediately after, the formula itself.

The above LaTeX achieves this but how can I maintain centre alignment in the horizontal instead of aligning to some fixed point with &? Without the & it defaults to: first line align left, last line align right.

Or should I use a different method of vertical alignment to achieve this?

Best Answer

enter image description here

I suspect you want gather

\documentclass{article}

\setlength\parindent{0pt}
\usepackage{amsmath}

\begin{document}


align*\dotfill X
\begin{align*}
 R_n = R_{n - 1} \pm \left[(\mathrm{slope} \times T) \times \frac{1}{\mathrm{ref}}\right], \\
     \forall R \in [0,1)
\end{align*}

align* with \&\dotfill X
\begin{align*}
 R_n &= R_{n - 1} \pm \left[(\mathrm{slope} \times T) \times \frac{1}{\mathrm{ref}}\right], \\
     &\forall R \in [0,1)
\end{align*}

gather*\dotfill X
\begin{gather*}
 R_n = R_{n - 1} \pm \left[(\mathrm{slope} \times T) \times \frac{1}{\mathrm{ref}}\right], \\
     \forall R \in [0,1)
\end{gather*}

multline*\dotfill X
\begin{multline*}
 R_n = R_{n - 1} \pm \left[(\mathrm{slope} \times T) \times \frac{1}{\mathrm{ref}}\right], \\
     \forall R \in [0,1)
\end{multline*}

[ and split\dotfill X
\[\begin{split}
 R_n = R_{n - 1} \pm \left[(\mathrm{slope} \times T) \times \frac{1}{\mathrm{ref}}\right], \\
     \forall R \in [0,1)
\end{split}\]

\end{document}