我将以下习语与方程链联系起来。我使用环境对齐方程align
,标记读者可能不清楚其原理的每个方程。我在这个方程链后面加上一个itemize
环境,其中每个方程\item
都为其中一个标记方程提供了依据。我使用相应的标签而不是项目符号。下面是一个例子。
\documentclass{scrbook}
\usepackage{amsmath,amsthm}
\newtheorem{theorem}{Theorem}[chapter]
\numberwithin{equation}{theorem}
\begin{document}
\chapter{A Chapter}
\section{A Section}
\begin{theorem}
$2 = 1 + 1$
\end{theorem}
\begin{proof}
\begin{align}
2 &= 2 + 0\label{eq:1}\\
&= 1 + 1\label{eq:2}
\end{align}
where
\begin{itemize}
\item[\eqref{eq:1}] is by Hinkel's lemma, and
\item[\eqref{eq:2}] is by the Fundamental Theorem of Small Integers.
\end{itemize}
\end{proof}
\end{document}
可以看出,用作环境“项目符号”的标签itemize
突出到左边距。我该如何纠正这个问题,以便所有内容都呈现在边距之间?
答案1
您可以使用labeling
KOMA-Script 类提供的环境。
例子:
\documentclass{scrbook}
\usepackage{amsmath,amsthm}
\newtheorem{theorem}{Theorem}[chapter]
\numberwithin{equation}{theorem}
\begin{document}
\chapter{A Chapter}
\section{A Section}
\begin{theorem}
$2 = 1 + 1$
\end{theorem}
\begin{proof}
\begin{align}
2 &= 2 + 0\label{eq:1}\\
&= 1 + 1\label{eq:2}
\end{align}
where
\begin{labeling}{\eqref{eq:2}}% syntax: \begin{labeling}{<widest label>}
\item[\eqref{eq:1}] is by Hinkel's lemma, and
\item[\eqref{eq:2}] is by the Fundamental Theorem of Small Integers.
\end{labeling}
\end{proof}
\end{document}
或者第二项有更多文字:
如果项目只有一行,您也可以使用:
\documentclass{scrbook}
\usepackage{blindtext}% only for dummy text
\usepackage{amsmath,amsthm}
\newtheorem{theorem}{Theorem}[chapter]
\numberwithin{equation}{theorem}
\begin{document}
\chapter{A Chapter}
\section{A Section}
\begin{theorem}
$2 = 1 + 1$
\end{theorem}
\begin{proof}
\begin{align}
2 &= 2 + 0\label{eq:1}\\
&= 1 + 1\label{eq:2}
\end{align}
where
\begin{labeling}{}
\item[\eqref{eq:1}] is by Hinkel's lemma, and
\item[\eqref{eq:2}] is by the Fundamental Theorem of Small Integers. \blindtext
\end{labeling}
\end{proof}
\end{document}
与上述结果唯一的区别是项目可能的第二行的缩进:
答案2
使用以下enumitem
包:
(红线表示文本边框)
\documentclass{scrbook}
\usepackage{amsmath,amsthm}
\newtheorem{theorem}{Theorem}[chapter]
\numberwithin{equation}{theorem}
\usepackage{enumitem}
\begin{document}
\chapter{A Chapter}
\section{A Section}
\begin{theorem}
$2 = 1 + 1$
\end{theorem}
\begin{proof}
\begin{align}
2 &= 2 + 0\label{eq:1}\\
&= 1 + 1\label{eq:2}
\end{align}
where
\begin{itemize}[wide]
\item[\eqref{eq:1}] is by Hinkel's lemma, and
\item[\eqref{eq:2}] is by the Fundamental Theorem of Small Integers.
\end{itemize}
\end{proof}
\end{document}
答案3
如果你喜欢自己动手使用 LaTeX,或者你不会/不能使用scrextend
或enuitem
其他包来格式化列表,那么有一个简单的解决方案\leftmargini
(注意最后我因为仅适用于列表的第一级)必须手动添加或考虑标签宽度。
另一种方法是使用原始list
环境而不是itemize
,这样也可以自动生成方程引用。请注意,在这种情况下,修改后的是\leftmargin
(没有最后的“i”)。关于列表的好处是您可以在自己的简单环境中进行转换。示例:
\documentclass{scrbook}
\def\a{is by Hinkel's lemma, and} % one line dummy ext
\def\b{is by the Fundamental Theorem % two lines dummy ext
of Small Integers. Lore ipsum dolor sit amet and bla bla bla...}
% \usepackage[showframe]{geometry} % uncomment to show margins ...
\parindent0pt % Disclaimer: To lazy to set lenghts in LaTeX mode, sorry.
% You should use \setlengths or you will have nightmares.
\newcounter{eq}
\newlength\eqlab
\settowidth\eqlab{\eqref{eq:2}}
\newenvironment{equation-references}{
\begin{list}{\eqref{eq:\arabic{eq}}}{\usecounter{eq}
\labelwidth2\eqlab
\labelsep1em
\leftmargin\dimexpr\labelwidth+\labelsep}
}{\end{list}}
\usepackage{amsmath}
\newtheorem{theorem}{Theorem}[chapter]
\numberwithin{equation}{theorem}
\begin{document}
\chapter{A Chapter}
\section{A Section}
\begin{theorem} $2 = 1 + 1$ \end{theorem}
\begin{align} 2 &= 2 + 0\label{eq:1}\\&= 1 + 1\label{eq:2} \end{align}
Set \verb|\leftmargini| manually to have label in margin:
{\leftmargini3.3em
\begin{itemize} \item[\eqref{eq:1}] \a \item[\eqref{eq:2}] \b \end{itemize}}
Or with some indentation:
{\leftmargini4em
\begin{itemize} \item[\eqref{eq:1}] \a \item[\eqref{eq:2}] \b \end{itemize}}
With automatic identation according to label width:
{\leftmargini\dimexpr\leftmargini+\eqlab
\begin{itemize} \item[\eqref{eq:1}] \a \item[\eqref{eq:2}] \b \end{itemize}}
Making a simple list autonumbered:
\begin{list}{\eqref{eq:\arabic{eq}}}{\usecounter{eq}}
\item \a \item \b \end{list}
Custom \verb|equation-references| environment with some label indentation:
\begin{equation-references}
\item \a \item \b
\end{equation-references}
\end{document}