我在枚举环境中有一个长方程,它以数字项(缩进)左对齐。我尝试\noindent
将方程式放在 之外\begin{align}
,但没有成功。示例:
\begin{enumerate}
\item
\begin{align}
R(x) = really-long-equation-that-gets-forced-to-align-with-the-number-1.-but-I-want-full-left-alignment
\end{align}
\end{enumerate}
答案1
您可以使用以下命令启动显示\hspace{-\leftmargin}
:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\noindent
Text
\begin{enumerate}
\item
\begin{align}
\hspace{-\leftmargin}
R(x) = really-long-equation-that-gets-forced-to-align-with-the-number-1.-but-I-want-full-left-alignment
\end{align}
\item Text.
\end{enumerate}
\end{document}
答案2
也许您想要这个,可以通过两种方式获得:使用 adjustwidth
环境(来自changepage
),或离开enumerate
环境,以完整的文本宽度插入数学, enumerate
然后使用resume] option of
enumitem 恢复:
\documentclass{article}
\usepackage[utf8]{inputenc}%
\usepackage[showframe]{geometry}
\usepackage{enumitem}
\usepackage{amsmath}
\usepackage{changepage}
\begin{document}
\begin{enumerate}
\item
\begin{adjustwidth}{-\leftmargini}{0cm}
\begin{align}
R(x) = \text{really-long-equation-that-gets-forced-to-align-with-the-number-1.-but-I-want-full-left-alignment}
\end{align}
\end{adjustwidth}
\item Another item.
\end{enumerate}
\vskip1cm
\begin{enumerate}[after = \leavevmode\vspace*{-\abovedisplayskip}]
\item
\end{enumerate}
\begin{align}
R(x) = \text{really-long-equation-that-gets-forced-to-align-with-the-number-1.-but-I-want-full-left-alignment}
\end{align}
\begin{enumerate}[resume]
\item Another item.
\end{enumerate}
\end{document}
答案3
尝试:
\documentclass[12pt]{article}
\usepackage[showframe]{geometry}
\usepackage{amsmath}
\usepackage[strict]{changepage}
%%------------ for restoring textwidth inside list, for equations
\makeatletter
\newsavebox\restorebox
\newenvironment{restoretext}%
{\@parboxrestore%
\begin{adjustwidth}{}{}%
\begin{lrbox}{\restorebox}%
\hspace{\dimexpr\labelwidth-\labelsep\relax}%
\begin{minipage}{\dimexpr\textwidth-\labelwidth\relax}%
}{\end{minipage}\end{lrbox}
\usebox\restorebox
\end{adjustwidth}
}
\makeatother
\usepackage{lipsum}
\begin{document}
\begin{enumerate}
\item \lipsum*[11]
\begin{restoretext}
\begin{gather}
R(x) = really-long-equation-that-gets-forced-to-align-with-the-number-1.-but-I-want-full-left-alignment
\end{gather}
\end{restoretext}
\item \lipsum*[11]
\end{enumerate}
\end{document}
如果你喜欢等式左侧星号在文本左侧边框处,则将定义更改restoretext
为
\newenvironment{restoretext}%
{\@parboxrestore%
\begin{adjustwidth}{}{}%
\begin{lrbox}{\restorebox}%
\begin{minipage}{\textwidth}%
}{\end{minipage}\end{lrbox}
\usebox\restorebox
\end{adjustwidth}
}
当然,这么长的方程式(比纸张宽度宽)无法适合文本宽度。如果它真的那么长,那么你应该考虑把它分成两行(或者如果有必要的话)更多行。