I want to input a special character just like ①, but I don't find how to. Can Mathematica make it?
3 Answers
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 *)
FromCharacterCode /@ Range[9451, 9470] (* from \:24eb to \:24ff *)
FromCharacterCode /@ Range[10102, 10131] (* from \:2776 to \:2793 *)
Enclosed letters
FromCharacterCode /@ Range[9398, 9449] (* from to \:24b6 to \:24e9 *)
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.
Generic code:
Graphics[{Circle[], Text[x^2 + y^2 < 1, {0, 0}]}]
Output:
Specific code:
Graphics[{Circle[], Text[1]}, ImageSize -> 24]
Output:
-
$\begingroup$ Thanks for your meaningful answer! but what I want to get is an "Enclosed Alphanumerics", just like what @m_goldberg said $\endgroup$– WangFeiCommented 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$– WangFeiCommented Dec 9, 2015 at 11:40
user31159's solution seems not always working at least on my system,
FromCharacterCode /@ Range[12881, 12895]
shows
I found this solution for numbers below 100
Table[Framed[i, ImageSize -> {25, 25}, Alignment -> Center,
RoundingRadius -> 100], {i, 1, 99}]
which gives
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
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}}]
Inset
orOverlay
. $\endgroup$\: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$