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.

Consider the following document:

\documentclass{article}
\usepackage{amsmath}
\newcommand{\expr}[1]{\begin{pmatrix}x_#1\\y_#1\end{pmatrix}}
\begin{document}
\begin{equation}
  c = a \cdot b
\end{equation}
\begin{align*}
  a&=\expr{a} & b&=\expr{b}
\end{align*}
\end{document}

which displays like this:

equation + align* environments

I.e. the first (part of the) equation is centered, the second part is set in two columns with a third of the free space located before, in between and after.

I would like to have the same setup, but with the equation(s) in one environment.

I have tried several combinations of multi-equation environments in amsmath, but without luck. For instance:

\begin{align}
  \begin{aligned}
    c = a \cdot b
  \end{aligned} \\
  \nonumber
  \begin{aligned}a&=\expr{a}\end{aligned} & & \begin{aligned}b&=\expr{b}\end{aligned}
\end{align}

displays like this:

align environment

with the two "sub-equations" being fine, but the main equation at the top is not centered. The following:

\begin{gather}
  c = a \cdot b \\
  \begin{aligned}
    \nonumber
    a&=\expr{a} & b&=\expr{b}
  \end{aligned}
\end{gather}

results in the two "sub-equations" being set too tight:

gather environment

share|improve this question
2  
I think this is another case where I would recommend using a combination of \phantom and/or \makebox. References: How to align across ordinary text; as in breaking matrices, sets of equations, tables, Sharing alignment between equations in two different items, Aligning different parts of an equation with certain spots in the line above. There probably are many other similar postings on this site. –  Peter Grill Mar 26 '12 at 21:37
    
You mention in a comment that the actual expressions are much larger; could you show them? The reason I ask is that I see no advantage in having alignments (a&=..., b&=) unless there is going to be more rows below those lines. –  morbusg Mar 27 '12 at 9:47
    
@morbusg: The ampersands are to get both a and b right-aligned to the equal sign (and their expressions to be left-aligned to the equal sign). –  RolKau Mar 29 '12 at 9:20
    
RolKau: yeah I know, let me rephrase; $$\displaylines{c = a \cdot b \cr a = \pmatrix{x_a\cr y_a} \hfil b = \pmatrix{x_b\cr y_b} \cr}$$\bye (that is in plain-tex, so compile with pdftex/xetex/luatex) So my point is, that unless you have something below, you won't gain anything by having an alignment. –  morbusg Mar 29 '12 at 9:33
add comment

2 Answers

How about

enter image description here

\documentclass{article}
\usepackage{amsmath}
\newcommand{\expr}[1]{\begin{pmatrix}x_#1\\y_#1\end{pmatrix}}

\begin{document}

\begin{align}
        &           &   c   &= a \cdot b\\
    a   &=\expr{a}  &       &           & b &=\expr{b}\nonumber
\end{align}

\end{document}
share|improve this answer
    
Problem is: This is not the equation to which I plan to apply it. The right-hand sides are much larger expressions so there'll have to be some overlap between the first and the second (sub-)equation. –  RolKau Mar 27 '12 at 7:50
    
Could you explain the reason for wanting all in one environment? –  Stephan Lehmke Mar 27 '12 at 8:08
    
Proximity to the original equation; same reason as for using gather instead of multiple equations. –  RolKau Apr 13 '12 at 8:25
add comment
up vote 1 down vote accepted

It turns out this is allowed:

\begin{gather}
  \begin{align}
    c = a \cdot b
  \end{align} \\
  \begin{align*}
    a&=\expr{a} & b&=\expr{b} &
  \end{align*}
\end{gather}

resulting in:

gather+align

share|improve this answer
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.