When I am writing out complex derivations, I often want a “hanging indent” style of alignment to avoid excessive width on the first line, like this:
$
&1 + x + x^2 + x^3 + x^4 + x^5 + x^6 \
&wide = (x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7)/(x) \
&wide = (x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8)/(x^2) \
&wide = (x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9)/(x^3) \
&wide thick dots.v
$
The cleanest way I know how to do this is by repeating &quad or &wide at the beginning of each line, but I feel like there ought to be a better way. For example, I have tried
$
&#h(-2em) 1 + x + x^2 + x^3 + x^4 + x^5 + x^6 \
&= (x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7)/(x) \
&= (x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8)/(x^2) \
&= (x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9)/(x^3) \
&thick dots.v
$
which kind of works in that it eliminates the repeated &wide, but it means the equation block as a whole isn’t properly centered:
#let red-box(it) = align(center, block(stroke: red + 0.5pt, it))
#red-box[
$
&#h(-2em) 1 + x + x^2 + x^3 + x^4 + x^5 + x^6 \
&= (x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7)/(x)
$
]
I could put the & anchor on some random variable that happens to be near where I want my hanging indent, as in
#red-box[$
1 + &x + x^2 + x^3 + x^4 + x^5 + x^6 \
&= (x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7)/(x)
$]
which works, but hurts my soul.
Is there a better way to do this, or a package that can do it for me?


