Подтвердить что ты не робот

Как создать символ окружности в Mathematica?

Я знаю, что Framed используется для отображения фрейма вокруг символа, как я могу показать круг вокруг символа?

4b9b3361

Ответ 1

Если вы не возражаете, чтобы настроить параметры выравнивания, вы можете наложить пустой символ круга на символ:

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

circled "x"

Показанный размер шрифта и параметры выравнивания работают для шрифта на моей машине, но вам, возможно, придется настроить их на хорошие результаты на экране. И настройте их снова для достойного распечатки. Следующий Manipulate может помочь в этом процессе:

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

Ответ 2

Вот попытка создать функцию, которая окружает произвольные выражения. Это довольно неуклюжий, но я не могу думать о лучшем способе на данный момент.

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


circled[1/x + y + z]

enter image description here

Ответ 3

Framed может выбрать опцию RoundingRadius.

Framed[expr, RoundingRadius -> radius]

При меньших значениях radius углы рамки просто слегка закруглены, но при больших значениях кадр становится овалом или кругом.

Ответ 4

Такая же идея WReach, но попытка автоколлекции:

cirBeli[x_] := 
 [email protected]
    Style[Overlay[{#, 
       Style[\[EmptyCircle], 
        [email protected] Norm[ImageDimensions[Rasterize[#]][[1 ;; 2]]]]}, 
      Alignment -> Center], "DisplayFormula"] &@x

cirBeli[x]

enter image description here

Ответ 5

Использование Framed [] с RoundingRadius

f = Rasterize[#, "RasterSize"] &;
circledBeli[x_] := Framed[ x,
                    FrameMargins -> ([email protected]@x - Array[1 &, {2, 2}] [email protected])/2,
                    RoundingRadius -> [email protected]@x];

circledBeli[Sin[z^2]/Exp[z] + Integrate[Sin[x] Cos[x] Sqrt[x], x]]

enter image description here

circledBeli["3((1/x+y+z)/h)\n2\nm\np"]

enter image description here

Изменить

С традиционным форматом лучше работать:

f = ImageDimensions[Rasterize[#]][[1 ;; 2]] &;
g = Reverse[ImageDimensions[Rasterize[Rotate[#, Pi/2]]][[1 ;; 2]]] &;
h = Max /@ [email protected]{[email protected]#, [email protected]#} &;
circledBeli[x_] := 
  Framed[x, FrameMargins -> ([email protected]@x - Array[1 &, {2, 2}] [email protected])/2, 
   RoundingRadius -> [email protected]@x];
t = TraditionalForm[Sin[z^2]/Exp[z] + Integrate[Sin[x] Cos[x] Sqrt[x], x]]
circledBeli[t]

enter image description here