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 want to simultaneously have text left and right justified around an align environment. I'm able to do this, but my solution seems like a dreadful hack. I really don't want to prepend every line with &&. But && doesn't really get the text to be flush with the left. Does anyone have a better solution?

Here's my code:

\documentclass{article}
\usepackage{amsmath,amssymb,amsthm,mathtools}
\usepackage[margin=1in]{geometry}
\setlength{\parindent}{0pt}
\begin{document}
Establish the following identity:
    \[\cos^4\theta-\sin^4\theta=\cos(2\theta)\]
\begin{align*}%'
    \tag*{\makebox[0pt][l]{\hspace*{-\textwidth}\textbf{Proof:}}}
    \cos^4\theta-\sin^4\theta 
    &=     (1-\sin^2\theta)^2 - \sin^4\theta
    && \text{Use $\cos^2\theta=1-\sin^2\theta$}
    \\
    &    =    1 - 2\sin^2\theta + \sin^4\theta - \sin^4\theta
    \\
    &    =    1 - 2\sin^2\theta = \cos(2\theta) && \text{Double angle formula.}
\end{align*}
\end{document}

Result: enter image description here

share|improve this question
    
Welcome to tex.sx! Note that if you indent your code by 4 spaces, it will be displayed as a code block. Alternatively, you can select the code and click the "code" ({}) button. –  T. Verron Nov 22 '12 at 0:30
1  
Welcome to TeX.SX! What is preventing you from writing "Proof" outside the align* environment? Having it on the same height as the first formula is not at all needed or desirable, in my opinion. –  egreg Nov 22 '12 at 0:33
    
It's just an example. It's not the best example. I agree with your comment about "proof". The point is that this example achieves the effect I desire. I'm interested in a better way of achieving the effect. –  A.Ellett Nov 22 '12 at 0:35
1  
Left-aligned text "inside" align* is achieved using \intertext. See inserting sentences between subequations. –  Werner Nov 22 '12 at 0:41
1  
flalign* really flushes left and right, but it still needs && hacks, as you said. –  Manuel Nov 22 '12 at 0:50

1 Answer 1

up vote 3 down vote accepted

As in one of the comments mentioned I would use the not well known falign or falign*environment like in this example:

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

\begin{flalign}
\text{Proof}    && a &= b &&\\
    && a &= b &&\\
    && a &= b && \text{some comment}\\
    && a &= b &&
\end{flalign}

\begin{flalign*}
\text{Proof}    && a &= b &&\\
    && a &= b &&\\
    && a &= b && \text{some comment}\\
    && a &= b &&
\end{flalign*}

\end{document}

This will result in:

enter image description here

share|improve this answer
    
Is the only difference between the * and non-star versions the numbering? –  soandos Oct 3 '13 at 16:22
    
@soandos: As far as I know: Yes. –  Manuel Kuehner Oct 3 '13 at 17:22

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.