更新版本

更新版本

我正在尝试用阿拉伯语为我的书实现一个漂亮的枚举,用 fontawesome 枚举一个特定的符号。在这个包中,我找不到更适合我口味的网球。

这是我的 MWE 和我的代码的截图,

\documentclass[a4paper,12pt]{article}
\usepackage{fontawesome}
\usepackage{enumitem}
\usepackage{xcolor}
\begin{document}
\begin{enumerate}[label=\sffamily\textbf{\tiny\arabic*}\,\textcolor{green}{\faBatteryFull}]
\item text text
\item second
\item third
\end{enumerate}
\begin{enumerate}[label=\sffamily\textbf{\tiny\arabic*}\,\textcolor{orange}{\faBatteryThreeQuarters}]
\item  text text
\item another
\end{enumerate}
\begin{enumerate}[label=\sffamily\textbf{\tiny\arabic*}\,\textcolor{yellow}{\faBatteryHalf}]
\item  text text
\item different
\end{enumerate}
\begin{enumerate}[label=\sffamily\textbf{\tiny\arabic*}\,\textcolor{red}{\faBatteryQuarter}]
\item  text text
\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 {\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}

原始版本

输出

在此处输入图片描述

代码

\documentclass{article}

\usepackage{fontawesome}
\usepackage{xcolor}

\newcount\cnt
\cnt=1

\def\numberlabel{%
    {\tiny\sffamily\the\cnt\hskip.3em}}

\def\Item{%
    \item[%
    \numberlabel
    \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}

答案2

使用 Tiz 而不使用枚举。

\documentclass[a4paper,12pt]{article}
\usepackage{fontawesome}
%\usepackage{enumitem}
\usepackage{xcolor}
\usepackage{tikz}
\newcommand{\myenum}[4]{
\begin{tikzpicture}
\begin{scope}
\node at (0,0) (bat1) {\textcolor{green}{\faBatteryFull}}node[right=5mm]{#1};
\end{scope}
\begin{scope}[shift={(0,-1)}]
\node at (0,0) (bat2) {\textcolor{orange}{\faBatteryThreeQuarters}}node[right=5mm]{#2};
\end{scope}
\begin{scope}[shift={(0,-2)}]
\node at (0,0) (bat3) {\textcolor{yellow}{\faBatteryHalf}}node[right=5mm]{#3};
\end{scope}
\begin{scope}[shift={(0,-3)}]
\node at (0,0) (bat4) {\textcolor{red}{\faBatteryQuarter}}node[right=5mm]{#4};
\end{scope}
\node at ([yshift=1mm] bat1.north){1};
\node at ([yshift=1mm] bat2.north){2};
\node at ([yshift=1mm] bat3.north){3};
\node at ([yshift=1mm] bat4.north){4};
\end{tikzpicture}
}

\begin{document}
\myenum{First text}
{$a+b$}
{Third text}
{$a=\frac{b^2}{c}$}
\end{document}

在此处输入图片描述

相关内容