1,首先,給出演示素材,比如要寫出如下的公式:
,2,如上圖所示公式,最為關鍵的是如何對齊等號,一種簡單的方式就是利用&符號來對齊,在每個等號前新增&符號即可,程式碼如下:A & =(x-y)(x+y) \\ & =x*x+x*y-y*x-y*y\\ & = x^2 - y^2
3,當然,對齊時需要設定特定格式或則說環境,需要新增如下語句說明:\begin{aligned} % requires amsmath; align* for no eq. numberA & =(x-y)(x+y) \\ & =x*x+x*y-y*x-y*y\\ & = x^2 - y^2\end{aligned}
4,所以完整latex程式碼如下所示:\documentclass{article}\usepackage{amssymb,amsmath}\begin{document}\begin{equation*}\begin{aligned} % requires amsmath; align* for no eq. numberA & =(x-y)(x+y) \\ & =x*x+x*y-y*x-y*y\\ & = x^2 - y^2\end{aligned}\end{equation*}\end{document}
1,首先,給出演示素材,比如要寫出如下的公式:
,2,如上圖所示公式,最為關鍵的是如何對齊等號,一種簡單的方式就是利用&符號來對齊,在每個等號前新增&符號即可,程式碼如下:A & =(x-y)(x+y) \\ & =x*x+x*y-y*x-y*y\\ & = x^2 - y^2
3,當然,對齊時需要設定特定格式或則說環境,需要新增如下語句說明:\begin{aligned} % requires amsmath; align* for no eq. numberA & =(x-y)(x+y) \\ & =x*x+x*y-y*x-y*y\\ & = x^2 - y^2\end{aligned}
4,所以完整latex程式碼如下所示:\documentclass{article}\usepackage{amssymb,amsmath}\begin{document}\begin{equation*}\begin{aligned} % requires amsmath; align* for no eq. numberA & =(x-y)(x+y) \\ & =x*x+x*y-y*x-y*y\\ & = x^2 - y^2\end{aligned}\end{equation*}\end{document}