11

I am trying to put \star in a circle so I can use it on my paper. I could not find a proper way to do so. Is there a (simple) way of doing such a custom symbol?

Arszilla
  • 139
  • 2
    welcome to tex.se! $\bigostar$ from MnSymbol? – Zarko Sep 20 '18 at 20:58
  • Oh amazing. I did look through some documentations but did not find that. Thanks! – Arszilla Sep 20 '18 at 21:04
  • i found this symbol in The Comprehensive LATEX Symbol List , page 45. it my sill be on CTAN. try with google ... – Zarko Sep 20 '18 at 21:06
  • 1
    If you load amsmath, which is one of the most standard libraries, you could simply do \textcircled{$\star$} or \textcircled{$*$} . I hope this option will be appended to one of the answers... –  Sep 20 '18 at 22:02

3 Answers3

12

Scaling \bigcirc seems to yield a decent result:

\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}

\makeatletter
\newcommand{\ostar}{\mathbin{\mathpalette\make@circled\star}}
\newcommand{\make@circled}[2]{%
  \ooalign{$\m@th#1\smallbigcirc{#1}$\cr\hidewidth$\m@th#1#2$\hidewidth\cr}%
}
\newcommand{\smallbigcirc}[1]{%
  \vcenter{\hbox{\scalebox{0.77778}{$\m@th#1\bigcirc$}}}%
}
\makeatother

\begin{document}

$x\ostar y$

$x\oplus y$

$\oplus\ostar$

\end{document}

enter image description here

egreg
  • 1,121,712
7

You can use the \stackinset command from stackengine:

\documentclass{article}

\usepackage{stackengine} 
\newcommand\oast{\stackMath\mathbin{\stackinset{c}{0ex}{c}{0ex}{\ast}{\bigcirc}}}

\begin{document}

 $ x \oast y$ 

\end{document} 

enter image description here

Bernard
  • 271,350
6

If you already are using tikz package or if you need other letters, symbols or numbers circled, or even if you want to change style or size in your symbol you can use my solution from here.

Code:

\documentclass{article}

\makeatletter
\usepackage{tikz}
% #1 is a multiplier of fontsize for the minimum diameter of the circle
% #2 is the symbol to be circled.
\newcommand*\circled[2][1.6]{\tikz[baseline=(char.base)]{
    \node[shape=circle, draw, inner sep=1pt, 
        minimum height={\f@size*#1},] (char) {\vphantom{WAH1g}#2};}}
\makeatother

\begin{document}
This is a \circled{*} and a \circled{$\star$} and a \circled{$\ast$}.

This is a \circled[1.2]{*} and a \circled[1.2]{$\star$} and a \circled[1.2]{$\ast$}

This is a \circled[0.8]{*} and a \circled[0.8]{$\star$} and a \circled[0.8]{$\ast$}


\end{document}

Output:

enter image description here

koleygr
  • 20,105
  • You can decrease more the size by removing the \vphantom{WAH1g} command – koleygr Sep 20 '18 at 21:10
  • 1
    And you can remove the calc library, I guess. –  Sep 20 '18 at 21:35
  • Are you confusing the calc library and package? TikZ can do all sorts of calculations without the calc library, such as width("X") which has an analogon (I think it is widthof) in the calc package. –  Sep 20 '18 at 21:38
  • @marmot, I usually use \tikzlibrary calc in coordinate calculations for distances... I have heard for the \widthof{} but never used it before. The calculations here was simple for tikz but I read your message and thought that you mean it is not needed for the other cases I added. (I didn't used that calculation there) – koleygr Sep 20 '18 at 21:55
  • But I did not see any place in your code in which the library calc was used. So I guessed you think it is necessary for some standard thingy. (BTW, I'd use tikz only if I wanted to put an ellipse around more than one star, in which case I'd use the fit library. Here a simple \textcircled{$\star$} \textcircled{$*$} which comes with amsmath will do. No tikz, no stackinset, no MnSymbol... perhaps want to add that to your answer?) –  Sep 20 '18 at 22:01
  • My answer is just a changed copy from the link... I was wandering if the OP needs one of these versions of circled star (because of the anchor) and then realized that he says \star and not star... and this is always centered. I had ready the code just for letters and copied. I think your idea can be an answer and deserve to be a separate (no packages). – koleygr Sep 20 '18 at 22:59
  • 1
    Well, in the other answer, calc is not needed, too. Nor the complicated implementation of minimum size. So perhaps you want to clean up. And no, I am not going to write an answer here. –  Sep 20 '18 at 23:14