# Good way to make \textcircled numbers?

I'm trying to make some good-looking numbers in a circle, using the simple command:

\textcircled{1}


However, the circle is misaligned vertically with the number, and look a bit sloppy:

Any suggestions how can I adjust the vertical alignment so that the numbers look more centered w.r.t to the circles? Or, if that's not an option, what other ways to achieve the same results are possible?

I will use those only for numbers, and in very few places, so manual adjustment per glyph is an option.

I'm using pdfLaTeX with Computer Modern, if that matters.

-
Got two good answers here, for less than 30 minutes (you guys are fast!). I'll probably make a community wiki answer summarizing all options one of these days, maybe some other solutions will come along in the meantime. –  Martin Tapankov Dec 13 '10 at 9:58
I'm sleep-deprived, that's why! –  Jimi Oke Dec 13 '10 at 10:08
What package provides \textcircled? –  Matthew Leingang Dec 13 '10 at 13:08
@Matthew: It seems to be built-in with LaTeX. Works out of the box. –  Martin Tapankov Dec 13 '10 at 13:24
You could use Unicode. U+2460-2473 for 1 to 20, U+24EA for 0, U+3251-325F for 21-35, and U+32B1-32BF for 36-50. –  user41833 Nov 28 '13 at 3:10

Here's a TikZ solution:

\documentclass{article}
\usepackage{tikz}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
\node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
\begin{document}
Numbers aligned with the text:  \circled{1} \circled{2} \circled{3} end.
\end{document}


It's just a node. TikZ options are used to align the base line, to adjust the size and to get the circle shape. You're free to choose further options regarding size or circle thickness (option thick). There's more: for example you could even name the nodes by another argument to connect them by arrows later.

If one like to use it for an enumerated list, for example, it's easy but has to be protected:

\usepackage{enumitem}
...
\begin{enumerate}[label=\protect\circled{\arabic*}]
\item First item
\item Second item
\item Third item
\item Fourth item
\end{enumerate}


-
Ahhh, about time :-) Looks pretty nice indeed. –  Martin Tapankov Dec 13 '10 at 13:27
@Martin: Works fine with enumerate, if protected. I cannot resist to add an example... –  Stefan Kottwitz Dec 13 '10 at 13:32
Sweet example! I have had problems in the past using TikZ examples inline but now I see that is solved by baseline=(char.base). Cool. –  Jimi Oke Dec 13 '10 at 15:36
@Stefan: perhaps you should replace \newcommand by \DeclareRobustCommand, like that the \protect is not needed any more, which is more user friendly. –  Philippe Goutet Dec 13 '10 at 19:28
Then one should use \newcommand to declare an empty command fist and then use \DeclareRobustCommand. That way, an existing command will issue an error. –  Ben Jan 9 '11 at 11:53

I was pleasantly surprised how many people decided to give it a try, and a lot of interesting solutions popped out. As per tradition, this answer will be community wiki and will summarize and compare all suggested solutions.

I hereby suggest three different evaluation criteria, each graded from 1 to 5:

• Simplicity. This is a measure how easy it is to use the proposed solution. Points deducted for using additional packages, or defining anything other than a simple convenience macro.
• Flexibility. This primarily includes how easy is to use this in other contexts, in this case different frame shapes, sizes and thicknesses.
• Accuracy. Simply put, how aesthetically pleasing the solution looks, particularly how well the glyph is centered in the circlce, and how it fits surrounding free-running text.

Here we go:

1. The raisebox solution.

Thanks to Jimi Oke for the fast fingers. This came in first, and is the one that I particularly like for the application I had in mind. It comes as easy as:

\raisebox{.5pt}{\textcircled{\raisebox{-.9pt} {8}}}


Nothing more than that. On the simplicity front, it doesn't get any better than this. Solid 5/5, as no extra packages are needed, and the unwieldy definition can be trivially abstracted in a one-liner \def.

\bye


With XeTeX:

\font\circled="Arial Unicode MS"
{\circled ➀} Didn't occur to me {\circled ➄} earlier that some fonts have {\circled ➇} these.
\bye


Or maybe with TikZ:

