我有以下代码
\documentclass{amsart}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[label = \textbf{(\roman*)}]
\item dajksdhaksdhjaksjdhajksdhaldsghahjsdla
\begin{enumerate}[label = \textbf{\alph*.}]
\item haskjdaksndasdjkhasdkhausdhiuhawiqkdnjsdnaksdikc
\begin{multline*}
\left( \cos(\pi x) + i\sin(\pi x) + i \right)\left( \cos(\pi x) - i\sin(\pi x) - i \right)\\ = \cos^2(\pi x) - i\sin(\pi x)\cos(\pi x) - i\cos(\pi x) + i\sin(\pi x)\cos(\pi x)\\
+ \sin^2(\pi x) + \sin(\pi x)+ i \cos(\pi x) + \sin(\pi x) + 1 = 2 + 2\sin(\pi x)
\end{multline*}
\end{enumerate}
\end{enumerate}
\end{document}
产生
问题是,等式的开头和枚举环境的缩进不匹配。它看起来很丑。我如何在多行环境中(或在一般数学环境,如方程或聚集中)缩进方程?
答案1
你可以将你的数学环境置于minipage
宽度为当前线宽的范围内:
\documentclass{amsart}
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.2pt}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[label = \textbf{(\roman*)}]
\item dajksdhaksdhjaksjdhajksdhaldsghahjsdla
\begin{enumerate}[label = \textbf{\alph*.}]
\item haskjdaksndasdjkhasdkhausdhiuhawiqkdnjsdnaksdikc
\noindent\begin{minipage}{\linewidth}
\begin{multline*}
\left( \cos(\pi x) + i\sin(\pi x) + i \right)\left( \cos(\pi x) - i\sin(\pi x) - i \right)\\ = \cos^2(\pi x) - i\sin(\pi x)\cos(\pi x) - i\cos(\pi x) + i\sin(\pi x)\cos(\pi x)\\
+ \sin^2(\pi x) + \sin(\pi x)+ i \cos(\pi x) + \sin(\pi x) + 1 = 2 + 2\sin(\pi x)
\end{multline*}
\end{minipage}
\end{enumerate}
\end{enumerate}
\end{document}
如果您必须重复执行此操作,您也可以定义一个新listmultline
环境(未编号),如下所示:
\makeatletter
\newenvironment{listmultline}{\par\noindent\minipage{\linewidth}\start@multline\st@rredtrue}%
{\endmultline\endminipage}
\makeatother