操作方法
首先,给出演示素材,比如要写出如下的公式:
如上图所示公式,最为关键的是如何对齐等号,一种简单的方式就是利用&符号来对齐,在每个等号前添加&符号即可,代码如下: A & =(x-y)(x+y) \\ & =x*x+x*y-y*x-y*y\\ & = x^2 - y^2
当然,对齐时需要设置特定格式或则说环境,需要添加如下语句说明: \begin{aligned} % requires amsmath; align* for no eq. number A & =(x-y)(x+y) \\ & =x*x+x*y-y*x-y*y\\ & = x^2 - y^2 \end{aligned}
所以完整latex代码如下所示: \documentclass{article} \usepackage{amssymb,amsmath} \begin{document} \begin{equation*} \begin{aligned} % requires amsmath; align* for no eq. number A & =(x-y)(x+y) \\ & =x*x+x*y-y*x-y*y\\ & = x^2 - y^2 \end{aligned} \end{equation*} \end{document}
需要注意的是,在打印预览时,需要选择合适的排版系统(如LaTex、XeTex)等。