## LaTeX forum ⇒ Text Formatting ⇒ Add A Symbol Or Box To The Enumerate Counter Topic is solved

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
kurttodoroff
Posts: 12
Joined: Thu Feb 07, 2019 4:25 pm

### Add A Symbol Or Box To The Enumerate Counter

I want to use the Enumerate list environment for 500 items (that will appear in multiple columns, using the multicol package), formatted as follows:

Screen Shot 2019-03-18 at 20.44.59.jpg (17.96 KiB) Viewed 154 times

I want the enumerated list item number to appear in the center of the rounded corner rectangle (vertically and horizontally). I want all rectangles to be the same width, whether the value is 1 (not 001) or 500. I want the rounded corner rectangle to be centered, vertically, on the data that follows it. (This is not the case, in my attachment.)

I have researched a method (with and without the enumitem package) to modify the enumerate counter to appear on top of a symbol or box that resembles the rounded corner rectangle that I want to use. I have not found a solution.

Thank you.

Kurt Todoroff

Stefan Kottwitz
Posts: 9366
Joined: Mon Mar 10, 2008 9:44 pm
Hi Kurt!

Here is a way to display numbers in such a format:

\documentclass{article}\usepackage{tikz}\usetikzlibrary{shapes}\newcommand*\rect[1]{\tikz[baseline=(char.base)]{            \node[shape=rounded rectangle, draw,            inner sep=2pt, minimum width=3em,            fill=blue, text=white, font=\sffamily\bfseries] (char) {#1};}}\begin{document}Test:  \rect{1} \rect{20} \rect{500} baseline aligned.\end{document}

numbers.png (8.87 KiB) Viewed 143 times

Stefan

kurttodoroff
Posts: 12
Joined: Thu Feb 07, 2019 4:25 pm
Hi, Stefan.

You have produced a fine piece of work. My gratitude.

I modified your work, and, I used it to obtain the results that I want.

\newcommand*\rect[1]{\tikz[baseline=(char.base)]{
\node[shape=rounded rectangle, draw,
inner sep=4pt, minimum width=3em,
fill=black, text=white, font=\bfseries] (char) {#1};}}
\newcommand*\rectitem{%
\stepcounter{enumi}\item[\rect{\theenumi}]}

Screen Shot 2019-03-19 at 12.31.43.jpg (39.18 KiB) Viewed 133 times

How can I alter the box geometry to make it resemble a rectangle, that uses small radius corners, instead of using semi-circles at the left and right sides?

Thank you.

Kurt

Stefan Kottwitz
Posts: 9366
Joined: Mon Mar 10, 2008 9:44 pm
Hi,

you can change to rectangle with rounded corners and a value, less maximum width:

\node[shape=rectangle, draw, inner sep=4pt, minimum width=2em, fill=black, text=white, font=\bfseries, rounded corners = 4]

Stefan

kurttodoroff
Posts: 12
Joined: Thu Feb 07, 2019 4:25 pm
Hi, Stefan.

I made a couple of tweaks, and, I am very pleased with the results.

Screen Shot 2019-03-20 at 20.57.19.jpg (25.35 KiB) Viewed 100 times

Again, my gratitude.

Regards,

Kurt