一般列表环境基本是列表的符号lable和内容是衔接的,比较少的列表部分与内容是隔开的,下面这一列表环境需要将不同的题目进行灰色线条隔开,那么该如何实现呢。IpSCd 方法一:TiKz介入定制

\documentclass{article}
\usepackage{tikz}
\usepackage{enumitem}

\newlist{fancyenum}{enumerate}{2}
\setlist[fancyenum,1]{
  leftmargin=12pt,
  labelsep=10pt,
  label={\protect\begin{tikzpicture}[]
    \protect\node[overlay,text width=\textwidth,fill=gray!20,anchor=west,inner sep=0pt,minimum height=2em] (bg) {};
    \protect\node[overlay,anchor=west,minimum height=2em,inner sep=0pt,fill=black,align=center,text width=2em,text=white,font=\bfseries] at (bg.west) {\arabic*};
    \protect\node {\rule[5em]{0pt}{0pt}};
    \protect\end{tikzpicture}}
  }
\setlist[fancyenum,2]{label=\Alph*),topsep=0pt,leftmargin=22pt}

\begin{document}
\sffamily

\begin{fancyenum}
\item Some test text
  \begin{fancyenum}
  \item First
  \item Second
  \item Third
  \end{fancyenum}
\item Some test text
  \begin{fancyenum}
  \item First
  \item Second
  \item Third
  \end{fancyenum}
\item Some test text
  \begin{fancyenum}
  \item First
  \item Second
  \item Third
  \end{fancyenum}
\end{fancyenum}

\end{document}
方法二,使用eqparbox来进行扩展定制
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier}

\usepackage{enumitem}
\usepackage{xcolor}
\usepackage{eqparbox}
\newlist{myenum}{enumerate}{2}

\setlist[myenum, 1]%
{label =\eqparbox[t][\baselineskip]{N}{\colorbox{black}{\,\arabic*\,}} \hskip-0.333em{\color{lightgray!50!} \rule[-0.25\baselineskip]{\dimexpr\textwidth-\eqboxwidth{N}-2\parindent\relax}{\dimexpr\baselineskip+0.4pt\relax} \rule[-3ex]{0pt}{3ex}},
align=left,
font=\bfseries\color{white},
wide=0pt,
leftmargin=\eqboxwidth{N},itemsep =1.5\baselineskip}%

\setlist[myenum, 2]{label=\Alph*),leftmargin=*, topsep=0pt}

\begin{document}

\begin{myenum}[start=7]%
  \item The main purpose of the first paragraph is to
  \begin{myenum}
    \item describe a culture.
    \item criticize a tradition.
    \item question a suggestion.
    \item analyze a reaction.
  \end{myenum}
  \item As used in line 2, “form” most nearly means
  \begin{myenum}
    \item appearance.
    \item custom.
    \item structure.
    \item nature.
  \end{myenum}
\end{myenum}

\end{document}
选自:http://tex.stackexchange.com/questions/262697/how-to-style-latex-enumerate-list

点赞(1)

评论列表 共有 0 条评论

暂无评论
立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部