我想使用枚举创建一个“双重”列表,使得外部为粗体和斜体,而内部为普通字体。我尝试使用我想出的这个代码:
\large\textbf{\textit{
\begin{enumerate}
\item Proofs
\normalfont{\normalsize{
\begin{enumerate}
\item Proof by Contradiction
\item Mathematical Induction
\item Pigeonhole Principle
\item Parity Argument
\end{enumerate}}}
\item Divisibility
\end{enumerate}}}
它对第一项有效,但对第二项无效。这是我在 Overleaf 上编译时得到的结果:
我该如何修复它以便“可除性”也变为粗体和斜体?
答案1
简单来说enumitem
及其before
关键:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{enumitem}
\usepackage{lipsum}
\begin{document}
\begin{enumerate}[before=\large\itshape\bfseries]
\item Proofs
\begin{enumerate}[before=\normalfont\normalsize]
\item Proof by Contradiction
\item Mathematical Induction
\item Pigeonhole Principle
\item Parity Argument
\end{enumerate}
\item Divisibility
\end{enumerate}
\lipsum[11]
\end{document}
答案2
这个怎么样?
\documentclass{article}
\newcommand{\lbi}[1]{{\large\textbf{\textit{#1}}}}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[label={\lbi{\arabic*.}}]
\item
\lbi{Proofs}
\begin{enumerate}
\item Proof by Contradiction
\item Mathematical Induction
\item Pigeonhole Principle
\item Parity Argument
\end{enumerate}
\item
\lbi{Divisibility}
\end{enumerate}
\end{document}