垂直网球成花式新枚举

垂直网球成花式新枚举

考虑相关问题:

  1. 特定序言中的错误 fontawesome5
  2. 网球的象征

这种新风格的花式网球计数法,使用 MWE,

\documentclass[12pt]{article}
\usepackage{fontawesome5,xcolor,lipsum}
\usepackage{enumitem}
\setlist{nolistsep}
\newcount\cnt
\cnt=1

\newbox\tennis
\setbox\tennis=\hbox{\faBaseballBall}

\def\numberlabel{%
  \ifnum\the\cnt>4\relax
  \else {\bfseries\small\sffamily[\the\cnt]}%
  \fi
}

\def\Iitem{%
  \item[%
    \smash{\raisebox{-.5em}{%
     \vbox{\baselineskip=10pt
      \hbox to \the\wd\tennis{\hss\numberlabel\hss}
      \hbox{%
        \ifnum\the\cnt=1{\color{green}{\faBaseballBall}}
        \else
          \ifnum\the\cnt=2{\color{orange}\faBaseballBall \,\faBaseballBall}
          \else
            \ifnum\the\cnt=3{\color{yellow}\faBaseballBall\,\faBaseballBall\,\faBaseballBall}
            \else
              \ifnum\the\cnt=4{\color{red}\faBaseballBall\,\faBaseballBall\,\faBaseballBall\,\faBaseballBall}
              \else{\sffamily\color{magenta}{\faBaseballBall\,\faBaseballBall\,\faBaseballBall\,\faBaseballBall\,\faBaseballBall}}
              \fi
            \fi
          \fi
        \fi}%
    }}}%
  ]%
  \advance\cnt by 1
}
\begin{document}
\begin{enumerate}
\Iitem \lipsum[1] 
\Iitem \lipsum[1]  
\Iitem \lipsum[1]  
\Iitem \lipsum[1] 
\Iitem \lipsum[1]  
\end{enumerate}
\end{document}

在此处输入图片描述

问题:

如何将球垂直放置在数字下方?

答案1

其实并不难xparse;-)

\documentclass[12pt]{article}
\usepackage{fontawesome5,xcolor,xparse,graphicx}
\usepackage{enumitem}

\usepackage{lipsum}

\setlist{nolistsep}

\ExplSyntaxOn
\NewDocumentCommand{\tennis}{m}
 {
  \sebastiano_tennis:c { c@#1 }
 }
\cs_new_protected:Nn \sebastiano_tennis:N
 {
  \smash
   {
    \begin{tabular}[t]{@{}c@{}}
    [\int_to_arabic:n { #1 }] \\
    \rotatebox[origin=c]{90}{ \__sebastiano_tennis:n { #1 } }
    \end{tabular}
   }
 }
\cs_generate_variant:Nn \sebastiano_tennis:N { c }
\cs_new_protected:Nn \__sebastiano_tennis:n
 {
  \textcolor
   {
    \clist_item:Nn \c_sebastiano_tennis_clist
     {
      \int_mod:nn { #1 } { \clist_count:N \c_sebastiano_tennis_clist } + 1
     }
   }
   {
    \prg_replicate:nn { #1 } { \faBaseballBall }
   }
 }
% make \tennis available to enumitem
\AddEnumerateCounter{\tennis}{\sebastiano_tennis:c}{[1]}
% define here your colors: the first in the list is actually the last used
\clist_const:Nn \c_sebastiano_tennis_clist {magenta,green,orange,yellow,red}
\ExplSyntaxOff

\begin{document}

\begin{enumerate}[label=\tennis*,ref=\arabic*]
\item \lipsum[1][1-7]
\item \lipsum[1][1-7]
\item \lipsum[1][1-7]
\item \lipsum[1][1-7]
\item \lipsum[1][1-7]
\end{enumerate}

\end{document}

在此处输入图片描述

答案2

使用\rotatebox

\documentclass[12pt]{article}
\usepackage{
fontawesome5,
xcolor,lipsum,graphicx}
\usepackage{enumitem}
\setlist{nolistsep}
\newcount\cnt
\cnt=1

\newbox\tennis
\setbox\tennis=\hbox{\faBaseballBall}

\def\numberlabel{%
  \ifnum\the\cnt>4\relax
  \else {\bfseries\small\sffamily[\the\cnt]}%
  \fi
}

\def\Iitem{%
  \item[%
    \smash{\raisebox{-.5em}{%
     \vbox{\baselineskip=10pt
      \hbox to \the\wd\tennis{\hss\numberlabel\hss}
      \hbox{%
        \ifnum\the\cnt=1{\color{green}{\faBaseballBall}}
        \else
          \ifnum\the\cnt=2{\color{orange}\rotatebox{90}{\faBaseballBall \,\faBaseballBall}}
          \else
            \ifnum\the\cnt=3{\color{yellow}\rotatebox{90}{\faBaseballBall\,\faBaseballBall\,\faBaseballBall}}
            \else
              \ifnum\the\cnt=4{\color{red}\rotatebox{90}{\faBaseballBall\,\faBaseballBall\,\faBaseballBall\,\faBaseballBall}}
              \else{\sffamily\color{magenta}\rotatebox{90}{\faBaseballBall\,\faBaseballBall\,\faBaseballBall\,\faBaseballBall\,\faBaseballBall}}
              \fi
            \fi
          \fi
        \fi}%
    }}}%
  ]%
  \advance\cnt by 1
}
\begin{document}
\begin{enumerate}
\Iitem \lipsum[1] 
\Iitem \lipsum[1]  
\Iitem \lipsum[1]  
\Iitem \lipsum[1] 
\Iitem \lipsum[1]  
\end{enumerate}
\end{document}

在此处输入图片描述

相关内容