数式を左揃えにする方法

数式を左揃えにする方法

私は文書で以下の数式を使用しています。デフォルトでは中央揃えになっています。数式を左揃えにしたいのですが --この方程式のみ、文書内のすべての方程式ではありませんどうすればそれができるのか誰か教えてもらえますか?

\begin{equation}
d_j =
  \begin{cases}
    newval_i,  & \quad i = j\\
    randval_k, & \quad k = j\\
    bestval_j, & \quad \text{otherwise}
  \end{cases}
\end{equation}

答え1

fleqn環境 ( から)で方程式をネストすることで、これを実行できます。この環境は、左余白 (デフォルト)nccmathからの距離のオプション引数を受け入れます。0 pt

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry}
\usepackage{mathtools, nccmath}

\begin{document}

\begin{equation}
d_j =
  \begin{cases}
    \text{newval}_i, & \quad i = j\\
    \text{randval}_k, & \quad k = j\\
    \text{bestval}_j, & \quad \text{otherwise}
  \end{cases}
\end{equation}

\begin{fleqn}
\noindent\texttt{With fleqn: }
\begin{equation}
d_j =
  \begin{cases}
    \text{newval}_i, & \quad i = j\\
    \text{randval}_k, & \quad k = j\\
    \text{bestval}_j, & \quad \text{otherwise}
  \end{cases}
\end{equation}
\end{fleqn}

\begin{fleqn}[3em]
\noindent\texttt{With fleqn and optional argument [3em]: }
\begin{equation}
d_j =
  \begin{cases}
    \text{newval}_i, & \quad i = j\\
    \text{randval}_k, & \quad k = j\\
    \text{bestval}_j, & \quad \text{otherwise}
  \end{cases}
\end{equation}
\end{fleqn}

    \end{document} 

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

関連情報