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 an equation environment where most equation lines start with an arrow, which I have aligned in the align* environment, using &. The second line in the example below is too long for the page and so I have split over two lines. Here I would like to align the start of the equations with each other rather than with the start of the arrows. I have tried using multiple & signs (and also experimented with the alignat* environment) but I cannot find a solution to this. A MWE is below.

\documentclass{article}
\usepackage{mathtools}
\usepackage{amsmath,bm}
\usepackage{amstext}

\begin{document}
\begin{align*}
&\xrightarrow{\frac{\pi}{2} \hat{I}_{\frac{\pi}{4}}} -\cos (\Omega_S t_1) \sin ^2 (\pi J_{IS} \tau) \cos (\Omega_I t_2) \cos (\frac{\pi}{4}) \hat{I}_z \\
&\xrightarrow{\frac{\pi}{2} \hat{S}_x } & - \frac{1}{\sqrt{2}} \cos (\Omega_{S_1} t_1) \sin ^2 (\pi J_{IS} \tau) \cos (\Omega_{I_1} t_2) (1-R_z \tau_{mix}) \hat{I}_z\\ 
& {} & -\frac{1}{\sqrt{2}} \cos (\Omega_{S_1} t_1) \sin ^2 (\pi J_{IS} \tau) \cos (\Omega_{I_2} t_2) (\sigma_{12} \tau_{mix}) \hat{I}_z\\
&\xrightarrow{\frac{\pi}{2} \hat{I}_x} \frac{1}{\sqrt{2}} \cos (\Omega_S t_1) \sin ^2 (\pi J_{IS} \tau) \cos (\Omega _I t_2) \hat{I}_y \\
&A = \frac{1}{\sqrt{2}} \cos (\Omega_S t_1) \sin ^2 (\pi J_{IS} \tau)  \cos (\Omega _I t_2)\\
\end{align*}
\end{document}

where I would like to achieve the following effect:

--> equation...

--> equation....

