数式モードでコメントのある行を他の行と揃える方法

数式モードでコメントのある行を他の行と揃える方法

\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

flalign*環境と中程度のコメントは、\medmathコマンドから使用できますnccmath。 私の意見では、他の解決策のほうが良いと思います。aligned内に 2 つの独立した環境を用意します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}

\!後のが必要なのは、LaTeX がの=奇数番号の後に細いスペースを挿入し、それによって演算子の位置がずれてしまうためです (の後に が続く場合は除きます)。&align&x

などのマクロを使用すると、\dg入力が高速化され、一貫性が確保されます。

ここに画像の説明を入力してください

ちなみに、a4paperと の両方を指定するletterpaperのは間違いです。用紙の形式に対応するオプションのみを使用してください (US Letter の場合は、letterpaperがデフォルトなので省略できます)。

関連情報