从非常优秀的用户@Marian G 的 MWE 开始。漂亮列举:fontawesome
\documentclass{article}
\usepackage{fontawesome}
\usepackage{xcolor}
\newcount\cnt
\cnt=1
\newbox\battery
\setbox\battery=\hbox\faBatteryFull
\def\numberlabel{%
\ifnum\the\cnt>4\relax
\else {\tiny\sffamily\the\cnt}%
\fi
}
\def\Item{%
\item[%
\vbox{\baselineskip=10pt
\hbox to \the\wd\battery{\hss\numberlabel\hss}
\hbox{%
\ifnum\the\cnt=1{\color{green}\faBatteryFull}
\else
\ifnum\the\cnt=2{\color{orange}\faBatteryThreeQuarters}
\else
\ifnum\the\cnt=3{\color{yellow}\faBatteryHalf}
\else
\ifnum\the\cnt=4{\color{red}\faBatteryQuarter}
\else{\sffamily\color{lightgray}XXX}
\fi
\fi
\fi
\fi}%
}%
]%
\advance\cnt by 1
}
\begin{document}
\begin{enumerate}
\Item text text
\Item TEXT
\Item another text
\Item some text
\Item some text
\end{enumerate}
\bigskip
\begin{enumerate}
\Item abc
\Item defg
\Item hijk
\Item lmno
\end{enumerate}
\end{document}
如何减少枚举数字和符号之间的高度?
我想要这样的东西,
如果可以的话。谢谢。
附录
使用用户@sive 的代码(我对其进行了少许修改)时,我遇到了文本第一行和第二行之间有一点空格的问题:
\documentclass{article}
\usepackage{fontawesome}
\usepackage{xcolor}
\newcount\cnt
\cnt=1
\newbox\battery
\setbox\battery=\hbox\faBatteryFull
\def\numberlabel{%
\ifnum\the\cnt>4\relax
\else {\bfseries\tiny\sffamily[\the\cnt]}%
\fi
}
\def\Item{%
\item[%
\raisebox{-0.85em}{%
\vbox{\baselineskip=10pt
\hbox to \the\wd\battery{\hss\numberlabel\hss}
\hbox{%
\ifnum\the\cnt=1{\color{green}\faBatteryFull}
\else
\ifnum\the\cnt=2{\color{orange}\faBatteryThreeQuarters}
\else
\ifnum\the\cnt=3{\color{yellow}\faBatteryHalf}
\else
\ifnum\the\cnt=4{\color{red}\faBatteryQuarter}
\else{\sffamily\color{lightgray}XXX}
\fi
\fi
\fi
\fi}%
}}%
]%
\advance\cnt by 1
}
\usepackage{lipsum}
\begin{document}
\begin{enumerate}
\Item \lipsum[1]
\Item \lipsum[2]
\Item another text
\Item some text
\Item some text
\end{enumerate}
\bigskip
\begin{enumerate}
\Item abc
\Item defg
\Item hijk
\Item lmno
\end{enumerate}
\end{document}
答案1
\documentclass{article}
\usepackage{fontawesome}
\usepackage{xcolor}
\newcount\cnt
\cnt=1
\newbox\battery
\setbox\battery=\hbox\faBatteryFull
\def\numberlabel{%
\ifnum\the\cnt>4\relax
\else {\bfseries\tiny\sffamily[\the\cnt]}%
\fi
}
\def\Item{%
\item[%
\smash{\raisebox{-0.85em}{%
\vbox{\baselineskip=10pt
\hbox to \the\wd\battery{\hss\numberlabel\hss}
\hbox{%
\ifnum\the\cnt=1{\color{green}\faBatteryFull}
\else
\ifnum\the\cnt=2{\color{orange}\faBatteryThreeQuarters}
\else
\ifnum\the\cnt=3{\color{yellow}\faBatteryHalf}
\else
\ifnum\the\cnt=4{\color{red}\faBatteryQuarter}
\else{\sffamily\color{lightgray}XXX}
\fi
\fi
\fi
\fi}%
}}}%
]%
\advance\cnt by 1
}
\usepackage{lipsum}
\begin{document}
\begin{enumerate}
\Item \lipsum[2]
\Item \lipsum[1]
\Item another text
\Item some text
\Item some text
\end{enumerate}
\bigskip
\begin{enumerate}
\Item abc
\Item defg
\Item hijk
\Item lmno
\end{enumerate}
\end{document}