0

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?

  • multline would give different alignments for different rows but align* would align all rows the same way. But it is the wrong environment if there is no alignment use gather* for multiple equations or multline for one multiple lien ewuation. – David Carlisle Dec 6 '16 at 13:35
  • slope and ref should not be set in math italic. – David Carlisle Dec 6 '16 at 13:36
1

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}
  • Thanks for the \mathrm suggestion too! – Toby Dec 6 '16 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.