縮排方程

縮排方程

我正在使用amsmath[fleqn],但我還想在方程式/對齊/收集環境之外縮排方程式。一個自然的選擇是使用相同長度的用法來縮進amsmath,但我不知道該怎麼做。我嘗試使用\mathindent(沒有定義其值),但它給出了“缺少數字”錯誤。我該怎麼做?謝謝

答案1

\mathindent擁有一個長度,所以要“使用它”,它必須像這樣完成\hspace{\mathindent}。下面是一個可能令人感興趣的範例:

在此輸入影像描述

\documentclass{article}
\usepackage[fleqn]{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
Some text before the equation.
\begin{equation}
  f(x) = ax^2 + bx + c
\end{equation}
Some text after the equation.

\hspace*{\dimexpr\mathindent-\parindent}$f(x) = ax^2 + bx + c$

Some more text before an equation.
\[
  f(x) = ax^2 + bx + c
\]
Some more text after an equation.
\end{document}

請注意,可以使用未編號的方程,無需手動縮排。例如,您可以只使用帶有星號的版本align

相關內容