paralist 和 pifont 枚举

paralist 和 pifont 枚举

我想使用pilont枚举列表。有没有办法在不创建新列表环境(即使用选项)的情况下使用它?

我知道使用包是可行的enumitem,但是我使用paralist它。

在此处输入图片描述

\documentclass{article}
\usepackage{siunitx,paralist,pifont}

\begin{document}
\begin{compactitem}
\setlength{\itemsep}{4pt}
\item[\ding{202}] $\num{0.000314159}=\num{3.14159e-4}$
\item[\ding{203}] $\num{314159000}=\num{3.14159e8}$
\item[\ding{204}] $\num{3.14159}=\num[scientific-notation=true]{3.14159e0}$
\end{compactitem}
\end{document}

答案1

这是自动的并且允许嵌套。

\documentclass{article}
\usepackage{siunitx,paralist,pifont}

\DeclareRobustCommand{\digitinblackcircle}[1]{%
  \Pisymbol{pzd}{#1}%
}

\makeatletter
\newenvironment{picompact}
 {%
  \setlength{\plitemsep}{4pt}%
  \compactenum
  \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
  \@namedef{the\@enumctr}{\digitinblackcircle{\the\numexpr201+\value{\@enumctr}}}%
  \@namedef{label\@enumctr}{\@nameuse{the\@enumctr}}%
 }
 {\endcompactenum}
\makeatother

\begin{document}

Some text before the compact enumeration list long enough 
to split across lines and I hope this suffices
\begin{picompact}
\item $\num{0.000314159}=\num{3.14159e-4}$\label{A}
\item $\num{314159000}=\num{3.14159e8}$
\item $\num{3.14159}=\num[scientific-notation=true]{3.14159e0}$
\end{picompact}
and some text after it. Now a nested list
\begin{compactenum}
\item Whatever
  \begin{picompact}
  \item $\num{0.000314159}=\num{3.14159e-4}$
  \item $\num{314159000}=\num{3.14159e8}$
  \item $\num{3.14159}=\num[scientific-notation=true]{3.14159e0}$
  \end{picompact}
\item Again, with a reference: \ref{A}.
\end{compactenum}

\end{document}

在此处输入图片描述

enumitem

\documentclass{article}
\usepackage{siunitx,enumitem,pifont}

\DeclareRobustCommand{\digitinblackcircle}[1]{%
  \Pisymbol{pzd}{\the\numexpr201+#1}%
}

\newenvironment{picompact}
 {%
  \setlength{\itemsep}{4pt}%
  \enumerate[
    nosep,
    itemsep=4pt,
    label=\digitinblackcircle{\arabic*},
  ]
 }
 {\endenumerate}
\makeatother

\begin{document}

Some text before the compact enumeration list long enough 
to split across lines and I hope this suffices
\begin{picompact}
\item $\num{0.000314159}=\num{3.14159e-4}$\label{A}
\item $\num{314159000}=\num{3.14159e8}$
\item $\num{3.14159}=\num[scientific-notation=true]{3.14159e0}$
\end{picompact}
and some text after it. Now a nested list
\begin{enumerate}
\item Whatever
  \begin{picompact}
  \item $\num{0.000314159}=\num{3.14159e-4}$
  \item $\num{314159000}=\num{3.14159e8}$
  \item $\num{3.14159}=\num[scientific-notation=true]{3.14159e0}$
  \end{picompact}
\item Again, with a reference: \ref{A}.
\end{enumerate}

\end{document}

答案2

部分解决方案(不适用于嵌套列表),归功于米尔科姆

\documentclass{article}
\usepackage{siunitx,paralist,pifont}

\newcommand{\myitem}{\refstepcounter{enumi}\item[\ding{\numexpr\theenumi+201}]}
\begin{document}
\begin{compactitem}
\setlength{\itemsep}{4pt}
\myitem $\num{0.000314159}=\num{3.14159e-4}$
\myitem $\num{314159000}=\num{3.14159e8}$
\myitem $\num{3.14159}=\num[scientific-notation=true]{3.14159e0}$
\end{compactitem}
\end{document}

在此处输入图片描述

相关内容