3

I have this MWE

\documentclass[12pt]{article}
\usepackage{mathtools}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[label=\alph*\addtocounter{enumi}{0}]
\item First item.
\item Second item. 
\item Third item. 
\end{enumerate}
\end{document} 

with this output,

enter image description here

I would like to replace the classic letters of the Latin alphabet starting with the letter a as the style taken from the following image

enter image description here

into the label environment [label=\alph*\addtocounter{enumi}{0}].

Thank you for your precious help.

Possible related:

  1. A new and better aesthetic look for figures and captions with vertical braces
  2. Center a rounded square into a green line
Sebastiano
  • 54,118

2 Answers2

5

If you can do without the rounded corners, here is a simple solution:

\documentclass[12pt]{article}
\usepackage{mathtools}
\usepackage{enumitem}
\usepackage[svgnames]{xcolor}

\begin{document}

\begin{enumerate}[label=\colorbox{LightGoldenrod}{\color{white}\alph*}, font=\sffamily\bfseries, before={\fboxsep=5pt}]
\item First item.
\item Second item.
\item Third item.
\end{enumerate}

\end{document}

enter image description here

Bernard
  • 271,350
  • 1
    @Schrödinger'scat Perhaps 'lightweight' would be clearer? – cfr Oct 25 '19 at 02:36
  • @Schrödinger'scat: Usually, I'm referring to beginners who often think solutions are necessarily complex. Furthermore, I think was the first to answer this question – Bernard Oct 25 '19 at 09:16
  • @Schrödinger'scat I always thank you anyway, beautiful or not suitable answers. On my profile you can see my positive votes, which are many. You have to be very grateful when someone is holding out their hand to help you. It seems to me that you are quarreling and I am sad. – Sebastiano Oct 25 '19 at 14:25
  • @Bernard Well, there was no other answer when I posted mine, and the system says mine was there 7 minutes before yours.... Anyway, I will remove my comment, but want to let you know that I do not think users should try to step on each other. –  Oct 25 '19 at 15:50
  • Well, probably you posted while I was typing and I didn't check anyway. Please note I don't step on anyone (and never downvote). At the most, I happened to make the remark that some problem has a solution without a hammersledge like TikZ. – Bernard Oct 25 '19 at 16:05
4

All I did was to combine Jasper's link (which has a friendly reminder that one should use \protect here) with the second of your links to get

\documentclass[12pt]{article}
\usepackage{enumitem}
\usepackage{tikz}
\newcommand{\SebastianoBox}[1]{\tikz[baseline={(B.base)}]{%
\node[fill=green!80!black,text=white,font=\bfseries\sffamily\large,rounded
corners=0.2em,minimum width=1.8em,minimum height=1.8em](B){#1};}}
\begin{document}
\begin{enumerate}[label=\protect\SebastianoBox{\alph*\addtocounter{enumi}{0}}]
\item First item.
\item Second item. 
\item Third item. 
\end{enumerate}
\end{document} 

enter image description here

And here is a smaller version.

\documentclass[12pt]{article}
\usepackage{enumitem}
\usepackage{tikz}
\newcommand{\SebastianoBox}[1]{\tikz[baseline={(B.base)}]{%
\node[fill=green!80!black,text=white,font=\bfseries\sffamily,rounded
corners=0.15em,inner xsep=0.2em,inner ysep=0.1em,align=center,text depth=0.2em,
text height=0.8em,text width=0.8em](B){#1};}}
\begin{document}
\begin{enumerate}[label=\protect\SebastianoBox{\alph*\addtocounter{enumi}{0}}]
\item First item.
\item Second item. 
\item Third item. 
\end{enumerate}
\end{document} 

enter image description here

  • Most kind. I have tried your code. I have decreased the parameters of the 1.8em of the square because for my book they are too big. If I decrease this value I no longer get a square with a font size that is not \large. The green box adapts it to the size of the letters and I have not a square. If you decrease the area of the square, two successive squares are almost close to each other. My best regards. – Sebastiano Oct 25 '19 at 16:21
  • @Sebastiano Could you please tell me to which size you want to decrease it? I’ll fix things as soon as I am back at a computer (once I have the data). –  Oct 25 '19 at 16:30
  • The square should have a fixed size and the bottom side should be in line with the next text. I don't have a favorite size to suggest. The enumeration of each letter, a, b, c should be the same size as the next text but must always remain a square regardless of the letters. There is no hurry. Thank you and have fun. – Sebastiano Oct 25 '19 at 16:34
  • 1
    @Sebastiano I added a proposal, please have a look. –  Oct 25 '19 at 18:06
  • I have seen now. In the future I will try your code. Thank you very much and best regards. – Sebastiano Oct 25 '19 at 18:54