Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

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}
share|improve this answer
    
Thanks. This does the trick. I didn't realise I could nest the amsmath environments like that. –  leo Aug 14 '12 at 13:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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