
當我使用 \tag 命令在數學模式下添加註釋時,有時該行會偏離中心並且與其餘方程式不對齊。以下是程式碼及其輸出的範例:
\documentclass[a4paper, 11pt, letterpaper]{article}
\usepackage{comment}
\usepackage{fullpage}
\usepackage{amsmath,amsthm,amssymb}
\usepackage{mathtools,amsthm}
\begin{document}
\[\mathrm{cosec}^2 (x-200^{\circ}) =2 \tag{$-150 ^{\circ} \leq x-200^{\circ} \leq 150 ^{\circ}$}\]
\[\sin ^2 (x-200 ^{\circ}) = \f 12\]
\[\sin (x-200 ^{\circ}) = \pm \f{1}{\sqrt{2}}\]
\[x-200 ^{\circ} = 45 ^{\circ}, 135 ^{\circ}, -45 ^{\circ}, -135 ^{\circ}\]
\[x= 65^{\circ}, 155 ^{\circ}, 245^{\circ}, 335 ^{\circ}\]
\end{document}
我嘗試過使用align*環境,但隨後所有方程式都變得有點偏離中心。當所有方程式都用等號對齊時,它看起來也不美觀。我想要一個仍將所有方程式保留在頁面中心的解決方案。
謝謝你的幫忙!
答案1
您可以透過指令 from 來使用flalign*
環境和中等大小的註解。我認為更好的其他解決方案:兩個獨立的環境:\medmath
nccmath
aligned
gather*
\documentclass[a4paper, 11pt, letterpaper]{article}
\usepackage{amssymb, amsthm}
\usepackage{mathtools, nccmath}
\DeclareMathOperator{\cosec}{cosec}
\begin{document}
\begin{flalign*}
& & \cosec ^2 (x-200^{\circ}) & = 2 & & \mathllap{(\medmath{-150 ^{\circ} \leq x-200^{\circ} \leq 150 ^{\circ}})} \\
& & \sin ^2 (x-200 ^{\circ}) & = \frac12 \\
& & \sin (x-200 ^{\circ}) & = \pm \frac{1}{\sqrt{2}} \\
& & x-200 ^{\circ} & = 45 ^{\circ}, 135 ^{\circ}, -\mathrlap{45 ^{\circ}, -135 ^{\circ}} \\
& & x & = 65^{\circ}, 155 ^{\circ}, \mathrlap{245^{\circ}, 335 ^{\circ}}
\end{flalign*}
\bigskip
\begin{gather*}
\begin{aligned}
\cosec ^2 (x-200^{\circ}) & = 2 & & \mathrlap{(\medmath{-150 ^{\circ} = \leq x-200^{\circ} \leq 150 ^{\circ}})} \\
\sin ^2 (x-200 ^{\circ}) & = \frac12 \\
\sin (x-200 ^{\circ}) & = \pm \frac{1}{\sqrt{2}}
\end{aligned}\\[1ex]
\begin{aligned}
x-200 ^{\circ} & = 45 ^{\circ}, 135 ^{\circ}, - 45 ^{\circ}, -135 ^{\circ} \\
x & = 65^{\circ}, 155 ^{\circ}, 245^{\circ}, 335 ^{\circ}
\end{aligned}
\end{gather*}
\end{document}
答案2
我會保持簡單:不需要在等號處對齊;而且,括號中的條件不是註釋,而是等式的一部分。
\documentclass[a4paper,11pt]{article}
\usepackage{amsmath}
\DeclareMathOperator{\cosec}{cosec}
\newcommand{\dg}{^{\circ}}
\begin{document}
\begin{align*}
&\! \cosec ^2 (x-200\dg) = 2 \qquad (-150\dg \leq x-200\dg \leq 150\dg) \\
&\! \sin ^2 (x-200\dg) = \frac12 \\
&\! \sin (x-200\dg) = \pm \frac{1}{\sqrt{2}} \\
& x-200\dg = 45\dg, 135\dg, -45\dg, -135\dg \\
& x = 65\dg, 155\dg, 245\dg, 335\dg
\end{align*}
\end{document}
after是必要的,因為 LaTeX在 中的\!
奇數=
後面插入一個薄空格,這會導致運算子未對齊(不是當後面跟著時)。&
align
&
x
使用諸如此類的巨集\dg
可以加快打字速度並確保一致性。
順便說一句,同時指定a4paper
和letterpaper
是錯誤的:僅使用與您的紙張格式相對應的選項(如果是 US Letter,則letterpaper
可以省略,因為它是預設值)。