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 have try some code like this:

\begin{align*}
Q(R)&=\bi(R,R)\\
    &=\bi(R_I+R_{\Rico}+R_W,R_I+R_{\Rico}+R_W)\\
    &=\bi(R_I,R_I)+2\bi(R_I,R_{\Rico})+2\bi(R_I,R_W)\\
    &+\bi(R_{\Rico},R_{\Rico})+2\bi(R_{\Rico},R_w)\\
    &+\bi(R_W,R_W).
\end{align*}

where

\newcommand{\Rico}{\Ric_o}
\newcommand{\bi}{\mathrm{bi}\,}

The problem is I would like to set the last three lines aligned right, did there has any solutions instead to type several \quad or \qquad?

share|improve this question
    
maybe \hspace will be a solution. –  user19832 Dec 3 '12 at 14:34
add comment

2 Answers 2

up vote 3 down vote accepted

I would place the last three equations in an extra aligned environment as follows:

\documentclass{article}

\usepackage{mathtools}

\DeclareMathOperator{\Ric}{Ric}
\newcommand{\Rico}{\Ric_o}
\DeclareMathOperator{\bi}{bi}

\begin{document}
\begin{align*}
  Q(R) ={}&\bi(R,R)\\
  ={}&\bi(R_I+R_{\Rico}+R_W,R_I+R_{\Rico}+R_W)\\
  ={}&\begin{aligned}[t]
    \bi(R_I,R_I)+2\bi(R_I,R_{\Rico})+2\bi(R_I,R_W)&\\
    +\bi(R_{\Rico},R_{\Rico})+2\bi(R_{\Rico},R_w)&\\
    +\bi(R_W,R_W)&.
  \end{aligned}
\end{align*}
\end{document}

Sample output

Noticed the changed placement of the alignment charecter in relation to the equals signs and the consequent use of extra braces as ={}& to ensure correct spacing. I have also defined your missing commands with \DeclareMathOperator. I chose to load mathtools instead of amsmath, but that is just personal preference; it loads amsmath anyway.

share|improve this answer
    
Personally, I would write &= as I write always. And then use \! before the \begin{aligned}.... Shorter in my opinion (may be not truly aligned, but it looks well). –  Manuel Dec 3 '12 at 18:20
    
@Manuel That is what I usually do too, but in this case the misalignment seemed too much. I'll really have to understand one day what is going there. –  Andrew Swann Dec 3 '12 at 18:40
    
I have just ignored the usage of [t] in my trying. By the way, I think {}& just give the right (balance) spacing of =, is it right? –  user19832 Dec 17 '12 at 8:06
    
@user19832 The [t] or [b] option is very useful for fixing the vertical alignment. The documentation for the mathtools package uses ={}& almost everywhere in alignments. To my eyes (which often deceive me) it gives very tiny extra space in comparison with &=, but I haven't made any concrete measurements. –  Andrew Swann Dec 17 '12 at 9:48
add comment

Here's a couple of options- you didn't tell us what the \Ric command is- please always post a complete MWE :)

screenshot

I would also use

\newcommand{\bi}{\operatorname{bi}}

for your \bi command, assuming I have interpreted it correctly.

\documentclass{article}
\usepackage{amsmath}
\newcommand{\Rico}{Ric_o}
%\newcommand{\bi}{\mathrm{bi}\,}
\newcommand{\bi}{\operatorname{bi}}

\begin{document}

\begin{align*}
Q(R)&=\bi(R,R)\\
    &=\bi(R_I+R_{\Rico}+R_W,R_I+R_{\Rico}+R_W)\\
    &=\bi(R_I,R_I)+2\bi(R_I,R_{\Rico})+2\bi(R_I,R_W)\\
    &\phantom{{}=}+\bi(R_{\Rico},R_{\Rico})+2\bi(R_{\Rico},R_w)\\
    &\phantom{{}=}+\bi(R_W,R_W).
\end{align*}

\begin{align*}
Q(R)&=\bi(R,R)\\
    &=\bi(R_I+R_{\Rico}+R_W,R_I+R_{\Rico}+R_W)\\
    &=\bi(R_I,R_I)+2\bi(R_I,R_{\Rico})+2\bi(R_I,R_W)\\
    &&&+\bi(R_{\Rico},R_{\Rico})+2\bi(R_{\Rico},R_w)\\
    &&&+\bi(R_W,R_W).
\end{align*}

\end{document}
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.