\input tikz
baseline ain't so pretty \par
baseline ain't so pretty \par
baseline \tikz \node[circle,draw] {2}; ain't \par
so pretty \tikz[baseline] \node[circle,draw] {2}; baseline \par
ain't so pretty baseline \par
ain't \tikz[inner sep=1pt,baseline=-.75ex] \node[circle,draw] {2}; so pretty \par
baseline \tikz[inner sep=2pt,baseline=-.75ex] \node[circle,draw] {2}; ain't so \par
pretty baseline ain't so \par
pretty \tikz[inner sep=.25ex,baseline=-.75ex] \node[circle,draw] {2}; baseline \par
... actually, now it sorta is \par
baseline ain't so pretty \par
baseline ain't so pretty
\bye


Darn, Stefan beat me to it with a nicer one.

-

with the default picture commands:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pict2e,picture}
\newsavebox\CBox
\newlength\CLength
\def\Circled#1{\sbox\CBox{#1}%
\ifdim\wd\CBox>\ht\CBox \CLength=\wd\CBox\else\CLength=\ht\CBox\fi
\makebox[1.2\CLength]{\makebox(0,1.2\CLength){\put(0,0){\circle{1.2\CLength}}}%
\makebox(0,1.2\CLength){\put(-.5\wd\CBox,0){#1}}}}

\begin{document}
\Huge
foo
\Circled{1}
\Circled{2}
\Circled{ABC}

\end{document}


-

Even easier:

\textcircled{\small{2}}


or

{\large \textcircled{\small 2}}


or

{\Large \textcircled{\normalsize 2}}


(sorry, can't post an image)

-
This might work when the circle is not surrounded by text, and the font size of the number is not an issue -- but I'd rather use one of the other solutions instead. –  Martin Tapankov Jan 10 '11 at 18:31

Firstly, if \circled{1} and \circled{10} are placed together, the two circles will not be the same size, so I added an optional parameter to the \circled command. The optional parameter was regraded as a placeholder to make sure that these circles appear in the same size.

Additionally, since I'd used \ifblank, which is provided by package etoolbox, to check if the optional parameter was provided, I used \robustify to make the command robust. This bypassed the disadvantage of using \DeclearRobustCommand, mentioned by @Stefan in a comment of his answer. Thus, the \protact is no longer needed.

Code:

\documentclass{article}
\usepackage{enumitem}
\usepackage{tikz}
\usepackage{etoolbox}
\newcommand{\circled}[2][]{%
\tikz[baseline=(char.base)]{%
\node[shape = circle, draw, inner sep = 1pt]
(char) {\phantom{\ifblank{#1}{#2}{#1}}};%
\node at (char.center) {\makebox[0pt][c]{#2}};}}
\robustify{\circled}
\begin{document}
\mbox{}\rlap{\rule{.7\linewidth}{.4pt}}%
The original version: \circled{1} and \circled{10}.

\mbox{}\rlap{\rule{.7\linewidth}{.4pt}}%
The improved version: \circled[10]{1} and \circled[10]{10}.

\newcommand{\dcircled}[1]{\circled[00]{#1}}
\begin{enumerate}[label=\dcircled{\arabic*}, noitemsep]
\item I
\item am
\item happy
\item to
\item join
\item with
\item you
\item today
\item in
\item what
\item will
\item go
\item down
\item in
\item history
\item as
\item the
\item greatest
\item demonstration
\item for
\item freedom
\item in
\item the
\item history
\item of
\item our
\item nation.
\end{enumerate}
\end{document}


Result:

-
you know the option minimum size for nodes? –  percusse Dec 20 '14 at 18:13
@percusse Sorry, but I don't understand you. –  Ch'en Meng Dec 21 '14 at 12:30
You can define a minimum size for circle nodes without a box or phantom with uniform size. –  percusse Dec 21 '14 at 12:33
@percusse That's a good suggestion, however, I don't think you understand the idea in my post. I designed this optional parameter to uniform the size of the circles, since different sized circles that are aligned together will give a unfriendly looking. –  Ch'en Meng Dec 23 '14 at 10:04

## protected by Community♦May 25 '14 at 12:58

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.