方程式環境での欠落した記号に対する定数エラー

方程式環境での欠落した記号に対する定数エラー

これは馬鹿げた質問のように聞こえるかもしれませんが、私の作品には欠けている記号がたくさん出てきますが、それらはそこにあります。

その一例は

\begin{equation} \label{eq:rgbtohsb}
\begin{center}
$Hue = \left\{\begin{array}{ccc}
\frac{g - b}{max(r,g,b)- min(r,g,b)} & \quad \text{if } & max(r,g,b) =  r\\
\frac{b-r}{max(r,g,b)- min(r,g,b)} & \quad \text{if } & max(r,g,b) = g \\
\frac{r-g}{max(r,g,b)- min(r,g,b)} & \quad \text{if } & max(r,g,b) = b \\
\end{array}

Saturation = \left \{ \begin{array}{ccc}
0 & \text{if } & r = g = b\\
\frac{max(r,g,b)}{V} & \quad \text{ otherwise} \\
\end{array} $

$Value = max(r,g,b)$

$Lightness = \frac{1}{2}(max(r,g,b) + min(r,g,b)) $
\end{center}
\end{equation}

ご覧の通り、私は確かに をすべて持っています$。また、\begin{center}と も持っています。\end{center}

もう一つの間違いは\begin{document}\end{equation}

私が使用しているヘッダーはこちらです

\documentclass[a4paper,11pt,twoside]{article}
\usepackage[left=2.5cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{fancyhdr}
\usepackage{mathtools}
\usepackage[parfill]{parskip}
\usepackage{program}
\pagestyle{fancyplain}
\fancyhf{}
\rhead{\fancyplain{}{\today}}
\cfoot{\fancyplain{}{\thepage}}
\usepackage{graphicx}
{\tiny }

私は\end{document}

ご協力いただきありがとうございます!

答え1

あなたの例には4つの間違いがあります。

  • \begin/end{center}表示される方程式には必要ありません。方程式はデフォルトで中央に配置されます。

  • 方程式環境内ではドル記号は必要ありません。すでに数学モードになっています。

  • \left一致する がなければ を使用することはできませんが、適切な区切り文字が必要ない場合は を\right使用できます。\right.

  • 方程式環境内に空行を含めることはできません。

修正版(不要な部分は削除)は次のとおりです。方程式に番号を付けたくない場合は、equation*の代わりにを使用できます。また、 とをと にequation省略できます。最後に、定義済みコマンド と があり、単に「max」と「min」と入力するよりも良い結果が得られることに注意してください。\begin{equation*}\end{equation*}\[\]\max\min

\documentclass[a4paper,11pt,twoside]{article}
\usepackage{mathtools}
\begin{document}
\begin{equation} \label{eq:rgbtohsb}
\text{Hue} = \left\{
\begin{array}{ccc}
\frac{g - b}{max(r,g,b)- \min(r,g,b)} & \quad \text{if } & \max(r,g,b) =  r\\
\frac{b-r}{max(r,g,b)- \min(r,g,b)} & \quad \text{if } & \max(r,g,b) = g \\
\frac{r-g}{max(r,g,b)- \min(r,g,b)} & \quad \text{if } & \max(r,g,b) = b \\
\end{array}
\right.
\end{equation}
%
\begin{equation}
\text{Saturation} = \left \{ \begin{array}{ccc}
0 & \text{if } & r = g = b\\
\frac{\max(r,g,b)}{V} & \quad \text{ otherwise} \\
\end{array}
\right.
\end{equation}
%
\begin{equation}
\text{Value} = \max(r,g,b)
\end{equation}
%
\begin{equation}
\text{Lightness} = \frac{1}{2}(\max(r,g,b) + \min(r,g,b))
\end{equation}
\end{document}

amsmath パッケージ( をロードすると自動的にロードされますmathtools)は、数式をフォーマットするための他の多くの環境を提供します。実際の文書の構造によっては、そのいくつか(例: gather)の方が よりも適している場合があります。equationそれほど短くないLaTeX入門

関連情報