我对@Sandy G 的回答有以下疑问:获得半角公式的程序
我正在尝试做同样的事情,但针对其他公式:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat*}{2}
-\cos^2 \left( \dfrac{\alpha}{2}\right) &+\sin^2 \left( \dfrac{\alpha}{2}\right) &&=-\cos \alpha \\
\cos^2 \left( \dfrac{\alpha}{2}\right) &+\sin^2 \left( \dfrac{\alpha}{2}\right) &&=1\\[-1ex]
&\rlap{\rule{5.1cm}{.5pt}} \\[-1ex]
2&\sin^2 \left( \dfrac{\alpha}{2}\right)&&= 1-\cos \alpha \Rightarrow \sin^2 \left( \dfrac{\alpha}{2}\right)=\dfrac{1-\cos \alpha}{2}\Rightarrow \sin \left( \dfrac{\alpha}{2}\right) = \pm \sqrt{\dfrac{1-\cos \alpha}{2}}
\end{alignat*}
\end{document}
但是该线向左偏移并且 $2\sin^2$ 如果可以粘贴到等号上......
答案1
您可以用一些 hspace 来填充它,以便快速但粗糙地修复它:
\begin{alignat*}{2}
-&\cos^2 \left( \dfrac{\alpha}{2}\right) + \sin^2 \left( \dfrac{\alpha}{2}\right)&&=-\cos \alpha \\
&\cos^2 \left( \dfrac{\alpha}{2}\right) +\sin^2 \left( \dfrac{\alpha}{2}\right)&&=1\\[-1ex]
&\rlap{\rule{5.1cm}{.5pt}}\\[-1ex]
&\hspace{4.7em}2\sin^2 \left( \dfrac{\alpha}{2}\right)&&= 1-\cos \alpha \Rightarrow \sin^2 \left( \dfrac{\alpha}{2}\right)=\dfrac{1-\cos \alpha}{2}\Rightarrow \sin \left( \dfrac{\alpha}{2}\right) = \pm \sqrt{\dfrac{1-\cos \alpha}{2}}
\end{alignat*}
\end{document}