3
$\begingroup$

I want to input a special character just like ①, but I don't find how to. Can Mathematica make it?

$\endgroup$
4
  • $\begingroup$ Hi, take a look at Inset or Overlay. $\endgroup$
    – Kuba
    Commented Dec 7, 2015 at 7:44
  • 4
    $\begingroup$ The Unicode block Enclosed Alphanumerics \:2460 - \:24ff has a selection of such characters that will display circled numbers up to 20 in Mathematica running on OS X and maybe other operating systems as well. $\endgroup$
    – m_goldberg
    Commented Dec 7, 2015 at 12:37
  • $\begingroup$ Thanks! It works on Windows.., and I found that we can modify the font format, size,color, and so on $\endgroup$
    – WangFei
    Commented Dec 8, 2015 at 3:08
  • $\begingroup$ Thanks! but the last one FromCharacterCode[#] & /@ Range[9398, 9449] dosen't seem to work on my Mathematica. $\endgroup$
    – WangFei
    Commented Dec 8, 2015 at 9:11

3 Answers 3

6
$\begingroup$

Follow the integer codes (to be used with FromCharacterCode) and hexadecimal codes (to be used with \:) for enclosed numbers. Although not asked, I added the codes for enclosed letters for completeness.

Enclosed numbers

FromCharacterCode[9450] (* \:24ea *)
FromCharacterCode /@ Range[9312, 9331] (* from \:2460 to \:2473 *)
FromCharacterCode /@ Range[12881, 12895] (* from \:3251 to \:325f *)
FromCharacterCode /@ Range[12977, 12991] (* from \:32b1 to \:32bf *)

enter image description here

FromCharacterCode /@ Range[9451, 9470] (* from \:24eb to \:24ff *)
FromCharacterCode /@ Range[10102, 10131] (* from \:2776 to \:2793 *)

enter image description here

Enclosed letters

FromCharacterCode /@ Range[9398, 9449] (* from to \:24b6 to \:24e9 *)

enter image description here

Remarks

As mentioned by @m_goldberg in his comment, characters may not displayed on some operating systems, and as mentioned by @WangFeiBoy in his comment, the Style of the characters can be modified to some extent.

$\endgroup$
1
$\begingroup$

Generic code:

Graphics[{Circle[], Text[x^2 + y^2 < 1, {0, 0}]}]

Output:

generic example

Specific code:

Graphics[{Circle[], Text[1]}, ImageSize -> 24]

Output:

specific example

Reference:
Graphics
Circle
Text

$\endgroup$
3
  • $\begingroup$ Thanks for your meaningful answer! but what I want to get is an "Enclosed Alphanumerics", just like what @m_goldberg said $\endgroup$
    – WangFei
    Commented Dec 8, 2015 at 3:04
  • $\begingroup$ @WangFeiBoy, I do apologise for not providing the ideal solution. Could you please edit your question to include this requirement? What is the ideal output you are looking for? $\endgroup$ Commented Dec 8, 2015 at 9:35
  • $\begingroup$ Sorry I didn't express that clealy, but I think @Xavier have answered my doubts well. In fact your answer can solve my problem as well, in spite of some inconvenience. $\endgroup$
    – WangFei
    Commented Dec 9, 2015 at 11:40
1
$\begingroup$

user31159's solution seems not always working at least on my system,

FromCharacterCode /@ Range[12881, 12895]

shows

enter image description here

I found this solution for numbers below 100

Table[Framed[i, ImageSize -> {25, 25}, Alignment -> Center, 
  RoundingRadius -> 100], {i, 1, 99}]

which gives

enter image description here

Also no problem for bigger number, but you need a sightly bigger circle!

Table[Framed[i, ImageSize -> {32, 32}, Alignment -> Center, 
  RoundingRadius -> 100], {i, 100, 110}]

gives

enter image description here

Even better, I made a function circledNumber that can control the size of circle and automatically adjust size of number to fit the circle. It only works for integer number smaller than 1000.

circledNumber[int_, size_] := Module[{scale},
   If[int < 100, scale = 0.7, scale = 0.5];
   Framed[Style[int, size*scale], ImageSize -> {size, size}, 
    Alignment -> Center, RoundingRadius -> 100, 
    ContentPadding -> False, FrameMargins -> 0]]

below is an example

Table[circledNumber[i, 
  size], {i, {9, 99, 999}}, {size, {10, 50, 100}}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.