
数式を左揃えにする必要があります。コマンド[fleqn]
にオプションを追加してみました\documentclass
が、機能しましたが、ドキュメント内のすべての数式が左揃えになってしまい、望んでいる結果が得られませんでした。
私のLaTeXコードは次のようになります
\documentclass{article}
\usepackage{amsmath}
\begin{document}
Classic math which I don't want align to the left
\[
2x + 5
\]
Multiline math which must be left-aligned
\begin{gather*}
x^2 + 3 \\
2x - 5
\end{gather*}
\end{document}
gather*
環境は例としてのみ使用されます。gather*
私のニーズに適した環境はありますか?よろしくお願いします
答え1
これはかなり奇妙な要件ですが、$$
の代わりにを使用すると最も簡単かもしれません\[
。$$
は公式にはサポートされていない構文であり、主な問題は、ない+ 作業はfleqn
まさにここで必要なことのようです。
ディスプレイ数式の上に空白行を残さないでください$$
。\[
\begin{align}
\documentclass[fleqn]{article}
\usepackage{amsmath}
\begin{document}
Classic math which I don't want align to the left
$$
2x + 5
$$
Multiline math which must be left-aligned
\begin{gather*}
x^2 + 3 \\
2x - 5 \\
\end{gather*}
\end{document}
答え2
gathered
環境内でネストを行うことができますflalign(*)
:
\documentclass{article}
\usepackage{mathtools}
\usepackage[showframe]{geometry}
\begin{document}
Classic math which I don't want align to the left
\begin{equation}
\begin{gathered}
x^2 + 3 \\
2x - 5 = z
\end{gathered}
\end{equation}
Multiline math which must be left-aligned
\begin{flalign}
\hskip\parindent & \begin{gathered}
x^2 + 3 \\
2x - 5 = z
\end{gathered} &
\end{flalign}
\end{document}