.......equation continued (aligned with start of equation on previous line- I'm using dots here to avoid this line being converted into an equation)

A=equation (start of this line aligned with arrows above)

--> equation..

etc.

At the moment, the equations in lines 2 and 3 of the align environment of the MWE get shifted to the right, to the end of all the equations and hence disappear off the page.

share|improve this question
add comment

3 Answers

You have to use an inner environment:

\documentclass{article}
\usepackage{mathtools}
\usepackage{amsmath,bm}

\begin{document}
\begin{align*}
&\xrightarrow{\frac{\pi}{2} \hat{I}_{\frac{\pi}{4}}} -\cos (\Omega_S
t_1) \sin ^2 (\pi J_{IS} \tau) \cos (\Omega_I t_2) \cos
(\frac{\pi}{4}) \hat{I}_z
\\
&\xrightarrow{\frac{\pi}{2} \hat{S}_x }
\!
\begin{aligned}[t]
& - \frac{1}{\sqrt{2}} \cos (\Omega_{S_1} t_1) \sin ^2 (\pi
J_{IS} \tau) \cos (\Omega_{I_1} t_2) (1-R_z \tau_{mix}) \hat{I}_z
\\
& -\frac{1}{\sqrt{2}} \cos (\Omega_{S_1} t_1) \sin ^2 (\pi
J_{IS} \tau) \cos (\Omega_{I_2} t_2) (\sigma_{12} \tau_{mix})
\hat{I}_z
\end{aligned}
\\
&\xrightarrow{\frac{\pi}{2} \hat{I}_x} \frac{1}{\sqrt{2}} \cos
(\Omega_S t_1) \sin ^2 (\pi J_{IS} \tau) \cos (\Omega _I t_2)
\hat{I}_y
\\
&A = \frac{1}{\sqrt{2}} \cos (\Omega_S t_1) \sin ^2 (\pi J_{IS}
\tau) \cos (\Omega _I t_2)
\\
\end{align*}
\end{document}

(amstext is autoloaded by amsmath, so I removed it)

share|improve this answer
    
There seems to be no distinction, in the inner align* structure, between the unary nature of the minus sign that starts the first line and the binary nature of the minus sign that starts the second line. Is that intentional? –  Mico Mar 18 '13 at 15:14
    
@Mico ask the AMS. Semantically you're right the first one should not be a relation minus, but to me it just looks odd when you stack them on top of each other and they don't have the same spacing. –  daleif Mar 18 '13 at 15:48
add comment

You get your strange layout because you use a different number of alignment characters (&) in your lines.

I moved the alignment characters around a bit:

\documentclass{article}
\usepackage{mathtools}
\usepackage{amsmath,bm}
\usepackage{amstext}

\begin{document}
\begin{align*}
\xrightarrow{\frac{\pi}{2} \hat{I}_{\frac{\pi}{4}}} & -\cos (\Omega_S t_1) \sin ^2 (\pi J_{IS} \tau) \cos (\Omega_I t_2) \cos (\frac{\pi}{4}) \hat{I}_z \\
\xrightarrow{\frac{\pi}{2} \hat{S}_x } & - \frac{1}{\sqrt{2}} \cos (\Omega_{S_1} t_1) \sin ^2 (\pi J_{IS} \tau) \cos (\Omega_{I_1} t_2) (1-R_z \tau_{mix}) \hat{I}_z\\
& -\frac{1}{\sqrt{2}} \cos (\Omega_{S_1} t_1) \sin ^2 (\pi J_{IS} \tau) \cos (\Omega_{I_2} t_2) (\sigma_{12} \tau_{mix}) \hat{I}_z\\
\xrightarrow{\frac{\pi}{2} \hat{I}_x} & \frac{1}{\sqrt{2}} \cos (\Omega_S t_1) \sin ^2 (\pi J_{IS} \tau) \cos (\Omega _I t_2) \hat{I}_y \\
A & = \frac{1}{\sqrt{2}} \cos (\Omega_S t_1) \sin ^2 (\pi J_{IS} \tau)  \cos (\Omega _I t_2)
\end{align*}
\end{document}

to obtain:

sample output

I am not sure whether the "A = ..." line is where you want it, but I think it is OK.

share|improve this answer
add comment

The following may be close to what you're looking for. Note the use of \phantom directives to create appropriate amounts of whitespace. I've created macros to typeset the subscript indices "IS" and "mix" in text-italics and text-roman, respectively, instead of math-italics, to enable text-appropriate kerning. I've also replaced \cos(\frac{\pi}{4}) with \cos(\pi/4) to make the use of larger parentheses unnecessary.

Note that the alignments aren't quite perfect across rows. This is because (i) the arrows aren't all of exactly the same length to begin with and (ii) the two minus signs in the middle equation serve as a unary operator in the first line but as a binary operator in the second (continuation) line. I'd actually recommend indenting the continuation line a bit more, to indicate more clearly its role. (Currently, the rows are aligned on the opening minus signs.)

enter image description here

\documentclass{article}
\usepackage{amsmath}
\newcommand\IS{\textit{IS}\,}
\newcommand\mix{\textnormal{mix}}
\begin{document}\pagestyle{empty}
\begin{align*}
&\xrightarrow{\frac{\pi}{2} \hat{I}_{\frac{\pi}{4}}} 
-\cos (\Omega_S t_1) \sin ^2 (\pi J_{\IS} \tau) 
\cos (\Omega_I t_2) \cos (\pi/4) \hat{I}_z \\
&\xrightarrow{\frac{\pi}{2} \hat{S}_x }  
- \frac{1}{\sqrt{2}} \cos (\Omega_{S_1} t_1) 
\sin ^2 (\pi J_{\IS} \tau) 
\cos (\Omega_{I_1} t_2) (1-R_z \tau_{\mix}) \hat{I}_z\\ 
&\phantom{\xrightarrow{\frac{\pi}{2} \hat{I}_{\frac{\pi}{4}}}{}}
- \frac{1}{\sqrt{2}} \cos (\Omega_{S_1} t_1) 
\sin ^2 (\pi J_{\IS} \tau) 
\cos (\Omega_{I_2} t_2) (\sigma_{12} \tau_{\mix}) \hat{I}_z\\
&\xrightarrow{\frac{\pi}{2} \hat{I}_x} 
\phantom{{}-{}}\frac{1}{\sqrt{2}} \cos (\Omega_S t_1) 
\sin ^2 (\pi J_{\IS} \tau) \cos (\Omega _I t_2) \hat{I}_y \\
&\,A = \frac{1}{\sqrt{2}} 
\cos (\Omega_S t_1) \sin ^2 (\pi J_{\IS} \tau)  \cos (\Omega _I t_2)\\
\end{align*}
\end{document}
share|improve this answer
    
Probably it should be \newcommand{\mix}{\textnormal{mix}} so it's upright rather than in italics. –  egreg Mar 18 '13 at 15:10
    
@egreg -- Good point; I'll change the code (and image). –  Mico Mar 18 '13 at 15:17
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.