47

I have a document I am trying to copy to learn TeX. Here is what I have encountered:alt text How can I have the "or" in the equation. This is what I have right now:

\[ f = ma; \] 
But $a$ is the change in velocity,

\[ f = m \frac{dv}{dt};\]
\[ f = m  \frac{d^2y}{dt^2};\]

Edit: Trying out Stefan's answer alt text

1

1 Answer 1

67

Use the amsmath package and the commands \text{...} for text in the formula or \intertext{...} for text between the lines of multi-line formulas. For example:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
  f &= ma;\\ \intertext{But $a$ is the change in velocity} 
  f &= m \frac{dv}{dt};\\ \intertext{or} 
  f &= m  \frac{d^2y}{dt^2};
\end{align*}
\end{document}

One advantage of align* to \[ ... \] is that you can align the equations on relation symbols.

If you wish to put or in the same line, you could use \text and flalign* :

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{flalign*}
  && f &= ma;&\\ \text{or} && f &= m \frac{dv}{dt};&\\ \text{or}  &&f &= m  \frac{d^2y}{dt^2};
\end{flalign*}
\end{document}

flalign example

2
  • 9
    & is used both for specifying the alignment position and as column separator, alternating. In columns of formulas, &= means that at = would be aligned, a following & would end the column, like in a table. && has been used to skip a column, i.e. to create an empty column.
    – Stefan Kottwitz
    Aug 13, 2010 at 16:53
  • 1
    \intertext{} is simple to use! I found the linespacing too big and had to tweak it with \\[-3ex], but far easier than fiddling with multiple ampersands.
    – PatrickT
    Jun 7, 2022 at 4:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .