2

I'd like to cross out a subsection of an aligned environment, as below (the actual content doesn't matter).

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

\begin{align} 4h + b &= \lambda 2bh \ 4 \cancel{b} &= \lambda b^{\cancel{2}} && \quad \text{for } b \neq 0\ b ^{2}h - V &= 0\ \ % cross out this section b &= \frac{4}{\lambda}\ 4h + \frac{4}{\lambda} &= 2\cancel{\lambda} h \frac{4}{\cancel{\lambda} }\ 4 \lambda h+ 4 &= 8 \lambda h\ 4 \lambda h &= 4\ \lambda h &= 1 % end the crossed out section \end{align}

\end{document}

I tried relative stacking on a phantom copy of the math (as in this answer), but it seems like \llap only stacks up one line. I really have no idea what I'm doing, but I hope there's a solution that doesn't involve something too heavy like tikz. Something like the \Aboxed solution to the same issue with boxed would be incredible.

The thing I tried: llap only overlaps one line up

\begin{align*}
4h + b &= \lambda 2bh \\
4 \cancel{b} &= \lambda b^{\cancel{2}} && \quad \text{for } b \neq 0\\
b ^{2}h - V &= 0\\\\

% cross out this section b &= \frac{4}{\lambda}\ 4h + \frac{4}{\lambda} &= 2\cancel{\lambda} h \frac{4}{\cancel{\lambda} }\ 4 \lambda h+ 4 &= 8 \lambda h\ 4 \lambda h &= 4\ \lambda h &= 1 % end the crossed out section % the code to generate a phantom cross out ; \llap{\mathrel{\xcancel{\phantom{\begin{align} b = \frac{4}{\lambda}\ 4h + \frac{4}{\lambda} = 2\cancel{\lambda} h \frac{4}{\cancel{\lambda} }\ 4 \lambda h+ 4 = 8 \lambda h\ 4 \lambda h = 4\ \lambda h = 1\ \end{align}}}}} \end{align*}

Mico
  • 506,678
Exr0n
  • 121

0 Answers0