Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a circled symbol in Mathematica?

I know that Framed is used to show a frame around a symbol, how can I show a circle around a symbol?

like image 895
Andrew Avatar asked Oct 29 '11 22:10

Andrew


3 Answers

If you don't mind having to micromanage the alignment parameters, you can overlay the empty circle character over a symbol:

TraditionalForm @ Style[
  Overlay[{x, Style[\[EmptyCircle], 24]}, Alignment -> {0.075, 0.16}]
, "DisplayFormula"
]

circled "x"

The exhibited font size and alignment parameters work for the font on my machine, but you may have to tweak them for good results on your screen. And tweak them again for a decent print-out. The following Manipulate can aid in that process:

Manipulate[
  TraditionalForm @ Style[
    Overlay[
      {Style[x, xSize], Style[\[EmptyCircle], circleSize]}
    , Alignment -> {xAlign, yAlign}
    ]
  , "DisplayFormula"
  ]
, {{xSize, 12}, 8, 40, 1, Appearance -> "Labeled"}
, {{circleSize, 24}, 8, 40, 1, Appearance -> "Labeled"}
, {{xAlign, 0.075}, -1, 1, Appearance -> "Labeled"}
, {{yAlign, 0.016}, -1, 1, Appearance -> "Labeled"}
]

image adjustment manipulator

like image 87
WReach Avatar answered Oct 19 '22 10:10

WReach


Here is an attempt to create a function that circles arbitrary expressions. It's rather clumsy, but I cannot think of a better way at the moment.

circled =
    With[{m = Max@Rasterize[#,"RasterSize"]},
       Framed[
         Pane[#, {m, m}, Alignment -> Center],
         RoundingRadius -> 1*^6]
    ] &;


circled[1/x + y + z]

enter image description here

like image 36
Mr.Wizard Avatar answered Oct 19 '22 12:10

Mr.Wizard


Framed can take an option RoundingRadius.

Framed[expr, RoundingRadius -> radius]

At smaller values of radius the corners of the frame are simply slightly rounded, but at larger values, the frame becomes an oval or circle.

like image 31
John Flatness Avatar answered Oct 19 '22 11:10

John Flatness