8

How to make a white number inside a black circle (the picture below)? I want to change numbers inside the black circle, of course. I use Share LaTeX. I have read some articles here but anyone are not what I would like to get. I would like to get this an article (the picture below) - the sixth answer.

Thanks for help.

enter image description here

2 Answers2

7

Created from this answer linked in the question above.

\documentclass{article}
\usepackage{tikz}
\usepackage{xcolor}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
            \node[shape=circle,fill,inner sep=2pt] (char) {\textcolor{white}{#1}};}}

\begin{document}
\circled{1}
\end{document}
P. Siehr
  • 256
  • @P. Siehr: Wouldn't it be a better way to just post a comment on the link to the (already) existing answer instead of just copying it? – CampanIgnis Jun 14 '17 at 13:55
  • @CampanIgnis That might have been better, yes. The problem is, I lack the reputation to create comments ... – P. Siehr Jun 14 '17 at 14:06
6

In what context do you want to use the numbers?

This does work in many situations. Observe that the color of the number and the circle are chosen automatically.

\documentclass{memoir}
\usepackage{tikz}
\newcommand{\ballnumber}[1]{\tikz[baseline=(myanchor.base)] \node[circle,fill=.,inner sep=1pt] (myanchor) {\color{-.}\bfseries\footnotesize #1};}

\begin{document} Earum excepturi inventore necessitatibus aliquid reiciendis enim. \ballnumber{37} Earum excepturi inventore necessitatibus aliquid reiciendis enim. \end{document}

enter image description here


Edit:The question Good way to make \textcircled numbers? is related.

The package https://ctan.org/pkg/circledtext is an alternative.

CampanIgnis
  • 4,624