11

Considering the related questions:

  1. Error fontawesome5 on a specific preamble;
  2. Symbol of the tennis ball

and this new style of fancy enumerate with the tennis balls with this 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}

enter image description here

Question:

how is it possible to put the balls in vertical position below the number?

10

Not really difficult with 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}

enter image description here

  • 2
    After the fifth item, the colors will cycle (unless new ones are added to the constant clist. Of course, it's up to the author to make so that the labels don't overlap. – egreg Jul 28 at 15:15
  • 1
    "Si si come no :-).-) dire non è realmente difficile". For you it's all easy ahahah: easy to say but for me your code is stellar or spatial. I think I'm able to put on the bold and insert \sffamily. Just a curiosity. But if there is little text in the number 6, the tennis balls as are they distributed? Do they invade the number 7 of the enumeration? – Sebastiano Jul 28 at 15:23
  • 3
    @Sebastiano Of course the vertical ball set will overlap the next if there is not sufficient text to cover it. I took this just as a funny exercise, but I wouldn't recommend using it in a book. – egreg Jul 28 at 15:25
  • 1
    I have to use them when I have a lot of text in the book we're doing. 😊 – Sebastiano Jul 28 at 15:33
6

Using \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}

enter image description here

  • It is very interesting :-) using \rotatebox. But there is a problem: the enumeration is not aligned with the start of a new item (paragraph). There is a shift in direction of the top. I have appreciate your work and the effort. – Sebastiano Jul 28 at 11:54
  • This is the right idea, but you need to adjust the \raisebox value proportionally to the number of balls. One idea is create a new length \ballht and then use \setlength{\ballht}{\the\cnt ex} inside \item. Then use \raisebox{-2.7\ballht} instead of \raisebox{-.5em}. The 2.7 value was determined by trial and error. – Alan Munn Jul 28 at 15:11
  • Also, since the balls are now vertical, the conditional inside the \numberlabel definition is no longer needed. – Alan Munn Jul 28 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.