我正在重做我的简历,并希望使用enumitem
,如下图所示。
如果不可能的话,那也不是世界末日,但如果enumitem
可以为我处理所有格式,而我只需关注我的内容。
基本上,我希望将内联列表视为普通项目列表中的一个“项目”。
是否可以严格使用以下布局enumitem
?
MWE图片:
MWE 代码:
\documentclass{article}
\usepackage{setspace}
\onehalfspacing
\setlength{\parindent}{0mm}
\usepackage[inline]{enumitem}
\setlist[itemize]{%
, label = \textbullet
, leftmargin = *
, nosep = true
}
\setlist[itemize,1]{%
, leftmargin = 0mm
}
\setlist[itemize,2]{%
, label = \textasteriskcentered
}
\begin{document}
\section*{Normal lists (via \texttt{enumitem})}
%
\begin{itemize}
\item fruits:
\begin{itemize}
\item apple
\item banana
\item cherry
\end{itemize}
\item vegetables:
\begin{itemize}
\item asparagus
\item broccoli
\item celery
\end{itemize}
\end{itemize}
\section*{Inline lists (via \texttt{enumitem})}
%
\begin{itemize}
\item fruits
\begin{itemize*}[after={{.}}, before=\unskip{: }, itemjoin={{; }}]
\item apple
\item banana
\item cherry
\end{itemize*}
\item vegetables
\begin{itemize*}[after={{.}}, before=\unskip{: }, itemjoin={{; }}]
\item asparagus
\item broccoli
\item celery
\end{itemize*}
\end{itemize}
\section*{Desired list (manual)}
%
\begin{itemize}
\item fruits:
\begin{itemize}
\item apple; \textasteriskcentered{} banana; \textasteriskcentered{} cherry.
\end{itemize}
\item vegetables:
\begin{itemize}
\item asparagus; \textasteriskcentered{} broccoli; \textasteriskcentered{} celery.
\end{itemize}
\end{itemize}
\end{document}
答案1
使用个人环境:
\documentclass{article}
\usepackage[inline]{enumitem}
\setlist[itemize]{%
label = \textbullet,
leftmargin = *,
nosep = true,
}
\setlist[itemize,1]{%
leftmargin = 0mm,
}
\setlist[itemize,2]{%
label = \textasteriskcentered,
}
\makeatletter
\newenvironment{resitemize}
{\ifnum\@listdepth=\z@
\def\final@command{itemize}%
\begin{itemize}
\else
\def\final@command{itemize*}%
\begin{itemize*}[after=., before=\unskip:\\, itemjoin=;\space]
\fi
}
{\expandafter\end\expandafter{\final@command}}
\makeatother
\begin{document}
\section*{Normal lists}
\begin{resitemize}
\item fruits
\begin{resitemize}
\item apple
\item banana
\item cherry
\end{resitemize}
\item vegetables
\begin{resitemize}
\item asparagus
\item broccoli
\item celery
\end{resitemize}
\end{resitemize}
\end{document}
在第一级时,它可以做到itemize
,在第二级时,它可以itemize*
按照所需的设置做到。