在枚举项外部左对齐长方程

在枚举项外部左对齐长方程

我在枚举环境中有一个长方程,它以数字项(缩进)左对齐。我尝试\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 ofenumitem 恢复:

\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}
     }

当然,这么长的方程式(比纸张宽度宽)无法适合文本宽度。如果它真的那么长,那么你应该考虑把它分成两行(或者如果有必要的话)更多行。

相关内容