Graphics, Figures & Tablesenumerate with circled numbers

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
User avatar
Turkurz
Posts: 31
Joined: Fri Jul 23, 2010 6:36 am

enumerate with circled numbers

Post by Turkurz »

Hello, I have searched this forum and found out, how to circle text. I wish to apply this, to get an enumerate environment with circled numbers.

I specifically wish to use TIKZ and enumitem packages, because they offer the most versatility (perhaps one day, I will want a boxed enumeration with thicker lines and colored background...).

the following MWE doesn't work. How should I fix it?

Code: Select all

\documentclass[12pt]{book}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{enumitem}
\usepackage{tikz}

\newcommand*\circled[1]{\tikz[baseline=(C.base)]\node[draw,circle,inner sep=1.2pt,line width=0.2mm,](C) {\small #1};\!}

\begin{document}    
    \circled{1}
    \begin{enumerate}%[label=\mbox{\textcircled{\tiny\arabic*}}]
                     [label=\circled{\arabic*}]
        \item   bla bla
        \item   bla bla
    \end{enumerate}
\end{document}
The first option in % does work however, though it has far fewer options...
Last edited by Turkurz on Sat Oct 02, 2010 12:23 am, edited 2 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

enumerate with circled numbers

Post by localghost »

I overlooked a detail, but the post shall remain as example for an enumerated list with circled numbers.

Take a look at the »pifont« package from the PSNFSS bundle. See code below for some inspiration.

Code: Select all

\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{pifont}

\begin{document}
  \begin{dingautolist}{192}
    \item First
    \item Second
    \item Third
  \end{dingautolist}
\end{document}
See the bundle manual for details and other options.


Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
User avatar
Turkurz
Posts: 31
Joined: Fri Jul 23, 2010 6:36 am

enumerate with circled numbers

Post by Turkurz »

Yes, I am aware of that solution, but it doesn't allow me to modify geometrically the properties of the circle. Perhaps one day, I will wish to create triangled numbering, or boxed numbering with yellow background and thicker lines.

That's why I wish to have the solution using TikZ package, so I can modify the properties of the circling.

I don't know, what bothers LaTeX, that I can't have TikZ code in enumerate options. Would it be possible to somehow put that little
\newcommand*\circled[1]{\tikz[baseline=(C.base)]\node[draw,circle,inner sep=1.2pt,line width=0.2mm](C) {\small #1};\!}
into the enumerate options?
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

enumerate with circled numbers

Post by gmedina »

Hi, Turkurz

not exactly what you're after, but it could be useful:

Code: Select all

\documentclass[12pt]{book}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{enumitem}
\usepackage{tikz}

\newcommand*\circled[1]{%
  \tikz[baseline=(C.base)]\node[draw,circle,inner sep=1.2pt,line width=0.2mm,](C) {#1};}
\newcommand*\Myitem{%
  \stepcounter{enumi}\item[\circled{\theenumi}]}

\begin{document}    

\begin{enumerate}
  \Myitem   bla bla
  \Myitem   bla bla
\end{enumerate}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
Turkurz
Posts: 31
Joined: Fri Jul 23, 2010 6:36 am

enumerate with circled numbers

Post by Turkurz »

Hmmm, at first sight, It works beautifully, but problems arise, when I put labels on items and then use \ref{}, because it doesn't display the references correctly.

I also tried
\renewcommand*\item
instead of
\newcommand*\Myitem
, but It wouldn't process.

Any suggestions?
ene0815
Posts: 1
Joined: Wed Jan 05, 2011 10:16 am

enumerate with circled numbers

Post by ene0815 »

Hello,

i found a solution to use circled (tikz) numbers in enumeration with enumitem-package. Put the following code into your latex-document or in my case into the lyx-preamble:

Code: Select all

\usepackage{enumitem}
\usepackage{tikz} 
\newcommand*{\numberingI}[1]{%
\footnotesize\protect\tikz[baseline=-3px]%
\protect\node[fill=gray!50,shape=circle,draw,inner sep=1.2pt,line width=0.2mm](n1){#1};}
afterwards use the following code in your document (between \begin{document} and \end{document}):

Code: Select all

\begin{enumerate}[label=\numberingI{\arabic*}]
\item firstItem
\item seconItem
\item and so on
\end{enumerate}
What this does is to surround every number (in this case arabic) with a tikz-circle. I think the usage of \protected did the trick.

Best regards.
Last edited by ene0815 on Thu Jan 06, 2011 9:44 am, edited 3 times in total.
User avatar
Turkurz
Posts: 31
Joined: Fri Jul 23, 2010 6:36 am

Re: enumerate with circled numbers

Post by Turkurz »

Eeexcellent, that's what I was looking for. You're the man.

I would just like to point out, that it would be perhaps good if you removed the "_" symbols (third item), so that LaTeX can process it without errors (it might put some people off, thinking your method doesn't work).

anyway, much appreciated, thank you. greetings from Slovenia


P.S. I can't seem to be able to edit the initial post, in order to mark it as "resolved" (no "edit" button available). What should I do?
Post Reply