7

I often need align environments where the first line is centered, e.g., when first introducing the types of the functions to be defined, then defining them.

I essentially want to obtain the effect that \multicolumn{2}{c} has in a table, but in an align environment.

The below solution is as far as I got, but the first line is then not centered. I could put them into separate environments, but this would mess with spacing in a way that I would like to avoid.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{align*}
\omit \rlap{$f: A \to B, g: B \to C$}\\
f(a) &= \ldots \\
g(b) &= \ldots 
\end{align*}

\end{document}

Any insight is appreciated. I don't really need the full power of a multicolumn command, but I want to be able to insert centered lines in an align environment.

1 Answer 1

9

You can't use \multicolumn in align; I suggest to use a combination of gather and aligned:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{gather*}
f: A \to B, g: B \to C\\
\begin{aligned}
f(a) &= \ldots \\
g(b) &= \ldots 
\end{aligned}
\end{gather*}

\end{document}
1
  • Thanks. This does the trick. I didn't realise I could nest the amsmath environments like that.
    – leo
    Aug 14, 2012 at 13:40

You must log in to answer this question.

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