让我们考虑以下 MWE:
\documentclass[letterpaper]{article}
\usepackage[marginparwidth=2in]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{calc}
\usepackage{marginnote}
\usepackage{enumitem}
\newenvironment{test}[1][3.8ex]{%
\renewcommand{\theenumi}{\alph{enumi}}%
\renewcommand{\labelenumi}{\theenumi)}%
\renewcommand{\theenumii}{\roman{enumii}}%
\renewcommand{\labelenumii}{\theenumii)}%
\renewcommand{\marginparsep}{1em}%
\marginnote{List}[#1]%
\list{}{%
\setlength{\leftmargin}{0pt}%
\setlength{\rightmargin}{0pt}%
\setlength{\parfillskip}{0pt plus 2fil}%
\setlength{\itemsep}{0pt}%
\setlength{\topsep}{1ex}%
\setlength{\partopsep}{0ex}
\setlength{\parskip}{0pt}%
\item\relax%
}%
}{
\endlist\ignorespacesafterend}
\reversemarginpar
\setlength{\parindent}{0pt}
\begin{document}
\begin{test}%
Some random text
\begin{enumerate}
\item To answer the first part, we are going to find $A \cup B $ followed by the intersection of this with set $C$. Thus,
\[(A \cup B ) \cap C =\{1,2,3,4,5,6,8\} \cap \{4,5,7\}= \{4,5\}\]
\item In the second part, we will first find $B \cap C$ followed by the union of this with set $A$. Hence,
\[A \cup (B \cap C)=\{1,2,3,4\} \cup \{5\} =\{1,2,3,4,5\}\]
\end{enumerate}
\end{test}
\end{document}
如果您注意到,枚举没有与边注水平对齐。如何实现这一点?对上述代码的任何改进都将不胜感激。我的方法是将topsep
可能改为0ex
但这还不够。A\vspace{<length>}
是我的最后手段,但似乎太明显了。有几个问题:
- 环境。我知道它不是最好的,但至少它可以编译
- 用来
[3.8ex]
调整边注。不明白为什么它不能自然发生,如果可以,该如何补救。 - 出现在 的
a
地方b
。
我正在尝试创建一个示例\解决方案环境。
答案1
要制作 MWE,您需要剪掉保留问题的部分,这里是标签的叠印。您可以删除marginpar
并enumitem
开始:
\documentclass[letterpaper]{article}
\newenvironment{test}[1][3.8ex]{%
\list{}{%
\item\relax
}%
}{%
\endlist\ignorespacesafterend}
\begin{document}
\begin{test}%
Some random text
\begin{enumerate}
\item To answer
\item In the
\end{enumerate}
\end{test}
\end{document}
问题出在哪里(终于:-)一目了然:\item
在错误的地方。它应该在列表环境的主体中,而不是在其参数中。
\documentclass[letterpaper]{article}
\newenvironment{test}[1][3.8ex]{%
\list{}{%
}%
\item\relax
}{%
\endlist\ignorespacesafterend}
\begin{document}
\begin{test}%
Some random text
\begin{enumerate}
\item To answer
\item In the
\end{enumerate}
\end{test}
\end{document}
将其放回并固定为不\marginparsep
设置边注后,现在可以将其放置在(空)物品标签上,以便自然对齐而不需要任何偏移。\setlength
\renewcommand
\documentclass[letterpaper]{article}
\usepackage[marginparwidth=2in]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{calc}
\usepackage{marginnote}
\usepackage{enumitem}
\newenvironment{test}{%
\renewcommand{\theenumi}{\alph{enumi}}%
\renewcommand{\labelenumi}{\theenumi)}%
\renewcommand{\theenumii}{\roman{enumii}}%
\renewcommand{\labelenumii}{\theenumii)}%
\setlength{\marginparsep}{1em}%
\list{}{%
\setlength{\leftmargin}{0pt}%
\setlength{\rightmargin}{0pt}%
\setlength{\parfillskip}{0pt plus 2fil}%
\setlength{\itemsep}{0pt}%
\setlength{\topsep}{1ex}%
\setlength{\partopsep}{0ex}
\setlength{\parskip}{0pt}%
}%
\item\relax\leavevmode\marginnote{List}\ignorespaces
}{
\endlist\ignorespacesafterend}
\reversemarginpar
\setlength{\parindent}{0pt}
\begin{document}
\begin{test}%
Some random text
\begin{enumerate}
\item To answer the first part, we are going to find $A \cup B $ followed by the intersection of this with set $C$. Thus,
\[(A \cup B ) \cap C =\{1,2,3,4,5,6,8\} \cap \{4,5,7\}= \{4,5\}\]
\item In the second part, we will first find $B \cap C$ followed by the union of this with set $A$. Hence,
\[A \cup (B \cap C)=\{1,2,3,4\} \cup \{5\} =\{1,2,3,4,5\}\]
\end{enumerate}
\end{test}
\end{document}