答案1
该cancel
包可用于此目的。
\documentclass{article}
\usepackage{mathtools,xcolor,cancel}
\renewcommand\CancelColor{\color{red}}
\begin{document}
\begin{align}
\biggl(\frac{8x-2}{\cancel{18}}-\frac{x-2}{\cancel{18}}\biggr) \cdot \cancel{18} &= \frac{21}{\cancel{18}} \cdot \cancel{18}
\\
8x - \bcancel{2} - x + \bcancel{2} &= 21
\end{align}
\end{document}
答案2
与图像相关的 LaTeX 代码为:
\begin{align*}
( \frac{8x - 2}{{\color{Red} \cancel{{\color{Black} 18}}}} - \frac{x - 2}{{\color{Red} \cancel{{\color{Black} 18}}}} ) \times {\color{Red} \cancel{{\color{Blue} 18}}} = \frac{21}{{\color{Red} \cancel{{\color{Black} 18}}}} \times {\color{Red} \cancel{{\color{Blue} 18}}}\\
8x - 2 - ( x - 2 ) = 21\\
8x - {\color{Red} \bcancel{{\color{Black} 2}}} - x + {\color{Red} \bcancel{{\color{Black} 2}}} = 21\\
\end{align*}
使用的命令是:
\bcancel{}
从左上角到右下角删除内容\cancel{}
从左下角到右上角删除内容{\color{add color} {}}
赋予所包含的对象颜色\frac{}{}
创建分数线\times
创建叉积的符号\begin{align*}
并\end{align*}
包含对齐\\
表示换行
但就我个人而言,我更喜欢这样:
\begin{align*}
\left( \frac{8 \cdot x - 2}{{\color{Red} \cancel{{\color{Black} 18}}}} - \frac{x - 2}{{\color{Red} \cancel{{\color{Black} 18}}}} \right) \cdot {\color{Red} \cancel{{\color{Blue} 18}}} &= \frac{21}{{\color{Red} \cancel{{\color{Black} 18}}}} \cdot {\color{Red} \cancel{{\color{Blue} 18}}}\\
8 \cdot x - 2 - \left( x - 2 \right) &= 21\\
8 \cdot x - {\color{Red} \bcancel{{\color{Black} 2}}} - x + {\color{Red} \bcancel{{\color{Black} 2}}} &= 21\\
\end{align*}
新使用的命令是:
&
对齐\cdot
创建一个中心点\left( \right)
创建与内容一样大的括号