2

I would like to know whether there's any way to include some text in one of the lines of some aligned output but that exists "outside" of the alignment. (In case it makes a difference, I am asking this about a document I'm writing in Overleaf.) Here a sample code:

\begin{enumerate \item \-\hspace{4cm} $\tan^{-1} x + tan^{-1} y = \frac{\pi}{4} \Longleftrightarrow (x+1)(y+1) = 2$ Proof: \begin{align*} \tan^{-1}x + tan^{-1}y = \frac{\pi}{4} & \Longleftrightarrow \tan \left(\tan^{-1}x + tan^{-1}y\right) = 1 \\[2mm] & \Longleftrightarrow \frac{x+y}{1-xy} = 1 \\[2mm] & \Longleftrightarrow (x+1)(y+1) = 2 \end{align*} \end{enumerate}} 

This yields the following output:

align I

I would like to have the word "Proof" be part of the first line of the proof but not be affected by the align environment. I tried including the "Proof" in the first line with it's own set of &'s, but that indented the word much more than I liked:

\begin{enumerate} \item \-\hspace{4cm} $\tan^{-1}x + tan^{-1}y = \frac{\pi}{4} \Longleftrightarrow (x+1)(y+1) = 2$ \begin{align*} &\text{Proof:}&\tan^{-1}x+tan^{-1}y=\frac{\pi}{4}&\Longleftrightarrow\tan\left(\tan^{-1}x+tan^{-1}y\right)=1\\[2mm] &&& \Longleftrightarrow \frac{x+y}{1-xy} = 1 \\[2mm] &&& \Longleftrightarrow (x+1)(y+1) = 2 \end{align*} \end{enumerate} 

align II

Ideally I'd like the "Proof" to be as far left as it is in the first image, just a bit to the right of the number 1, but still part of the first line as in the second image. If that's possible, perhaps I could also align the top line with the first line of the proof without having to push it to the right separately with the -\hspace as I did.

I did search the site for answers, the closest thing I found to what I want is \intertext, but that adds a separate line outside the \align environment; is there something similar that I can use but that puts the text in one of the lines that's aligned?

4
  • Welcome to TeX.SE. Commented Mar 8, 2023 at 5:53
  • The statement you’re trying to prove is false without the assumption that x > -1 and y > -1. Very common mistake that you don’t want to tell your students. Commented Mar 8, 2023 at 7:46
  • See desmos.com/calculator/qtjtr4swmw to see why. Commented Mar 8, 2023 at 8:07
  • @egreg I appreciate the heads up; I did know the two factors on the right needed to be positive, but I very possibly might have forgotten to make a note of that had you not brought it up. Commented Mar 8, 2023 at 8:42

1 Answer 1

2

I'd like to suggest that you employ an aligned environment.

enter image description here

\documentclass{article} % or some other suitable document class \usepackage{amsmath} % for 'aligned' environment \begin{document} \begin{enumerate} \item $\displaystyle \tan^{-1}x + \tan^{-1}y = \tfrac{1}{4}\pi \Longleftrightarrow (x+1)(y+1) = 2$. \medskip Proof.\quad $\begin{aligned}[t] \tan^{-1}x + \tan^{-1}y = \tfrac{1}{4}\pi &\Longleftrightarrow \tan(\tan^{-1}x + \tan^{-1}y) = 1 \\ &\Longleftrightarrow \frac{x+y}{1-xy} = 1 \\ &\Longleftrightarrow (x+1)(y+1) = 2\,. \end{aligned}$ \end{enumerate} \end{document} 
4
  • That worked great. May I ask what the [t] does? I tried removing it and the "Proof" ended up at the beginning of the second line rather than the first. Commented Mar 8, 2023 at 6:35
  • 1
    It aligns the environment at the top. You will understand it if you replace t (top) by c (center) and b (bottom) for a second. Commented Mar 8, 2023 at 7:24
  • @Οὖτις Yes, got it, I guess by leaving out the [t] completely it defaulted to [c] which is why the "Proof" ended up with the middle line. Is there a name for these? I'd like to find out a little more about what they do and whether they can be used in other environments. Commented Mar 8, 2023 at 8:08
  • 1
    I'm not 100% sure, but I think it is simply called (vertical) alignment. Commented Mar 8, 2023 at 8:13

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.