Good way to make textcircled numbers?
I'm trying to make some good-looking numbers in a circle, using the simple command:
textcircled{1}
However, the circle is misaligned vertically with the number, and look a bit sloppy:
Any suggestions how can I adjust the vertical alignment so that the numbers look more centered w.r.t to the circles? Or, if that's not an option, what other ways to achieve the same results are possible?
I will use those only for numbers, and in very few places, so manual adjustment per glyph is an option.
I'm using pdfLaTeX
with Computer Modern, if that matters.
tikz-pgf symbols circles
|
show 2 more comments
I'm trying to make some good-looking numbers in a circle, using the simple command:
textcircled{1}
However, the circle is misaligned vertically with the number, and look a bit sloppy:
Any suggestions how can I adjust the vertical alignment so that the numbers look more centered w.r.t to the circles? Or, if that's not an option, what other ways to achieve the same results are possible?
I will use those only for numbers, and in very few places, so manual adjustment per glyph is an option.
I'm using pdfLaTeX
with Computer Modern, if that matters.
tikz-pgf symbols circles
Got two good answers here, for less than 30 minutes (you guys are fast!). I'll probably make a community wiki answer summarizing all options one of these days, maybe some other solutions will come along in the meantime.
– Martin Tapankov
Dec 13 '10 at 9:58
I'm sleep-deprived, that's why!
– Jimi Oke
Dec 13 '10 at 10:08
1
What package providestextcircled
?
– Matthew Leingang
Dec 13 '10 at 13:08
1
@Matthew: It seems to be built-in with LaTeX. Works out of the box.
– Martin Tapankov
Dec 13 '10 at 13:24
2
You could use Unicode. U+2460-2473 for 1 to 20, U+24EA for 0, U+3251-325F for 21-35, and U+32B1-32BF for 36-50.
– user41833
Nov 28 '13 at 3:10
|
show 2 more comments
I'm trying to make some good-looking numbers in a circle, using the simple command:
textcircled{1}
However, the circle is misaligned vertically with the number, and look a bit sloppy:
Any suggestions how can I adjust the vertical alignment so that the numbers look more centered w.r.t to the circles? Or, if that's not an option, what other ways to achieve the same results are possible?
I will use those only for numbers, and in very few places, so manual adjustment per glyph is an option.
I'm using pdfLaTeX
with Computer Modern, if that matters.
tikz-pgf symbols circles
I'm trying to make some good-looking numbers in a circle, using the simple command:
textcircled{1}
However, the circle is misaligned vertically with the number, and look a bit sloppy:
Any suggestions how can I adjust the vertical alignment so that the numbers look more centered w.r.t to the circles? Or, if that's not an option, what other ways to achieve the same results are possible?
I will use those only for numbers, and in very few places, so manual adjustment per glyph is an option.
I'm using pdfLaTeX
with Computer Modern, if that matters.
tikz-pgf symbols circles
tikz-pgf symbols circles
edited Dec 13 '10 at 13:26
Martin Tapankov
asked Dec 13 '10 at 9:25
Martin TapankovMartin Tapankov
7,570145278
7,570145278
Got two good answers here, for less than 30 minutes (you guys are fast!). I'll probably make a community wiki answer summarizing all options one of these days, maybe some other solutions will come along in the meantime.
– Martin Tapankov
Dec 13 '10 at 9:58
I'm sleep-deprived, that's why!
– Jimi Oke
Dec 13 '10 at 10:08
1
What package providestextcircled
?
– Matthew Leingang
Dec 13 '10 at 13:08
1
@Matthew: It seems to be built-in with LaTeX. Works out of the box.
– Martin Tapankov
Dec 13 '10 at 13:24
2
You could use Unicode. U+2460-2473 for 1 to 20, U+24EA for 0, U+3251-325F for 21-35, and U+32B1-32BF for 36-50.
– user41833
Nov 28 '13 at 3:10
|
show 2 more comments
Got two good answers here, for less than 30 minutes (you guys are fast!). I'll probably make a community wiki answer summarizing all options one of these days, maybe some other solutions will come along in the meantime.
– Martin Tapankov
Dec 13 '10 at 9:58
I'm sleep-deprived, that's why!
– Jimi Oke
Dec 13 '10 at 10:08
1
What package providestextcircled
?
– Matthew Leingang
Dec 13 '10 at 13:08
1
@Matthew: It seems to be built-in with LaTeX. Works out of the box.
– Martin Tapankov
Dec 13 '10 at 13:24
2
You could use Unicode. U+2460-2473 for 1 to 20, U+24EA for 0, U+3251-325F for 21-35, and U+32B1-32BF for 36-50.
– user41833
Nov 28 '13 at 3:10
Got two good answers here, for less than 30 minutes (you guys are fast!). I'll probably make a community wiki answer summarizing all options one of these days, maybe some other solutions will come along in the meantime.
– Martin Tapankov
Dec 13 '10 at 9:58
Got two good answers here, for less than 30 minutes (you guys are fast!). I'll probably make a community wiki answer summarizing all options one of these days, maybe some other solutions will come along in the meantime.
– Martin Tapankov
Dec 13 '10 at 9:58
I'm sleep-deprived, that's why!
– Jimi Oke
Dec 13 '10 at 10:08
I'm sleep-deprived, that's why!
– Jimi Oke
Dec 13 '10 at 10:08
1
1
What package provides
textcircled
?– Matthew Leingang
Dec 13 '10 at 13:08
What package provides
textcircled
?– Matthew Leingang
Dec 13 '10 at 13:08
1
1
@Matthew: It seems to be built-in with LaTeX. Works out of the box.
– Martin Tapankov
Dec 13 '10 at 13:24
@Matthew: It seems to be built-in with LaTeX. Works out of the box.
– Martin Tapankov
Dec 13 '10 at 13:24
2
2
You could use Unicode. U+2460-2473 for 1 to 20, U+24EA for 0, U+3251-325F for 21-35, and U+32B1-32BF for 36-50.
– user41833
Nov 28 '13 at 3:10
You could use Unicode. U+2460-2473 for 1 to 20, U+24EA for 0, U+3251-325F for 21-35, and U+32B1-32BF for 36-50.
– user41833
Nov 28 '13 at 3:10
|
show 2 more comments
13 Answers
13
active
oldest
votes
Here's a TikZ solution:
documentclass{article}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
Numbers aligned with the text: circled{1} circled{2} circled{3} end.
end{document}
It's just a node. TikZ options are used to align the base line, to adjust the size and to get the circle shape. You're free to choose further options regarding size or circle thickness (option thick
). There's more: for example you could even name the nodes by another argument to connect them by arrows later.
If one like to use it for an enumerated list, for example, it's easy but has to be protected:
usepackage{enumitem}
...
begin{enumerate}[label=protectcircled{arabic*}]
item First item
item Second item
item Third item
item Fourth item
end{enumerate}
1
Sweet example! I have had problems in the past using TikZ examples inline but now I see that is solved bybaseline=(char.base)
. Cool.
– Jimi Oke
Dec 13 '10 at 15:36
2
@Stefan: perhaps you should replacenewcommand
byDeclareRobustCommand
, like that theprotect
is not needed any more, which is more user friendly.
– Philippe Goutet
Dec 13 '10 at 19:28
@Philippe: Good idea! One has to be careful though - byDeclareRobustCommand
we could accidentally overwrite an existing command.newcommand
would issue an error in contrary toDeclareRobustCommand
. But I guess, who usesDeclareRobustCommand
knows that. :)
– Stefan Kottwitz♦
Dec 13 '10 at 19:39
1
Then one should use newcommand to declare an empty command fist and then use DeclareRobustCommand. That way, an existing command will issue an error.
– Ben
Jan 9 '11 at 11:53
1
@LuisFelipeVillavicencioLopez Sure! Comments are not the best for code discussions. Perhaps post a new question, or let's talk at the LaTeX Community where I post daily.
– Stefan Kottwitz♦
Sep 24 '15 at 21:29
|
show 7 more comments
I was pleasantly surprised how many people decided to give it a try, and a lot of interesting solutions popped out. As per tradition, this answer will be community wiki and will summarize and compare all suggested solutions.
I hereby suggest three different evaluation criteria, each graded from 1 to 5:
Simplicity. This is a measure how easy it is to use the proposed solution. Points deducted for using additional packages, or defining anything other than a simple convenience macro.
Flexibility. This primarily includes how easy is to use this in other contexts, in this case different frame shapes, sizes and thicknesses.
Accuracy. Simply put, how aesthetically pleasing the solution looks, particularly how well the glyph is centered in the circlce, and how it fits surrounding free-running text.
Here we go:
The
raisebox
solution.
Thanks to Jimi Oke for the fast fingers. This came in first, and is the one that I particularly like for the application I had in mind. It comes as easy as:
raisebox{.5pt}{textcircled{raisebox{-.9pt} {8}}}
Nothing more than that. On the simplicity front, it doesn't get any better than this. Solid 5/5, as no extra packages are needed, and the unwieldy definition can be trivially abstracted in a one-liner
def
.
Flexibiltiy-wise, this solution rates quite low, as you have no control on the circle size or parameters (I'm sure that some TeX hackers would prove me wrong, but for the love of $DEITY, spare us such abominations). 2/5 is well-deserved here. {1}
The accuracy issue is subjective as always, but you'd need to play around with the vertical distances to get it Just Right (tm) for the typeface you have selected. 2/5.
The
ding
-y solution.
This came in from TH. that suggests using some predefined symbol glyphs. The omniscient symbols-a4 document says that The One True Way to do it is to use:
usepackage{pifont}
ding{172}--ding{181} % seriffed fonts
ding{192}--ding{201} % sans-seriffed fonts
Or even the Go board nomenclature:
usepackage{igo}
whitestone{1}--whitestone{99}
On the simplicity side, this rates at 4.5/5, although I'm reluctant to give it a straigt 5 due to the extra packages involved.
This is not flexible at all. If you don't like the glyphs, you're on your own. 1/5.
The glyphs themselves are well-designed, as one should expect, and the numbers are visually well-aligned with the circles. Although if you have a a typeface with a distinct style, the numbers font might not mesh well with the text.
The obligatory
tikz
solution.
Ahh, there's always that, isn't it. This is due to Stefan Kottwitz.
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
Numbers aligned with the text: circled{1} circled{2} circled{3} end.
end{document}
Personally, I'm not into
tikz
(I know, I should learn it one of these days), so going with this would be a one-off use of the package for me, which I'd like to avoid. I can't give more than 2/5 here, but thetikz
fanboiz (and galz!) should bump this up all the way to 4/5.
As far as flexibility is concerned: this is the real deal. Stefan demonstrated even how to use the circled symbols with enumerated lists, of all things. Different frame shapes are certainly possible, with varying degree of fit around the glyph. Indisputable 5/5.
Baseline alignment is top-notch without playing around with some manual adjustments, which is quite nice. The spacing around the symbol looks all right, although in free-running text the circle should preferably have a tighter fit around the number, which can be achieved by playing around with the
inner sep
parameter in the command definition. 5/5 here.
pict2e
/picture
solution
A late addition by Herbert proposes uses some basic primitives from the
picture
andpict2e
packages. Here goes:
usepackage{pict2e,picture}
newsaveboxCBox
newlengthCLength
defCircled#1{sboxCBox{#1}%
ifdimwdCBox>htCBox CLength=wdCBoxelseCLength=htCBoxfi
makebox[1.5CLength]{makebox(0,1.5CLength){put(0,0){circle{1.5CLength}}}%
makebox(0,1.5CLength){put(-.5wdCBox,0){#1}}}}
On the simplicity front, this doesn't rate too well. It looks a bit convoluted, although definitely understandable after studying it, and uses two additional packages. 2/5 is a reasonable score here.
Flexibility is not quite built-in, but is certainly possible. The circle radius can be adjusted, by modifying the
1.5
factor, and the baseline adjustment can be played with. 3.5/5.
As it stands in this definition, the baseline of the surrounding text is tangent to the circle instead of being aligned with the circled number base. This might be desirable in some circumstances, but the numbers look a bit out of place in this way. Better results are achievable with some additional calculations when placing the boxes, and a 3.5/5 is given here to reflect this potential.
The other obligatory
tikz
solution
Matthew Leingang and morbusg tried their hand in this, and while their efforts are certainly appreciated, I feel Stefan's solution is simpler. I am grateful for the effort (and your humbleness), and I upvoted both your answers.
Final score:
Simplicity :raisebox
Flexibility :tikz
Accuracy: tied betweentikz
andding
Overall: tikz
, without hesitation (acclamation from the public, hats thrown, handkerchiefs waved and all that).
Finally, some test code:
documentclass{article}
usepackage{pict2e,picture} % picture
usepackage{tikz} % tikz
usepackage{pifont} % ding
% Picture solution
newsaveboxCBox
newlengthCLength
defnumcircledpict#1{sboxCBox{#1}%
ifdimwdCBox>htCBox CLength=wdCBoxelseCLength=htCBoxfi
makebox[1.5CLength]{makebox(0,1.5CLength){put(0,0){circle{1.5CLength}}}%
makebox(0,1.5CLength){put(-.5wdCBox,0){#1}}}}
% TikZ solution
newcommand*numcircledtikz[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=1.2pt] (char) {#1};}}
% Modified textcircled solution
newcommand*numcircledmod[1]{raisebox{.5pt}{textcircled{raisebox{-.9pt} {#1}}}}
begin{document}
begin{tabular}{l|l}
Original & Lorem textcircled{1} ipsum textcircled{2} dolor \
Modified & Lorem numcircledmod{1} ipsum numcircledmod{2} dolor\
TikZ & Lorem numcircledtikz{1} ipsum numcircledtikz{2} dolor\
Picture & Lorem numcircledpict{1} ipsum numcircledpict{2} dolor\
Ding serif & Lorem ding{172} ipsum ding{173} dolor\
Ding sans & Lorem ding{192} ipsum ding{193} dolor\
end{tabular}
end{document}
{1} If somebody does decide to write such a thing, let me know and I will include it in this answer at no additional cost, but be advised that the post will be subsequently marked textcircled{18+}
to protect the faint of heart.
4
excellent summary, well done! Posts such as this makes this Site worthwhile.
– Yiannis Lazarides
Jan 7 '11 at 18:50
@Yiannis It's been some time since I posted the question, but I only found time just now to polish the summary. I hope it will be of use to people with the same problem.
– Martin Tapankov
Jan 7 '11 at 18:57
1
You say, "The spacing around the symbol looks all right, although in free-running text the circle should preferably have a tighter fit around the number." This is easily fixed by changinginner sep=2pt
toinner sep=1pt
in thecircled
command definition.
– Matt B.
Jan 7 '11 at 20:33
@Matt: Sure -- my intention here was to point out an aesthetic issue, but I guess I wasn't quite clear on that. The info about what needs to be changed is now mentioned in the post. Thanks.
– Martin Tapankov
Jan 7 '11 at 20:46
1
@MartinTapankov The problem is solved with raisebox provided every call is preceded with protect.
– Alexander Serebrenik
Oct 18 '12 at 9:23
|
show 2 more comments
The quickest fix would be to use the raisebox
command. I've played around with it a bit, and it seems lowering the text by 0.9pt puts the figure approximately in the center:
textcircled{raisebox{-0.9pt}{8}}
You could play around with it to get the absolute center but it's definitely between 0.9 and 1pt. I got the idea here. It seems the textcircled
command works best for text! But, anyway, this should solve your problem.
3
That's going to change the baseline of the numbers which might not be desirable. But perhaps with an outerraisebox
to raise the whole circled number, baselines could be maintained.
– TH.
Dec 13 '10 at 9:50
Mais oui! I should have thought of this myself. Thanks! I'll wait a bit for some more suggestions, before I mark this as accepted.
– Martin Tapankov
Dec 13 '10 at 9:53
@TH. True, but that doesn't matter for me -- the numbers do not appear in the free running text, but are rather headers for table columns or used for labelling.
– Martin Tapankov
Dec 13 '10 at 9:55
1
But, actually, thetextcircled
output already has a lower baseline with or without theraisebox
. So, if the author prefers it all flush, then he should go forpifont
. With an outerraisebox
, the maximum is a 0.5pt raise, which gets the circle back to its original position, which is not flush with the text, though. Raising everything beyond 0.5pt begins to shift the number, not the circle, negating initial efforts. Thus, if the author wants a goodtextcircled
, then here's one:raisebox{.5pt}{textcircled{raisebox{-.9pt} {8}} }
. This is actually pretty good.
– Jimi Oke
Dec 13 '10 at 9:59
@Martin: you might also get a TikZ suggestion. ;-)
– Stefan Kottwitz♦
Dec 13 '10 at 13:11
|
show 2 more comments
morbusg already mentioned that some fonts have encircled numbers as Unicode glyphs and showed how to embed them directly. Some fonts provide a more user-friendly interface for accessing the numbers, e.g. Linux Libertine and Junicode. Obviously, this means that we’re deviating from your requirement to use Computer Modern. The advantage of these Unicode numbers presumably is that they were crafted by a font designer, so there shouldn’t be any need for fine-tuning.
Here’s a simple proof-of-concept (You also need to have the junicode
package installed):
documentclass{article}
usepackage{fontspec}
usepackage{libertine}
begin{document}
libertineGlyph{uni2460} libertineGlyph{uni24F5} libertineGlyph{uni2776}
{fontspec[Ligatures=Discretionary]{Junicode}[1] [[1]] <1>}
end{document}
These methods are described in the respective documentations.
Here’s an even more comfortable way of accessing these sets of numbers. The doubly circled numbers are (per Unicode) available from 1 to 10, the others from 0 to 20.
documentclass{article}
usepackage{fontspec}
usepackage{libertine}
usepackage{pgf} % for the calculation
% libcirc and libcircblk display their '0' if the parameter is out of range
newcommand{libcirc}[1]{pgfmathparse{
ifthenelse(#1 > 0 && #1 < 21, Hex(9311+#1), Hex(9450)
}libertineGlyph{unipgfmathresult}}
newcommand{libcircdbl}[1]{pgfmathparse{Hex(9460+#1)}libertineGlyph{unipgfmathresult}}
newcommand{libcircblk}[1]{pgfmathparse{
ifthenelse(#1 > 0 && #1 < 11, Hex(10101+#1),
ifthenelse(#1 > 10 && #1 < 21, Hex(9450-10+#1),
Hex(9471)
)
)
}libertineGlyph{unipgfmathresult}}
newcommand{juncirc}[1]{{fontspec[Ligatures=Discretionary]{Junicode}[#1]}}
newcommand{juncircdbl}[1]{{fontspec[Ligatures=Discretionary]{Junicode}[[#1]]}}
newcommand{juncircblk}[1]{{fontspec[Ligatures=Discretionary]{Junicode}<#1>}}
usepackage{pgffor} % just for the demo loop
setlength{parindent}{0pt} % just for the demo
begin{document}
section{Linux Libertine}
foreach x in {0,...,20} {libcirc{x} }
foreach x in {1,...,10} {libcircdbl{x} }
foreach x in {0,...,20} {libcircblk{x} }
section{fontspec{Junicode}Junicode}
foreach x in {0,...,20} {juncirc{x} }
foreach x in {1,...,10} {juncircdbl{x} }
foreach x in {0,...,20} {juncircblk{x} }
end{document}
3
I think this does not work withpdflatex
.
– Martin Thoma
Dec 18 '13 at 12:19
@moose Yes .. I have to check if the first code bit works with the currentlibertine
at all (but then pdfLaTeX should be fine), the second bit is XeLaTeX/LuaLaTeX only, I should put that in the answer as well.
– doncherry
Dec 18 '13 at 16:18
add a comment |
PGF is overkill for this one application, but if you already have it loaded, you can use it:
documentclass{article}
usepackage{tikz}
newcommand{pgftextcircled}[1]{
setbox0=hbox{#1}%
dimen0wd0%
dividedimen0 by 2%
begin{tikzpicture}[baseline=(a.base)]%
useasboundingbox (-thedimen0,0pt) rectangle (thedimen0,1pt);
node[circle,draw,outer sep=0pt,inner sep=0.1ex] (a) {#1};
end{tikzpicture}
}
newcommand{pangram}{noindent{The textcircled{0} quick textcircled{1} brown textcircled{2} fox textcircled{3} jumps textcircled{4} over textcircled{5} the textcircled{6} lazy textcircled{7} dog.}
}
begin{document}
begin{minipage}{0.5textwidth}
pangram
bigskip
lettextcircled=pgftextcircled
pangram
end{minipage}
end{document}
As you can see there's some extra space around the circles compared to textcircled
but it's not bad.
pre-post edit: I see Stefan and morbusg have beat me to the punch. Oh well.
I think an external process is indeed overkill for something that can be done inside LaTeX. You can just as simply construct it as newcommand{Ring}[1]{raisebox{-1pt}{begin{tabular}{@{}c@{}}{small#1}[-11.5pt]BigCircleend{tabular}}}. Auto-adjustment of the dimensions is left as an exercise to the reader :-)
– Peter Flynn
Aug 6 '11 at 18:41
Peter, what external process?
– u0b34a0f6ae
Apr 3 '13 at 0:53
1
@u0b34a0f6ae: I think Peter is referring to the fact thattikz
uses a bunch ofspecial
commands added after TeX processes the input. So it's “external” to the normal TeX digestion system.
– Matthew Leingang
Apr 23 '13 at 18:47
add a comment |
The mathdesign
package defines figurecircled
which has better spacing for numbers than textcircled
does.
The mathdesign package is incompatible with amsfonts
and amssymb
but if you're using a mathdesign font anyway, that's not a problem.
2
This answer got voted down? Could whoever did this explain why they think this is a bad solution to the problem?
– Seamus
Jan 9 '11 at 11:42
I didn't downvote you but I did get an error with a simple test file. Can you provide a MWE? My error message:! TeX capacity exceeded, sorry [input stack size=5000]. figurecircled ->MDB-cmd figurecircled MDBfigurecircled l.14 ...footnote{of the emergency} $figurecircled {1}$ ! ==> Fatal error occurred, no output PDF file produced!
– Joe Corneli
Jul 3 '17 at 19:34
add a comment |
From symbols.pdf, it looks like pifont
can do what you want with ding{172}
through ding{181}
or ding{192}
through ding{201}
.
Or the igo
package with whitestone{1}
through whitestone{99}
, although that's meant for typesetting Go boards.
It sounds like the solution has been found, but here's a simple comparison.
documentclass{article}
usepackage{pifont}
defX#1{%
#1%
textcircled{#1}%
raisebox{.9pt}{textcircled{raisebox{-.9pt}{#1}}}%
ding{numexpr171+#1relax}%
}
begin{document}
X0X1X2X3X4X5X6X7X8X9
end{document}
This is a great solution. However, the pifonts are rather squished, compared to thetextcircled
output. The pro, though, is the pifonts are flush with the text, which may be a good thing for the author.
– Jimi Oke
Dec 13 '10 at 9:49
@TH: Nice. What does the textcomp package do?
– Jimi Oke
Dec 13 '10 at 10:09
@Jimi: I thought it was required fortextcircled
. I was incorrect. (I was looking at Table 17 of Symbols.pdf and it notes thattextcomp
is required fornewtie
, but I wasn't reading carefully enough.) I've updated the code.
– TH.
Dec 13 '10 at 23:05
add a comment |
@Stefan's answer is good, however, I improved his answer.
Firstly, if circled{1}
and circled{10}
are placed together, the two circles will not be the same size, so I added an optional parameter to the circled
command. The optional parameter was regraded as a placeholder to make sure that these circles appear in the same size.
Additionally, since I'd used ifblank
, which is provided by package etoolbox
, to check if the optional parameter was provided, I used robustify
to make the command robust. This bypassed the disadvantage of using DeclearRobustCommand
, mentioned by @Stefan in a comment of his answer. Thus, the protact
is no longer needed.
Code:
documentclass{article}
usepackage{enumitem}
usepackage{tikz}
usepackage{etoolbox}
newcommand{circled}[2]{%
tikz[baseline=(char.base)]{%
node[shape = circle, draw, inner sep = 1pt]
(char) {phantom{ifblank{#1}{#2}{#1}}};%
node at (char.center) {makebox[0pt][c]{#2}};}}
robustify{circled}
begin{document}
mbox{}rlap{rule{.7linewidth}{.4pt}}%
The original version: circled{1} and circled{10}.
mbox{}rlap{rule{.7linewidth}{.4pt}}%
The improved version: circled[10]{1} and circled[10]{10}.
newcommand{dcircled}[1]{circled[00]{#1}}
begin{enumerate}[label=dcircled{arabic*}, noitemsep]
item I
item am
item happy
item to
item join
item with
item you
item today
item in
item what
item will
item go
item down
item in
item history
item as
item the
item greatest
item demonstration
item for
item freedom
item in
item the
item history
item of
item our
item nation.
end{enumerate}
end{document}
Result:
1
you know the optionminimum size
for nodes?
– percusse
Dec 20 '14 at 18:13
@percusse Sorry, but I don't understand you.
– Ch'en Meng
Dec 21 '14 at 12:30
You can define a minimum size for circle nodes without a box or phantom with uniform size.
– percusse
Dec 21 '14 at 12:33
1
@percusse That's a good suggestion, however, I don't think you understand the idea in my post. I designed this optional parameter to uniform the size of the circles, since different sized circles that are aligned together will give a unfriendly looking.
– Ch'en Meng
Dec 23 '14 at 10:04
add a comment |
with the default picture commands:
documentclass{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{pict2e,picture}
newsaveboxCBox
newlengthCLength
defCircled#1{sboxCBox{#1}%
ifdimwdCBox>htCBox CLength=wdCBoxelseCLength=htCBoxfi
makebox[1.2CLength]{makebox(0,1.2CLength){put(0,0){circle{1.2CLength}}}%
makebox(0,1.2CLength){put(-.5wdCBox,0){#1}}}}
begin{document}
Huge
foo
Circled{1}
Circled{2}
Circled{ABC}
end{document}
add a comment |
With Plain (stumbled upon this by chance and remembered this question):
defcircled#1{{ooalign{hfillower.1exhbox{#1}hfilcrcrOrb}}}
$circled1 circled2 circled3 ldots circled9 quad circled{23}$
bye
With XeTeX:
fontcircled="Arial Unicode MS"
{circled ➀} Didn't occur to me {circled ➄} earlier that some fonts have {circled ➇} these.
bye
Or maybe with TikZ:
input tikz
baseline ain't so pretty par
baseline ain't so pretty par
baseline tikz node[circle,draw] {2}; ain't par
so pretty tikz[baseline] node[circle,draw] {2}; baseline par
ain't so pretty baseline par
ain't tikz[inner sep=1pt,baseline=-.75ex] node[circle,draw] {2}; so pretty par
baseline tikz[inner sep=2pt,baseline=-.75ex] node[circle,draw] {2}; ain't so par
pretty baseline ain't so par
pretty tikz[inner sep=.25ex,baseline=-.75ex] node[circle,draw] {2}; baseline par
... actually, now it sorta is par
baseline ain't so pretty par
baseline ain't so pretty
bye
Darn, Stefan beat me to it with a nicer one.
add a comment |
Even easier:
textcircled{small{2}}
or
{large textcircled{small 2}}
or
{Large textcircled{normalsize 2}}
[ed. Segletes, providing MWE & image]
documentclass{article}
usepackage{enumitem}
begin{document}
begin{enumerate}[label=largeprotecttextcircled{smallarabic*}]
item First item
item Second item
item Third item
item Fourth item
end{enumerate}
textcircled{small{2}}
or
{large textcircled{small 2}}
or
{Large textcircled{normalsize 2}}
end{document}
1
This might work when the circle is not surrounded by text, and the font size of the number is not an issue -- but I'd rather use one of the other solutions instead.
– Martin Tapankov
Jan 10 '11 at 18:31
add a comment |
Here is a pdfliteral
solution. It only works for single numbers.
defcircled#1{%
#1%
pdfliteral{
q .5 w
10 0 0 10 -2.5 3.5 cm .05 w .5 0 m
.5 .276 .276 .5 0 .5 c -.276 .5 -.5 .276 -.5 0 c
-.5 -.276 -.276 -.5 0 -.5 c .276 -.5 .5 -.276 .5 0 c h
S Q
}%
}
circled{1} a
circled{2} b
circled{3} c
circled{10}
bye
Why the coordinate transformations ?
– percusse
Nov 23 '15 at 6:07
@percusse Actually, I just copied code from here and modified it a little. If you can provide any resources to learn more about PDF coding, I would be really happy.
– Henri Menke
Nov 23 '15 at 8:09
1
It is actually PostScript but PDF also supports many graphics objects. So it's a bit cumbersome to understand the set of all operators supported in PDF. But at least to start reading this code you can use the reference guide adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/…. Also in the ISO spec (table 59 in adobe.com/devnet/pdf/pdf_reference.html ) you can recognize the TikZ operators mapped to frontend ;). The initial problem to grasp is setting up the bounding box the rest is usual PS notation.
– percusse
Nov 23 '15 at 8:43
add a comment |
Using pifont package and symbols from ding{172}
to ding{211}
you easily have very excellent circled numbers, but if you want circled numbers bigger than 10 we have a problem. As showed by other stackexchange users here, we can solve the problem if numbers are not too big, but things became hard (complex LaTeX codes) and we can have problems if we are writing inside a text (if the circle became big, LaTeX can be forced to enlarge space between lines, or maybe to overlap circle upon adjacent upper and lower lines): things are a bit simpler if we only want circled number in a itemize list. This lack in flexibility could be in some case bothersome. A reasonable solution seems to use the tcolorbox package: after attempts I found that we simply have to add in preamble this
usepackage{tcolorbox} newcommand{ciao}[1]{{setlengthfboxrule{0pt}fbox{tcbox[colframe=black,colback=white,shrink tight,boxrule=0.5pt,extrude by=1mm]{small #1}}}}
and call in the document the command ciao when we want a "circled" number (example: ciao{12} will "circle" the number 12). By the way, the use of fbox in the preamble line is important because without it, rounded box could protrude out of the line on the left or on the right when they are at the margin of the line: this would be very unaesthetic.
Resuming, I see in this solution 3 pros and 1 cons:
pros: simple code, good working inside a text too, flexibility (big numbers too & in case we can easily play with borders or colors: see 0.5pt or black&white in the preamble line).
cons: we don't have circles but rounded box, but I find this a reasonable compromise.
An example of application of this method is
Quel ramo del lago di Como ciao{1}, che volge a mezzogiorno, tra due catene ciao{20} non interrotte di monti, tutto a seni e a golfi, a seconda dello sporgere e del rientrare di quelli, vien, quasi a un tratto, a restringersi, e a prender corso ciao{252} e figura di fiume, tra un promontorio a destra, e un'ampia costiera dall'altra parte; ciao{3432} e il ponte che ivi congiunge le due rive, par che renda ancor più sensibile all'occhio questa trasformazione, e segni il punto in cui il lago cessa, e l'Adda ricomincia, per ripigliar poi nome di lago dove le rive, allontanandosi di nuovo, lascian l'acqua distendersi e rallentarsi in nuovi golfi e in nuovi seni.
that gives
please note that numbers doesn't protrude and that the space between lines is always the same: no matter if we have a number or not. In short, this almost circled numbers works very well even if they are inside a text.
add a comment |
protected by Community♦ May 25 '14 at 12:58
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
13 Answers
13
active
oldest
votes
13 Answers
13
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here's a TikZ solution:
documentclass{article}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
Numbers aligned with the text: circled{1} circled{2} circled{3} end.
end{document}
It's just a node. TikZ options are used to align the base line, to adjust the size and to get the circle shape. You're free to choose further options regarding size or circle thickness (option thick
). There's more: for example you could even name the nodes by another argument to connect them by arrows later.
If one like to use it for an enumerated list, for example, it's easy but has to be protected:
usepackage{enumitem}
...
begin{enumerate}[label=protectcircled{arabic*}]
item First item
item Second item
item Third item
item Fourth item
end{enumerate}
1
Sweet example! I have had problems in the past using TikZ examples inline but now I see that is solved bybaseline=(char.base)
. Cool.
– Jimi Oke
Dec 13 '10 at 15:36
2
@Stefan: perhaps you should replacenewcommand
byDeclareRobustCommand
, like that theprotect
is not needed any more, which is more user friendly.
– Philippe Goutet
Dec 13 '10 at 19:28
@Philippe: Good idea! One has to be careful though - byDeclareRobustCommand
we could accidentally overwrite an existing command.newcommand
would issue an error in contrary toDeclareRobustCommand
. But I guess, who usesDeclareRobustCommand
knows that. :)
– Stefan Kottwitz♦
Dec 13 '10 at 19:39
1
Then one should use newcommand to declare an empty command fist and then use DeclareRobustCommand. That way, an existing command will issue an error.
– Ben
Jan 9 '11 at 11:53
1
@LuisFelipeVillavicencioLopez Sure! Comments are not the best for code discussions. Perhaps post a new question, or let's talk at the LaTeX Community where I post daily.
– Stefan Kottwitz♦
Sep 24 '15 at 21:29
|
show 7 more comments
Here's a TikZ solution:
documentclass{article}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
Numbers aligned with the text: circled{1} circled{2} circled{3} end.
end{document}
It's just a node. TikZ options are used to align the base line, to adjust the size and to get the circle shape. You're free to choose further options regarding size or circle thickness (option thick
). There's more: for example you could even name the nodes by another argument to connect them by arrows later.
If one like to use it for an enumerated list, for example, it's easy but has to be protected:
usepackage{enumitem}
...
begin{enumerate}[label=protectcircled{arabic*}]
item First item
item Second item
item Third item
item Fourth item
end{enumerate}
1
Sweet example! I have had problems in the past using TikZ examples inline but now I see that is solved bybaseline=(char.base)
. Cool.
– Jimi Oke
Dec 13 '10 at 15:36
2
@Stefan: perhaps you should replacenewcommand
byDeclareRobustCommand
, like that theprotect
is not needed any more, which is more user friendly.
– Philippe Goutet
Dec 13 '10 at 19:28
@Philippe: Good idea! One has to be careful though - byDeclareRobustCommand
we could accidentally overwrite an existing command.newcommand
would issue an error in contrary toDeclareRobustCommand
. But I guess, who usesDeclareRobustCommand
knows that. :)
– Stefan Kottwitz♦
Dec 13 '10 at 19:39
1
Then one should use newcommand to declare an empty command fist and then use DeclareRobustCommand. That way, an existing command will issue an error.
– Ben
Jan 9 '11 at 11:53
1
@LuisFelipeVillavicencioLopez Sure! Comments are not the best for code discussions. Perhaps post a new question, or let's talk at the LaTeX Community where I post daily.
– Stefan Kottwitz♦
Sep 24 '15 at 21:29
|
show 7 more comments
Here's a TikZ solution:
documentclass{article}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
Numbers aligned with the text: circled{1} circled{2} circled{3} end.
end{document}
It's just a node. TikZ options are used to align the base line, to adjust the size and to get the circle shape. You're free to choose further options regarding size or circle thickness (option thick
). There's more: for example you could even name the nodes by another argument to connect them by arrows later.
If one like to use it for an enumerated list, for example, it's easy but has to be protected:
usepackage{enumitem}
...
begin{enumerate}[label=protectcircled{arabic*}]
item First item
item Second item
item Third item
item Fourth item
end{enumerate}
Here's a TikZ solution:
documentclass{article}
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
Numbers aligned with the text: circled{1} circled{2} circled{3} end.
end{document}
It's just a node. TikZ options are used to align the base line, to adjust the size and to get the circle shape. You're free to choose further options regarding size or circle thickness (option thick
). There's more: for example you could even name the nodes by another argument to connect them by arrows later.
If one like to use it for an enumerated list, for example, it's easy but has to be protected:
usepackage{enumitem}
...
begin{enumerate}[label=protectcircled{arabic*}]
item First item
item Second item
item Third item
item Fourth item
end{enumerate}
edited Dec 13 '10 at 13:38
answered Dec 13 '10 at 13:22
Stefan Kottwitz♦Stefan Kottwitz
177k63570759
177k63570759
1
Sweet example! I have had problems in the past using TikZ examples inline but now I see that is solved bybaseline=(char.base)
. Cool.
– Jimi Oke
Dec 13 '10 at 15:36
2
@Stefan: perhaps you should replacenewcommand
byDeclareRobustCommand
, like that theprotect
is not needed any more, which is more user friendly.
– Philippe Goutet
Dec 13 '10 at 19:28
@Philippe: Good idea! One has to be careful though - byDeclareRobustCommand
we could accidentally overwrite an existing command.newcommand
would issue an error in contrary toDeclareRobustCommand
. But I guess, who usesDeclareRobustCommand
knows that. :)
– Stefan Kottwitz♦
Dec 13 '10 at 19:39
1
Then one should use newcommand to declare an empty command fist and then use DeclareRobustCommand. That way, an existing command will issue an error.
– Ben
Jan 9 '11 at 11:53
1
@LuisFelipeVillavicencioLopez Sure! Comments are not the best for code discussions. Perhaps post a new question, or let's talk at the LaTeX Community where I post daily.
– Stefan Kottwitz♦
Sep 24 '15 at 21:29
|
show 7 more comments
1
Sweet example! I have had problems in the past using TikZ examples inline but now I see that is solved bybaseline=(char.base)
. Cool.
– Jimi Oke
Dec 13 '10 at 15:36
2
@Stefan: perhaps you should replacenewcommand
byDeclareRobustCommand
, like that theprotect
is not needed any more, which is more user friendly.
– Philippe Goutet
Dec 13 '10 at 19:28
@Philippe: Good idea! One has to be careful though - byDeclareRobustCommand
we could accidentally overwrite an existing command.newcommand
would issue an error in contrary toDeclareRobustCommand
. But I guess, who usesDeclareRobustCommand
knows that. :)
– Stefan Kottwitz♦
Dec 13 '10 at 19:39
1
Then one should use newcommand to declare an empty command fist and then use DeclareRobustCommand. That way, an existing command will issue an error.
– Ben
Jan 9 '11 at 11:53
1
@LuisFelipeVillavicencioLopez Sure! Comments are not the best for code discussions. Perhaps post a new question, or let's talk at the LaTeX Community where I post daily.
– Stefan Kottwitz♦
Sep 24 '15 at 21:29
1
1
Sweet example! I have had problems in the past using TikZ examples inline but now I see that is solved by
baseline=(char.base)
. Cool.– Jimi Oke
Dec 13 '10 at 15:36
Sweet example! I have had problems in the past using TikZ examples inline but now I see that is solved by
baseline=(char.base)
. Cool.– Jimi Oke
Dec 13 '10 at 15:36
2
2
@Stefan: perhaps you should replace
newcommand
by DeclareRobustCommand
, like that the protect
is not needed any more, which is more user friendly.– Philippe Goutet
Dec 13 '10 at 19:28
@Stefan: perhaps you should replace
newcommand
by DeclareRobustCommand
, like that the protect
is not needed any more, which is more user friendly.– Philippe Goutet
Dec 13 '10 at 19:28
@Philippe: Good idea! One has to be careful though - by
DeclareRobustCommand
we could accidentally overwrite an existing command. newcommand
would issue an error in contrary to DeclareRobustCommand
. But I guess, who uses DeclareRobustCommand
knows that. :)– Stefan Kottwitz♦
Dec 13 '10 at 19:39
@Philippe: Good idea! One has to be careful though - by
DeclareRobustCommand
we could accidentally overwrite an existing command. newcommand
would issue an error in contrary to DeclareRobustCommand
. But I guess, who uses DeclareRobustCommand
knows that. :)– Stefan Kottwitz♦
Dec 13 '10 at 19:39
1
1
Then one should use newcommand to declare an empty command fist and then use DeclareRobustCommand. That way, an existing command will issue an error.
– Ben
Jan 9 '11 at 11:53
Then one should use newcommand to declare an empty command fist and then use DeclareRobustCommand. That way, an existing command will issue an error.
– Ben
Jan 9 '11 at 11:53
1
1
@LuisFelipeVillavicencioLopez Sure! Comments are not the best for code discussions. Perhaps post a new question, or let's talk at the LaTeX Community where I post daily.
– Stefan Kottwitz♦
Sep 24 '15 at 21:29
@LuisFelipeVillavicencioLopez Sure! Comments are not the best for code discussions. Perhaps post a new question, or let's talk at the LaTeX Community where I post daily.
– Stefan Kottwitz♦
Sep 24 '15 at 21:29
|
show 7 more comments
I was pleasantly surprised how many people decided to give it a try, and a lot of interesting solutions popped out. As per tradition, this answer will be community wiki and will summarize and compare all suggested solutions.
I hereby suggest three different evaluation criteria, each graded from 1 to 5:
Simplicity. This is a measure how easy it is to use the proposed solution. Points deducted for using additional packages, or defining anything other than a simple convenience macro.
Flexibility. This primarily includes how easy is to use this in other contexts, in this case different frame shapes, sizes and thicknesses.
Accuracy. Simply put, how aesthetically pleasing the solution looks, particularly how well the glyph is centered in the circlce, and how it fits surrounding free-running text.
Here we go:
The
raisebox
solution.
Thanks to Jimi Oke for the fast fingers. This came in first, and is the one that I particularly like for the application I had in mind. It comes as easy as:
raisebox{.5pt}{textcircled{raisebox{-.9pt} {8}}}
Nothing more than that. On the simplicity front, it doesn't get any better than this. Solid 5/5, as no extra packages are needed, and the unwieldy definition can be trivially abstracted in a one-liner
def
.
Flexibiltiy-wise, this solution rates quite low, as you have no control on the circle size or parameters (I'm sure that some TeX hackers would prove me wrong, but for the love of $DEITY, spare us such abominations). 2/5 is well-deserved here. {1}
The accuracy issue is subjective as always, but you'd need to play around with the vertical distances to get it Just Right (tm) for the typeface you have selected. 2/5.
The
ding
-y solution.
This came in from TH. that suggests using some predefined symbol glyphs. The omniscient symbols-a4 document says that The One True Way to do it is to use:
usepackage{pifont}
ding{172}--ding{181} % seriffed fonts
ding{192}--ding{201} % sans-seriffed fonts
Or even the Go board nomenclature:
usepackage{igo}
whitestone{1}--whitestone{99}
On the simplicity side, this rates at 4.5/5, although I'm reluctant to give it a straigt 5 due to the extra packages involved.
This is not flexible at all. If you don't like the glyphs, you're on your own. 1/5.
The glyphs themselves are well-designed, as one should expect, and the numbers are visually well-aligned with the circles. Although if you have a a typeface with a distinct style, the numbers font might not mesh well with the text.
The obligatory
tikz
solution.
Ahh, there's always that, isn't it. This is due to Stefan Kottwitz.
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
Numbers aligned with the text: circled{1} circled{2} circled{3} end.
end{document}
Personally, I'm not into
tikz
(I know, I should learn it one of these days), so going with this would be a one-off use of the package for me, which I'd like to avoid. I can't give more than 2/5 here, but thetikz
fanboiz (and galz!) should bump this up all the way to 4/5.
As far as flexibility is concerned: this is the real deal. Stefan demonstrated even how to use the circled symbols with enumerated lists, of all things. Different frame shapes are certainly possible, with varying degree of fit around the glyph. Indisputable 5/5.
Baseline alignment is top-notch without playing around with some manual adjustments, which is quite nice. The spacing around the symbol looks all right, although in free-running text the circle should preferably have a tighter fit around the number, which can be achieved by playing around with the
inner sep
parameter in the command definition. 5/5 here.
pict2e
/picture
solution
A late addition by Herbert proposes uses some basic primitives from the
picture
andpict2e
packages. Here goes:
usepackage{pict2e,picture}
newsaveboxCBox
newlengthCLength
defCircled#1{sboxCBox{#1}%
ifdimwdCBox>htCBox CLength=wdCBoxelseCLength=htCBoxfi
makebox[1.5CLength]{makebox(0,1.5CLength){put(0,0){circle{1.5CLength}}}%
makebox(0,1.5CLength){put(-.5wdCBox,0){#1}}}}
On the simplicity front, this doesn't rate too well. It looks a bit convoluted, although definitely understandable after studying it, and uses two additional packages. 2/5 is a reasonable score here.
Flexibility is not quite built-in, but is certainly possible. The circle radius can be adjusted, by modifying the
1.5
factor, and the baseline adjustment can be played with. 3.5/5.
As it stands in this definition, the baseline of the surrounding text is tangent to the circle instead of being aligned with the circled number base. This might be desirable in some circumstances, but the numbers look a bit out of place in this way. Better results are achievable with some additional calculations when placing the boxes, and a 3.5/5 is given here to reflect this potential.
The other obligatory
tikz
solution
Matthew Leingang and morbusg tried their hand in this, and while their efforts are certainly appreciated, I feel Stefan's solution is simpler. I am grateful for the effort (and your humbleness), and I upvoted both your answers.
Final score:
Simplicity :raisebox
Flexibility :tikz
Accuracy: tied betweentikz
andding
Overall: tikz
, without hesitation (acclamation from the public, hats thrown, handkerchiefs waved and all that).
Finally, some test code:
documentclass{article}
usepackage{pict2e,picture} % picture
usepackage{tikz} % tikz
usepackage{pifont} % ding
% Picture solution
newsaveboxCBox
newlengthCLength
defnumcircledpict#1{sboxCBox{#1}%
ifdimwdCBox>htCBox CLength=wdCBoxelseCLength=htCBoxfi
makebox[1.5CLength]{makebox(0,1.5CLength){put(0,0){circle{1.5CLength}}}%
makebox(0,1.5CLength){put(-.5wdCBox,0){#1}}}}
% TikZ solution
newcommand*numcircledtikz[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=1.2pt] (char) {#1};}}
% Modified textcircled solution
newcommand*numcircledmod[1]{raisebox{.5pt}{textcircled{raisebox{-.9pt} {#1}}}}
begin{document}
begin{tabular}{l|l}
Original & Lorem textcircled{1} ipsum textcircled{2} dolor \
Modified & Lorem numcircledmod{1} ipsum numcircledmod{2} dolor\
TikZ & Lorem numcircledtikz{1} ipsum numcircledtikz{2} dolor\
Picture & Lorem numcircledpict{1} ipsum numcircledpict{2} dolor\
Ding serif & Lorem ding{172} ipsum ding{173} dolor\
Ding sans & Lorem ding{192} ipsum ding{193} dolor\
end{tabular}
end{document}
{1} If somebody does decide to write such a thing, let me know and I will include it in this answer at no additional cost, but be advised that the post will be subsequently marked textcircled{18+}
to protect the faint of heart.
4
excellent summary, well done! Posts such as this makes this Site worthwhile.
– Yiannis Lazarides
Jan 7 '11 at 18:50
@Yiannis It's been some time since I posted the question, but I only found time just now to polish the summary. I hope it will be of use to people with the same problem.
– Martin Tapankov
Jan 7 '11 at 18:57
1
You say, "The spacing around the symbol looks all right, although in free-running text the circle should preferably have a tighter fit around the number." This is easily fixed by changinginner sep=2pt
toinner sep=1pt
in thecircled
command definition.
– Matt B.
Jan 7 '11 at 20:33
@Matt: Sure -- my intention here was to point out an aesthetic issue, but I guess I wasn't quite clear on that. The info about what needs to be changed is now mentioned in the post. Thanks.
– Martin Tapankov
Jan 7 '11 at 20:46
1
@MartinTapankov The problem is solved with raisebox provided every call is preceded with protect.
– Alexander Serebrenik
Oct 18 '12 at 9:23
|
show 2 more comments
I was pleasantly surprised how many people decided to give it a try, and a lot of interesting solutions popped out. As per tradition, this answer will be community wiki and will summarize and compare all suggested solutions.
I hereby suggest three different evaluation criteria, each graded from 1 to 5:
Simplicity. This is a measure how easy it is to use the proposed solution. Points deducted for using additional packages, or defining anything other than a simple convenience macro.
Flexibility. This primarily includes how easy is to use this in other contexts, in this case different frame shapes, sizes and thicknesses.
Accuracy. Simply put, how aesthetically pleasing the solution looks, particularly how well the glyph is centered in the circlce, and how it fits surrounding free-running text.
Here we go:
The
raisebox
solution.
Thanks to Jimi Oke for the fast fingers. This came in first, and is the one that I particularly like for the application I had in mind. It comes as easy as:
raisebox{.5pt}{textcircled{raisebox{-.9pt} {8}}}
Nothing more than that. On the simplicity front, it doesn't get any better than this. Solid 5/5, as no extra packages are needed, and the unwieldy definition can be trivially abstracted in a one-liner
def
.
Flexibiltiy-wise, this solution rates quite low, as you have no control on the circle size or parameters (I'm sure that some TeX hackers would prove me wrong, but for the love of $DEITY, spare us such abominations). 2/5 is well-deserved here. {1}
The accuracy issue is subjective as always, but you'd need to play around with the vertical distances to get it Just Right (tm) for the typeface you have selected. 2/5.
The
ding
-y solution.
This came in from TH. that suggests using some predefined symbol glyphs. The omniscient symbols-a4 document says that The One True Way to do it is to use:
usepackage{pifont}
ding{172}--ding{181} % seriffed fonts
ding{192}--ding{201} % sans-seriffed fonts
Or even the Go board nomenclature:
usepackage{igo}
whitestone{1}--whitestone{99}
On the simplicity side, this rates at 4.5/5, although I'm reluctant to give it a straigt 5 due to the extra packages involved.
This is not flexible at all. If you don't like the glyphs, you're on your own. 1/5.
The glyphs themselves are well-designed, as one should expect, and the numbers are visually well-aligned with the circles. Although if you have a a typeface with a distinct style, the numbers font might not mesh well with the text.
The obligatory
tikz
solution.
Ahh, there's always that, isn't it. This is due to Stefan Kottwitz.
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
Numbers aligned with the text: circled{1} circled{2} circled{3} end.
end{document}
Personally, I'm not into
tikz
(I know, I should learn it one of these days), so going with this would be a one-off use of the package for me, which I'd like to avoid. I can't give more than 2/5 here, but thetikz
fanboiz (and galz!) should bump this up all the way to 4/5.
As far as flexibility is concerned: this is the real deal. Stefan demonstrated even how to use the circled symbols with enumerated lists, of all things. Different frame shapes are certainly possible, with varying degree of fit around the glyph. Indisputable 5/5.
Baseline alignment is top-notch without playing around with some manual adjustments, which is quite nice. The spacing around the symbol looks all right, although in free-running text the circle should preferably have a tighter fit around the number, which can be achieved by playing around with the
inner sep
parameter in the command definition. 5/5 here.
pict2e
/picture
solution
A late addition by Herbert proposes uses some basic primitives from the
picture
andpict2e
packages. Here goes:
usepackage{pict2e,picture}
newsaveboxCBox
newlengthCLength
defCircled#1{sboxCBox{#1}%
ifdimwdCBox>htCBox CLength=wdCBoxelseCLength=htCBoxfi
makebox[1.5CLength]{makebox(0,1.5CLength){put(0,0){circle{1.5CLength}}}%
makebox(0,1.5CLength){put(-.5wdCBox,0){#1}}}}
On the simplicity front, this doesn't rate too well. It looks a bit convoluted, although definitely understandable after studying it, and uses two additional packages. 2/5 is a reasonable score here.
Flexibility is not quite built-in, but is certainly possible. The circle radius can be adjusted, by modifying the
1.5
factor, and the baseline adjustment can be played with. 3.5/5.
As it stands in this definition, the baseline of the surrounding text is tangent to the circle instead of being aligned with the circled number base. This might be desirable in some circumstances, but the numbers look a bit out of place in this way. Better results are achievable with some additional calculations when placing the boxes, and a 3.5/5 is given here to reflect this potential.
The other obligatory
tikz
solution
Matthew Leingang and morbusg tried their hand in this, and while their efforts are certainly appreciated, I feel Stefan's solution is simpler. I am grateful for the effort (and your humbleness), and I upvoted both your answers.
Final score:
Simplicity :raisebox
Flexibility :tikz
Accuracy: tied betweentikz
andding
Overall: tikz
, without hesitation (acclamation from the public, hats thrown, handkerchiefs waved and all that).
Finally, some test code:
documentclass{article}
usepackage{pict2e,picture} % picture
usepackage{tikz} % tikz
usepackage{pifont} % ding
% Picture solution
newsaveboxCBox
newlengthCLength
defnumcircledpict#1{sboxCBox{#1}%
ifdimwdCBox>htCBox CLength=wdCBoxelseCLength=htCBoxfi
makebox[1.5CLength]{makebox(0,1.5CLength){put(0,0){circle{1.5CLength}}}%
makebox(0,1.5CLength){put(-.5wdCBox,0){#1}}}}
% TikZ solution
newcommand*numcircledtikz[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=1.2pt] (char) {#1};}}
% Modified textcircled solution
newcommand*numcircledmod[1]{raisebox{.5pt}{textcircled{raisebox{-.9pt} {#1}}}}
begin{document}
begin{tabular}{l|l}
Original & Lorem textcircled{1} ipsum textcircled{2} dolor \
Modified & Lorem numcircledmod{1} ipsum numcircledmod{2} dolor\
TikZ & Lorem numcircledtikz{1} ipsum numcircledtikz{2} dolor\
Picture & Lorem numcircledpict{1} ipsum numcircledpict{2} dolor\
Ding serif & Lorem ding{172} ipsum ding{173} dolor\
Ding sans & Lorem ding{192} ipsum ding{193} dolor\
end{tabular}
end{document}
{1} If somebody does decide to write such a thing, let me know and I will include it in this answer at no additional cost, but be advised that the post will be subsequently marked textcircled{18+}
to protect the faint of heart.
4
excellent summary, well done! Posts such as this makes this Site worthwhile.
– Yiannis Lazarides
Jan 7 '11 at 18:50
@Yiannis It's been some time since I posted the question, but I only found time just now to polish the summary. I hope it will be of use to people with the same problem.
– Martin Tapankov
Jan 7 '11 at 18:57
1
You say, "The spacing around the symbol looks all right, although in free-running text the circle should preferably have a tighter fit around the number." This is easily fixed by changinginner sep=2pt
toinner sep=1pt
in thecircled
command definition.
– Matt B.
Jan 7 '11 at 20:33
@Matt: Sure -- my intention here was to point out an aesthetic issue, but I guess I wasn't quite clear on that. The info about what needs to be changed is now mentioned in the post. Thanks.
– Martin Tapankov
Jan 7 '11 at 20:46
1
@MartinTapankov The problem is solved with raisebox provided every call is preceded with protect.
– Alexander Serebrenik
Oct 18 '12 at 9:23
|
show 2 more comments
I was pleasantly surprised how many people decided to give it a try, and a lot of interesting solutions popped out. As per tradition, this answer will be community wiki and will summarize and compare all suggested solutions.
I hereby suggest three different evaluation criteria, each graded from 1 to 5:
Simplicity. This is a measure how easy it is to use the proposed solution. Points deducted for using additional packages, or defining anything other than a simple convenience macro.
Flexibility. This primarily includes how easy is to use this in other contexts, in this case different frame shapes, sizes and thicknesses.
Accuracy. Simply put, how aesthetically pleasing the solution looks, particularly how well the glyph is centered in the circlce, and how it fits surrounding free-running text.
Here we go:
The
raisebox
solution.
Thanks to Jimi Oke for the fast fingers. This came in first, and is the one that I particularly like for the application I had in mind. It comes as easy as:
raisebox{.5pt}{textcircled{raisebox{-.9pt} {8}}}
Nothing more than that. On the simplicity front, it doesn't get any better than this. Solid 5/5, as no extra packages are needed, and the unwieldy definition can be trivially abstracted in a one-liner
def
.
Flexibiltiy-wise, this solution rates quite low, as you have no control on the circle size or parameters (I'm sure that some TeX hackers would prove me wrong, but for the love of $DEITY, spare us such abominations). 2/5 is well-deserved here. {1}
The accuracy issue is subjective as always, but you'd need to play around with the vertical distances to get it Just Right (tm) for the typeface you have selected. 2/5.
The
ding
-y solution.
This came in from TH. that suggests using some predefined symbol glyphs. The omniscient symbols-a4 document says that The One True Way to do it is to use:
usepackage{pifont}
ding{172}--ding{181} % seriffed fonts
ding{192}--ding{201} % sans-seriffed fonts
Or even the Go board nomenclature:
usepackage{igo}
whitestone{1}--whitestone{99}
On the simplicity side, this rates at 4.5/5, although I'm reluctant to give it a straigt 5 due to the extra packages involved.
This is not flexible at all. If you don't like the glyphs, you're on your own. 1/5.
The glyphs themselves are well-designed, as one should expect, and the numbers are visually well-aligned with the circles. Although if you have a a typeface with a distinct style, the numbers font might not mesh well with the text.
The obligatory
tikz
solution.
Ahh, there's always that, isn't it. This is due to Stefan Kottwitz.
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
Numbers aligned with the text: circled{1} circled{2} circled{3} end.
end{document}
Personally, I'm not into
tikz
(I know, I should learn it one of these days), so going with this would be a one-off use of the package for me, which I'd like to avoid. I can't give more than 2/5 here, but thetikz
fanboiz (and galz!) should bump this up all the way to 4/5.
As far as flexibility is concerned: this is the real deal. Stefan demonstrated even how to use the circled symbols with enumerated lists, of all things. Different frame shapes are certainly possible, with varying degree of fit around the glyph. Indisputable 5/5.
Baseline alignment is top-notch without playing around with some manual adjustments, which is quite nice. The spacing around the symbol looks all right, although in free-running text the circle should preferably have a tighter fit around the number, which can be achieved by playing around with the
inner sep
parameter in the command definition. 5/5 here.
pict2e
/picture
solution
A late addition by Herbert proposes uses some basic primitives from the
picture
andpict2e
packages. Here goes:
usepackage{pict2e,picture}
newsaveboxCBox
newlengthCLength
defCircled#1{sboxCBox{#1}%
ifdimwdCBox>htCBox CLength=wdCBoxelseCLength=htCBoxfi
makebox[1.5CLength]{makebox(0,1.5CLength){put(0,0){circle{1.5CLength}}}%
makebox(0,1.5CLength){put(-.5wdCBox,0){#1}}}}
On the simplicity front, this doesn't rate too well. It looks a bit convoluted, although definitely understandable after studying it, and uses two additional packages. 2/5 is a reasonable score here.
Flexibility is not quite built-in, but is certainly possible. The circle radius can be adjusted, by modifying the
1.5
factor, and the baseline adjustment can be played with. 3.5/5.
As it stands in this definition, the baseline of the surrounding text is tangent to the circle instead of being aligned with the circled number base. This might be desirable in some circumstances, but the numbers look a bit out of place in this way. Better results are achievable with some additional calculations when placing the boxes, and a 3.5/5 is given here to reflect this potential.
The other obligatory
tikz
solution
Matthew Leingang and morbusg tried their hand in this, and while their efforts are certainly appreciated, I feel Stefan's solution is simpler. I am grateful for the effort (and your humbleness), and I upvoted both your answers.
Final score:
Simplicity :raisebox
Flexibility :tikz
Accuracy: tied betweentikz
andding
Overall: tikz
, without hesitation (acclamation from the public, hats thrown, handkerchiefs waved and all that).
Finally, some test code:
documentclass{article}
usepackage{pict2e,picture} % picture
usepackage{tikz} % tikz
usepackage{pifont} % ding
% Picture solution
newsaveboxCBox
newlengthCLength
defnumcircledpict#1{sboxCBox{#1}%
ifdimwdCBox>htCBox CLength=wdCBoxelseCLength=htCBoxfi
makebox[1.5CLength]{makebox(0,1.5CLength){put(0,0){circle{1.5CLength}}}%
makebox(0,1.5CLength){put(-.5wdCBox,0){#1}}}}
% TikZ solution
newcommand*numcircledtikz[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=1.2pt] (char) {#1};}}
% Modified textcircled solution
newcommand*numcircledmod[1]{raisebox{.5pt}{textcircled{raisebox{-.9pt} {#1}}}}
begin{document}
begin{tabular}{l|l}
Original & Lorem textcircled{1} ipsum textcircled{2} dolor \
Modified & Lorem numcircledmod{1} ipsum numcircledmod{2} dolor\
TikZ & Lorem numcircledtikz{1} ipsum numcircledtikz{2} dolor\
Picture & Lorem numcircledpict{1} ipsum numcircledpict{2} dolor\
Ding serif & Lorem ding{172} ipsum ding{173} dolor\
Ding sans & Lorem ding{192} ipsum ding{193} dolor\
end{tabular}
end{document}
{1} If somebody does decide to write such a thing, let me know and I will include it in this answer at no additional cost, but be advised that the post will be subsequently marked textcircled{18+}
to protect the faint of heart.
I was pleasantly surprised how many people decided to give it a try, and a lot of interesting solutions popped out. As per tradition, this answer will be community wiki and will summarize and compare all suggested solutions.
I hereby suggest three different evaluation criteria, each graded from 1 to 5:
Simplicity. This is a measure how easy it is to use the proposed solution. Points deducted for using additional packages, or defining anything other than a simple convenience macro.
Flexibility. This primarily includes how easy is to use this in other contexts, in this case different frame shapes, sizes and thicknesses.
Accuracy. Simply put, how aesthetically pleasing the solution looks, particularly how well the glyph is centered in the circlce, and how it fits surrounding free-running text.
Here we go:
The
raisebox
solution.
Thanks to Jimi Oke for the fast fingers. This came in first, and is the one that I particularly like for the application I had in mind. It comes as easy as:
raisebox{.5pt}{textcircled{raisebox{-.9pt} {8}}}
Nothing more than that. On the simplicity front, it doesn't get any better than this. Solid 5/5, as no extra packages are needed, and the unwieldy definition can be trivially abstracted in a one-liner
def
.
Flexibiltiy-wise, this solution rates quite low, as you have no control on the circle size or parameters (I'm sure that some TeX hackers would prove me wrong, but for the love of $DEITY, spare us such abominations). 2/5 is well-deserved here. {1}
The accuracy issue is subjective as always, but you'd need to play around with the vertical distances to get it Just Right (tm) for the typeface you have selected. 2/5.
The
ding
-y solution.
This came in from TH. that suggests using some predefined symbol glyphs. The omniscient symbols-a4 document says that The One True Way to do it is to use:
usepackage{pifont}
ding{172}--ding{181} % seriffed fonts
ding{192}--ding{201} % sans-seriffed fonts
Or even the Go board nomenclature:
usepackage{igo}
whitestone{1}--whitestone{99}
On the simplicity side, this rates at 4.5/5, although I'm reluctant to give it a straigt 5 due to the extra packages involved.
This is not flexible at all. If you don't like the glyphs, you're on your own. 1/5.
The glyphs themselves are well-designed, as one should expect, and the numbers are visually well-aligned with the circles. Although if you have a a typeface with a distinct style, the numbers font might not mesh well with the text.
The obligatory
tikz
solution.
Ahh, there's always that, isn't it. This is due to Stefan Kottwitz.
usepackage{tikz}
newcommand*circled[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
begin{document}
Numbers aligned with the text: circled{1} circled{2} circled{3} end.
end{document}
Personally, I'm not into
tikz
(I know, I should learn it one of these days), so going with this would be a one-off use of the package for me, which I'd like to avoid. I can't give more than 2/5 here, but thetikz
fanboiz (and galz!) should bump this up all the way to 4/5.
As far as flexibility is concerned: this is the real deal. Stefan demonstrated even how to use the circled symbols with enumerated lists, of all things. Different frame shapes are certainly possible, with varying degree of fit around the glyph. Indisputable 5/5.
Baseline alignment is top-notch without playing around with some manual adjustments, which is quite nice. The spacing around the symbol looks all right, although in free-running text the circle should preferably have a tighter fit around the number, which can be achieved by playing around with the
inner sep
parameter in the command definition. 5/5 here.
pict2e
/picture
solution
A late addition by Herbert proposes uses some basic primitives from the
picture
andpict2e
packages. Here goes:
usepackage{pict2e,picture}
newsaveboxCBox
newlengthCLength
defCircled#1{sboxCBox{#1}%
ifdimwdCBox>htCBox CLength=wdCBoxelseCLength=htCBoxfi
makebox[1.5CLength]{makebox(0,1.5CLength){put(0,0){circle{1.5CLength}}}%
makebox(0,1.5CLength){put(-.5wdCBox,0){#1}}}}
On the simplicity front, this doesn't rate too well. It looks a bit convoluted, although definitely understandable after studying it, and uses two additional packages. 2/5 is a reasonable score here.
Flexibility is not quite built-in, but is certainly possible. The circle radius can be adjusted, by modifying the
1.5
factor, and the baseline adjustment can be played with. 3.5/5.
As it stands in this definition, the baseline of the surrounding text is tangent to the circle instead of being aligned with the circled number base. This might be desirable in some circumstances, but the numbers look a bit out of place in this way. Better results are achievable with some additional calculations when placing the boxes, and a 3.5/5 is given here to reflect this potential.
The other obligatory
tikz
solution
Matthew Leingang and morbusg tried their hand in this, and while their efforts are certainly appreciated, I feel Stefan's solution is simpler. I am grateful for the effort (and your humbleness), and I upvoted both your answers.
Final score:
Simplicity :raisebox
Flexibility :tikz
Accuracy: tied betweentikz
andding
Overall: tikz
, without hesitation (acclamation from the public, hats thrown, handkerchiefs waved and all that).
Finally, some test code:
documentclass{article}
usepackage{pict2e,picture} % picture
usepackage{tikz} % tikz
usepackage{pifont} % ding
% Picture solution
newsaveboxCBox
newlengthCLength
defnumcircledpict#1{sboxCBox{#1}%
ifdimwdCBox>htCBox CLength=wdCBoxelseCLength=htCBoxfi
makebox[1.5CLength]{makebox(0,1.5CLength){put(0,0){circle{1.5CLength}}}%
makebox(0,1.5CLength){put(-.5wdCBox,0){#1}}}}
% TikZ solution
newcommand*numcircledtikz[1]{tikz[baseline=(char.base)]{
node[shape=circle,draw,inner sep=1.2pt] (char) {#1};}}
% Modified textcircled solution
newcommand*numcircledmod[1]{raisebox{.5pt}{textcircled{raisebox{-.9pt} {#1}}}}
begin{document}
begin{tabular}{l|l}
Original & Lorem textcircled{1} ipsum textcircled{2} dolor \
Modified & Lorem numcircledmod{1} ipsum numcircledmod{2} dolor\
TikZ & Lorem numcircledtikz{1} ipsum numcircledtikz{2} dolor\
Picture & Lorem numcircledpict{1} ipsum numcircledpict{2} dolor\
Ding serif & Lorem ding{172} ipsum ding{173} dolor\
Ding sans & Lorem ding{192} ipsum ding{193} dolor\
end{tabular}
end{document}
{1} If somebody does decide to write such a thing, let me know and I will include it in this answer at no additional cost, but be advised that the post will be subsequently marked textcircled{18+}
to protect the faint of heart.
edited Jul 15 '17 at 14:01
community wiki
4 revs, 2 users 97%
Martin Tapankov
4
excellent summary, well done! Posts such as this makes this Site worthwhile.
– Yiannis Lazarides
Jan 7 '11 at 18:50
@Yiannis It's been some time since I posted the question, but I only found time just now to polish the summary. I hope it will be of use to people with the same problem.
– Martin Tapankov
Jan 7 '11 at 18:57
1
You say, "The spacing around the symbol looks all right, although in free-running text the circle should preferably have a tighter fit around the number." This is easily fixed by changinginner sep=2pt
toinner sep=1pt
in thecircled
command definition.
– Matt B.
Jan 7 '11 at 20:33
@Matt: Sure -- my intention here was to point out an aesthetic issue, but I guess I wasn't quite clear on that. The info about what needs to be changed is now mentioned in the post. Thanks.
– Martin Tapankov
Jan 7 '11 at 20:46
1
@MartinTapankov The problem is solved with raisebox provided every call is preceded with protect.
– Alexander Serebrenik
Oct 18 '12 at 9:23
|
show 2 more comments
4
excellent summary, well done! Posts such as this makes this Site worthwhile.
– Yiannis Lazarides
Jan 7 '11 at 18:50
@Yiannis It's been some time since I posted the question, but I only found time just now to polish the summary. I hope it will be of use to people with the same problem.
– Martin Tapankov
Jan 7 '11 at 18:57
1
You say, "The spacing around the symbol looks all right, although in free-running text the circle should preferably have a tighter fit around the number." This is easily fixed by changinginner sep=2pt
toinner sep=1pt
in thecircled
command definition.
– Matt B.
Jan 7 '11 at 20:33
@Matt: Sure -- my intention here was to point out an aesthetic issue, but I guess I wasn't quite clear on that. The info about what needs to be changed is now mentioned in the post. Thanks.
– Martin Tapankov
Jan 7 '11 at 20:46
1
@MartinTapankov The problem is solved with raisebox provided every call is preceded with protect.
– Alexander Serebrenik
Oct 18 '12 at 9:23
4
4
excellent summary, well done! Posts such as this makes this Site worthwhile.
– Yiannis Lazarides
Jan 7 '11 at 18:50
excellent summary, well done! Posts such as this makes this Site worthwhile.
– Yiannis Lazarides
Jan 7 '11 at 18:50
@Yiannis It's been some time since I posted the question, but I only found time just now to polish the summary. I hope it will be of use to people with the same problem.
– Martin Tapankov
Jan 7 '11 at 18:57
@Yiannis It's been some time since I posted the question, but I only found time just now to polish the summary. I hope it will be of use to people with the same problem.
– Martin Tapankov
Jan 7 '11 at 18:57
1
1
You say, "The spacing around the symbol looks all right, although in free-running text the circle should preferably have a tighter fit around the number." This is easily fixed by changing
inner sep=2pt
to inner sep=1pt
in the circled
command definition.– Matt B.
Jan 7 '11 at 20:33
You say, "The spacing around the symbol looks all right, although in free-running text the circle should preferably have a tighter fit around the number." This is easily fixed by changing
inner sep=2pt
to inner sep=1pt
in the circled
command definition.– Matt B.
Jan 7 '11 at 20:33
@Matt: Sure -- my intention here was to point out an aesthetic issue, but I guess I wasn't quite clear on that. The info about what needs to be changed is now mentioned in the post. Thanks.
– Martin Tapankov
Jan 7 '11 at 20:46
@Matt: Sure -- my intention here was to point out an aesthetic issue, but I guess I wasn't quite clear on that. The info about what needs to be changed is now mentioned in the post. Thanks.
– Martin Tapankov
Jan 7 '11 at 20:46
1
1
@MartinTapankov The problem is solved with raisebox provided every call is preceded with protect.
– Alexander Serebrenik
Oct 18 '12 at 9:23
@MartinTapankov The problem is solved with raisebox provided every call is preceded with protect.
– Alexander Serebrenik
Oct 18 '12 at 9:23
|
show 2 more comments
The quickest fix would be to use the raisebox
command. I've played around with it a bit, and it seems lowering the text by 0.9pt puts the figure approximately in the center:
textcircled{raisebox{-0.9pt}{8}}
You could play around with it to get the absolute center but it's definitely between 0.9 and 1pt. I got the idea here. It seems the textcircled
command works best for text! But, anyway, this should solve your problem.
3
That's going to change the baseline of the numbers which might not be desirable. But perhaps with an outerraisebox
to raise the whole circled number, baselines could be maintained.
– TH.
Dec 13 '10 at 9:50
Mais oui! I should have thought of this myself. Thanks! I'll wait a bit for some more suggestions, before I mark this as accepted.
– Martin Tapankov
Dec 13 '10 at 9:53
@TH. True, but that doesn't matter for me -- the numbers do not appear in the free running text, but are rather headers for table columns or used for labelling.
– Martin Tapankov
Dec 13 '10 at 9:55
1
But, actually, thetextcircled
output already has a lower baseline with or without theraisebox
. So, if the author prefers it all flush, then he should go forpifont
. With an outerraisebox
, the maximum is a 0.5pt raise, which gets the circle back to its original position, which is not flush with the text, though. Raising everything beyond 0.5pt begins to shift the number, not the circle, negating initial efforts. Thus, if the author wants a goodtextcircled
, then here's one:raisebox{.5pt}{textcircled{raisebox{-.9pt} {8}} }
. This is actually pretty good.
– Jimi Oke
Dec 13 '10 at 9:59
@Martin: you might also get a TikZ suggestion. ;-)
– Stefan Kottwitz♦
Dec 13 '10 at 13:11
|
show 2 more comments
The quickest fix would be to use the raisebox
command. I've played around with it a bit, and it seems lowering the text by 0.9pt puts the figure approximately in the center:
textcircled{raisebox{-0.9pt}{8}}
You could play around with it to get the absolute center but it's definitely between 0.9 and 1pt. I got the idea here. It seems the textcircled
command works best for text! But, anyway, this should solve your problem.
3
That's going to change the baseline of the numbers which might not be desirable. But perhaps with an outerraisebox
to raise the whole circled number, baselines could be maintained.
– TH.
Dec 13 '10 at 9:50
Mais oui! I should have thought of this myself. Thanks! I'll wait a bit for some more suggestions, before I mark this as accepted.
– Martin Tapankov
Dec 13 '10 at 9:53
@TH. True, but that doesn't matter for me -- the numbers do not appear in the free running text, but are rather headers for table columns or used for labelling.
– Martin Tapankov
Dec 13 '10 at 9:55
1
But, actually, thetextcircled
output already has a lower baseline with or without theraisebox
. So, if the author prefers it all flush, then he should go forpifont
. With an outerraisebox
, the maximum is a 0.5pt raise, which gets the circle back to its original position, which is not flush with the text, though. Raising everything beyond 0.5pt begins to shift the number, not the circle, negating initial efforts. Thus, if the author wants a goodtextcircled
, then here's one:raisebox{.5pt}{textcircled{raisebox{-.9pt} {8}} }
. This is actually pretty good.
– Jimi Oke
Dec 13 '10 at 9:59
@Martin: you might also get a TikZ suggestion. ;-)
– Stefan Kottwitz♦
Dec 13 '10 at 13:11
|
show 2 more comments
The quickest fix would be to use the raisebox
command. I've played around with it a bit, and it seems lowering the text by 0.9pt puts the figure approximately in the center:
textcircled{raisebox{-0.9pt}{8}}
You could play around with it to get the absolute center but it's definitely between 0.9 and 1pt. I got the idea here. It seems the textcircled
command works best for text! But, anyway, this should solve your problem.
The quickest fix would be to use the raisebox
command. I've played around with it a bit, and it seems lowering the text by 0.9pt puts the figure approximately in the center:
textcircled{raisebox{-0.9pt}{8}}
You could play around with it to get the absolute center but it's definitely between 0.9 and 1pt. I got the idea here. It seems the textcircled
command works best for text! But, anyway, this should solve your problem.
answered Dec 13 '10 at 9:45
Jimi OkeJimi Oke
1,61311112
1,61311112
3
That's going to change the baseline of the numbers which might not be desirable. But perhaps with an outerraisebox
to raise the whole circled number, baselines could be maintained.
– TH.
Dec 13 '10 at 9:50
Mais oui! I should have thought of this myself. Thanks! I'll wait a bit for some more suggestions, before I mark this as accepted.
– Martin Tapankov
Dec 13 '10 at 9:53
@TH. True, but that doesn't matter for me -- the numbers do not appear in the free running text, but are rather headers for table columns or used for labelling.
– Martin Tapankov
Dec 13 '10 at 9:55
1
But, actually, thetextcircled
output already has a lower baseline with or without theraisebox
. So, if the author prefers it all flush, then he should go forpifont
. With an outerraisebox
, the maximum is a 0.5pt raise, which gets the circle back to its original position, which is not flush with the text, though. Raising everything beyond 0.5pt begins to shift the number, not the circle, negating initial efforts. Thus, if the author wants a goodtextcircled
, then here's one:raisebox{.5pt}{textcircled{raisebox{-.9pt} {8}} }
. This is actually pretty good.
– Jimi Oke
Dec 13 '10 at 9:59
@Martin: you might also get a TikZ suggestion. ;-)
– Stefan Kottwitz♦
Dec 13 '10 at 13:11
|
show 2 more comments
3
That's going to change the baseline of the numbers which might not be desirable. But perhaps with an outerraisebox
to raise the whole circled number, baselines could be maintained.
– TH.
Dec 13 '10 at 9:50
Mais oui! I should have thought of this myself. Thanks! I'll wait a bit for some more suggestions, before I mark this as accepted.
– Martin Tapankov
Dec 13 '10 at 9:53
@TH. True, but that doesn't matter for me -- the numbers do not appear in the free running text, but are rather headers for table columns or used for labelling.
– Martin Tapankov
Dec 13 '10 at 9:55
1
But, actually, thetextcircled
output already has a lower baseline with or without theraisebox
. So, if the author prefers it all flush, then he should go forpifont
. With an outerraisebox
, the maximum is a 0.5pt raise, which gets the circle back to its original position, which is not flush with the text, though. Raising everything beyond 0.5pt begins to shift the number, not the circle, negating initial efforts. Thus, if the author wants a goodtextcircled
, then here's one:raisebox{.5pt}{textcircled{raisebox{-.9pt} {8}} }
. This is actually pretty good.
– Jimi Oke
Dec 13 '10 at 9:59
@Martin: you might also get a TikZ suggestion. ;-)
– Stefan Kottwitz♦
Dec 13 '10 at 13:11
3
3
That's going to change the baseline of the numbers which might not be desirable. But perhaps with an outer
raisebox
to raise the whole circled number, baselines could be maintained.– TH.
Dec 13 '10 at 9:50
That's going to change the baseline of the numbers which might not be desirable. But perhaps with an outer
raisebox
to raise the whole circled number, baselines could be maintained.– TH.
Dec 13 '10 at 9:50
Mais oui! I should have thought of this myself. Thanks! I'll wait a bit for some more suggestions, before I mark this as accepted.
– Martin Tapankov
Dec 13 '10 at 9:53
Mais oui! I should have thought of this myself. Thanks! I'll wait a bit for some more suggestions, before I mark this as accepted.
– Martin Tapankov
Dec 13 '10 at 9:53
@TH. True, but that doesn't matter for me -- the numbers do not appear in the free running text, but are rather headers for table columns or used for labelling.
– Martin Tapankov
Dec 13 '10 at 9:55
@TH. True, but that doesn't matter for me -- the numbers do not appear in the free running text, but are rather headers for table columns or used for labelling.
– Martin Tapankov
Dec 13 '10 at 9:55
1
1
But, actually, the
textcircled
output already has a lower baseline with or without the raisebox
. So, if the author prefers it all flush, then he should go for pifont
. With an outer raisebox
, the maximum is a 0.5pt raise, which gets the circle back to its original position, which is not flush with the text, though. Raising everything beyond 0.5pt begins to shift the number, not the circle, negating initial efforts. Thus, if the author wants a good textcircled
, then here's one: raisebox{.5pt}{textcircled{raisebox{-.9pt} {8}} }
. This is actually pretty good.– Jimi Oke
Dec 13 '10 at 9:59
But, actually, the
textcircled
output already has a lower baseline with or without the raisebox
. So, if the author prefers it all flush, then he should go for pifont
. With an outer raisebox
, the maximum is a 0.5pt raise, which gets the circle back to its original position, which is not flush with the text, though. Raising everything beyond 0.5pt begins to shift the number, not the circle, negating initial efforts. Thus, if the author wants a good textcircled
, then here's one: raisebox{.5pt}{textcircled{raisebox{-.9pt} {8}} }
. This is actually pretty good.– Jimi Oke
Dec 13 '10 at 9:59
@Martin: you might also get a TikZ suggestion. ;-)
– Stefan Kottwitz♦
Dec 13 '10 at 13:11
@Martin: you might also get a TikZ suggestion. ;-)
– Stefan Kottwitz♦
Dec 13 '10 at 13:11
|
show 2 more comments
morbusg already mentioned that some fonts have encircled numbers as Unicode glyphs and showed how to embed them directly. Some fonts provide a more user-friendly interface for accessing the numbers, e.g. Linux Libertine and Junicode. Obviously, this means that we’re deviating from your requirement to use Computer Modern. The advantage of these Unicode numbers presumably is that they were crafted by a font designer, so there shouldn’t be any need for fine-tuning.
Here’s a simple proof-of-concept (You also need to have the junicode
package installed):
documentclass{article}
usepackage{fontspec}
usepackage{libertine}
begin{document}
libertineGlyph{uni2460} libertineGlyph{uni24F5} libertineGlyph{uni2776}
{fontspec[Ligatures=Discretionary]{Junicode}[1] [[1]] <1>}
end{document}
These methods are described in the respective documentations.
Here’s an even more comfortable way of accessing these sets of numbers. The doubly circled numbers are (per Unicode) available from 1 to 10, the others from 0 to 20.
documentclass{article}
usepackage{fontspec}
usepackage{libertine}
usepackage{pgf} % for the calculation
% libcirc and libcircblk display their '0' if the parameter is out of range
newcommand{libcirc}[1]{pgfmathparse{
ifthenelse(#1 > 0 && #1 < 21, Hex(9311+#1), Hex(9450)
}libertineGlyph{unipgfmathresult}}
newcommand{libcircdbl}[1]{pgfmathparse{Hex(9460+#1)}libertineGlyph{unipgfmathresult}}
newcommand{libcircblk}[1]{pgfmathparse{
ifthenelse(#1 > 0 && #1 < 11, Hex(10101+#1),
ifthenelse(#1 > 10 && #1 < 21, Hex(9450-10+#1),
Hex(9471)
)
)
}libertineGlyph{unipgfmathresult}}
newcommand{juncirc}[1]{{fontspec[Ligatures=Discretionary]{Junicode}[#1]}}
newcommand{juncircdbl}[1]{{fontspec[Ligatures=Discretionary]{Junicode}[[#1]]}}
newcommand{juncircblk}[1]{{fontspec[Ligatures=Discretionary]{Junicode}<#1>}}
usepackage{pgffor} % just for the demo loop
setlength{parindent}{0pt} % just for the demo
begin{document}
section{Linux Libertine}
foreach x in {0,...,20} {libcirc{x} }
foreach x in {1,...,10} {libcircdbl{x} }
foreach x in {0,...,20} {libcircblk{x} }
section{fontspec{Junicode}Junicode}
foreach x in {0,...,20} {juncirc{x} }
foreach x in {1,...,10} {juncircdbl{x} }
foreach x in {0,...,20} {juncircblk{x} }
end{document}
3
I think this does not work withpdflatex
.
– Martin Thoma
Dec 18 '13 at 12:19
@moose Yes .. I have to check if the first code bit works with the currentlibertine
at all (but then pdfLaTeX should be fine), the second bit is XeLaTeX/LuaLaTeX only, I should put that in the answer as well.
– doncherry
Dec 18 '13 at 16:18
add a comment |
morbusg already mentioned that some fonts have encircled numbers as Unicode glyphs and showed how to embed them directly. Some fonts provide a more user-friendly interface for accessing the numbers, e.g. Linux Libertine and Junicode. Obviously, this means that we’re deviating from your requirement to use Computer Modern. The advantage of these Unicode numbers presumably is that they were crafted by a font designer, so there shouldn’t be any need for fine-tuning.
Here’s a simple proof-of-concept (You also need to have the junicode
package installed):
documentclass{article}
usepackage{fontspec}
usepackage{libertine}
begin{document}
libertineGlyph{uni2460} libertineGlyph{uni24F5} libertineGlyph{uni2776}
{fontspec[Ligatures=Discretionary]{Junicode}[1] [[1]] <1>}
end{document}
These methods are described in the respective documentations.
Here’s an even more comfortable way of accessing these sets of numbers. The doubly circled numbers are (per Unicode) available from 1 to 10, the others from 0 to 20.
documentclass{article}
usepackage{fontspec}
usepackage{libertine}
usepackage{pgf} % for the calculation
% libcirc and libcircblk display their '0' if the parameter is out of range
newcommand{libcirc}[1]{pgfmathparse{
ifthenelse(#1 > 0 && #1 < 21, Hex(9311+#1), Hex(9450)
}libertineGlyph{unipgfmathresult}}
newcommand{libcircdbl}[1]{pgfmathparse{Hex(9460+#1)}libertineGlyph{unipgfmathresult}}
newcommand{libcircblk}[1]{pgfmathparse{
ifthenelse(#1 > 0 && #1 < 11, Hex(10101+#1),
ifthenelse(#1 > 10 && #1 < 21, Hex(9450-10+#1),
Hex(9471)
)
)
}libertineGlyph{unipgfmathresult}}
newcommand{juncirc}[1]{{fontspec[Ligatures=Discretionary]{Junicode}[#1]}}
newcommand{juncircdbl}[1]{{fontspec[Ligatures=Discretionary]{Junicode}[[#1]]}}
newcommand{juncircblk}[1]{{fontspec[Ligatures=Discretionary]{Junicode}<#1>}}
usepackage{pgffor} % just for the demo loop
setlength{parindent}{0pt} % just for the demo
begin{document}
section{Linux Libertine}
foreach x in {0,...,20} {libcirc{x} }
foreach x in {1,...,10} {libcircdbl{x} }
foreach x in {0,...,20} {libcircblk{x} }
section{fontspec{Junicode}Junicode}
foreach x in {0,...,20} {juncirc{x} }
foreach x in {1,...,10} {juncircdbl{x} }
foreach x in {0,...,20} {juncircblk{x} }
end{document}
3
I think this does not work withpdflatex
.
– Martin Thoma
Dec 18 '13 at 12:19
@moose Yes .. I have to check if the first code bit works with the currentlibertine
at all (but then pdfLaTeX should be fine), the second bit is XeLaTeX/LuaLaTeX only, I should put that in the answer as well.
– doncherry
Dec 18 '13 at 16:18
add a comment |
morbusg already mentioned that some fonts have encircled numbers as Unicode glyphs and showed how to embed them directly. Some fonts provide a more user-friendly interface for accessing the numbers, e.g. Linux Libertine and Junicode. Obviously, this means that we’re deviating from your requirement to use Computer Modern. The advantage of these Unicode numbers presumably is that they were crafted by a font designer, so there shouldn’t be any need for fine-tuning.
Here’s a simple proof-of-concept (You also need to have the junicode
package installed):
documentclass{article}
usepackage{fontspec}
usepackage{libertine}
begin{document}
libertineGlyph{uni2460} libertineGlyph{uni24F5} libertineGlyph{uni2776}
{fontspec[Ligatures=Discretionary]{Junicode}[1] [[1]] <1>}
end{document}
These methods are described in the respective documentations.
Here’s an even more comfortable way of accessing these sets of numbers. The doubly circled numbers are (per Unicode) available from 1 to 10, the others from 0 to 20.
documentclass{article}
usepackage{fontspec}
usepackage{libertine}
usepackage{pgf} % for the calculation
% libcirc and libcircblk display their '0' if the parameter is out of range
newcommand{libcirc}[1]{pgfmathparse{
ifthenelse(#1 > 0 && #1 < 21, Hex(9311+#1), Hex(9450)
}libertineGlyph{unipgfmathresult}}
newcommand{libcircdbl}[1]{pgfmathparse{Hex(9460+#1)}libertineGlyph{unipgfmathresult}}
newcommand{libcircblk}[1]{pgfmathparse{
ifthenelse(#1 > 0 && #1 < 11, Hex(10101+#1),
ifthenelse(#1 > 10 && #1 < 21, Hex(9450-10+#1),
Hex(9471)
)
)
}libertineGlyph{unipgfmathresult}}
newcommand{juncirc}[1]{{fontspec[Ligatures=Discretionary]{Junicode}[#1]}}
newcommand{juncircdbl}[1]{{fontspec[Ligatures=Discretionary]{Junicode}[[#1]]}}
newcommand{juncircblk}[1]{{fontspec[Ligatures=Discretionary]{Junicode}<#1>}}
usepackage{pgffor} % just for the demo loop
setlength{parindent}{0pt} % just for the demo
begin{document}
section{Linux Libertine}
foreach x in {0,...,20} {libcirc{x} }
foreach x in {1,...,10} {libcircdbl{x} }
foreach x in {0,...,20} {libcircblk{x} }
section{fontspec{Junicode}Junicode}
foreach x in {0,...,20} {juncirc{x} }
foreach x in {1,...,10} {juncircdbl{x} }
foreach x in {0,...,20} {juncircblk{x} }
end{document}
morbusg already mentioned that some fonts have encircled numbers as Unicode glyphs and showed how to embed them directly. Some fonts provide a more user-friendly interface for accessing the numbers, e.g. Linux Libertine and Junicode. Obviously, this means that we’re deviating from your requirement to use Computer Modern. The advantage of these Unicode numbers presumably is that they were crafted by a font designer, so there shouldn’t be any need for fine-tuning.
Here’s a simple proof-of-concept (You also need to have the junicode
package installed):
documentclass{article}
usepackage{fontspec}
usepackage{libertine}
begin{document}
libertineGlyph{uni2460} libertineGlyph{uni24F5} libertineGlyph{uni2776}
{fontspec[Ligatures=Discretionary]{Junicode}[1] [[1]] <1>}
end{document}
These methods are described in the respective documentations.
Here’s an even more comfortable way of accessing these sets of numbers. The doubly circled numbers are (per Unicode) available from 1 to 10, the others from 0 to 20.
documentclass{article}
usepackage{fontspec}
usepackage{libertine}
usepackage{pgf} % for the calculation
% libcirc and libcircblk display their '0' if the parameter is out of range
newcommand{libcirc}[1]{pgfmathparse{
ifthenelse(#1 > 0 && #1 < 21, Hex(9311+#1), Hex(9450)
}libertineGlyph{unipgfmathresult}}
newcommand{libcircdbl}[1]{pgfmathparse{Hex(9460+#1)}libertineGlyph{unipgfmathresult}}
newcommand{libcircblk}[1]{pgfmathparse{
ifthenelse(#1 > 0 && #1 < 11, Hex(10101+#1),
ifthenelse(#1 > 10 && #1 < 21, Hex(9450-10+#1),
Hex(9471)
)
)
}libertineGlyph{unipgfmathresult}}
newcommand{juncirc}[1]{{fontspec[Ligatures=Discretionary]{Junicode}[#1]}}
newcommand{juncircdbl}[1]{{fontspec[Ligatures=Discretionary]{Junicode}[[#1]]}}
newcommand{juncircblk}[1]{{fontspec[Ligatures=Discretionary]{Junicode}<#1>}}
usepackage{pgffor} % just for the demo loop
setlength{parindent}{0pt} % just for the demo
begin{document}
section{Linux Libertine}
foreach x in {0,...,20} {libcirc{x} }
foreach x in {1,...,10} {libcircdbl{x} }
foreach x in {0,...,20} {libcircblk{x} }
section{fontspec{Junicode}Junicode}
foreach x in {0,...,20} {juncirc{x} }
foreach x in {1,...,10} {juncircdbl{x} }
foreach x in {0,...,20} {juncircblk{x} }
end{document}
edited Apr 13 '17 at 12:36
Community♦
1
1
answered Jan 9 '13 at 18:51
doncherrydoncherry
35k23135208
35k23135208
3
I think this does not work withpdflatex
.
– Martin Thoma
Dec 18 '13 at 12:19
@moose Yes .. I have to check if the first code bit works with the currentlibertine
at all (but then pdfLaTeX should be fine), the second bit is XeLaTeX/LuaLaTeX only, I should put that in the answer as well.
– doncherry
Dec 18 '13 at 16:18
add a comment |
3
I think this does not work withpdflatex
.
– Martin Thoma
Dec 18 '13 at 12:19
@moose Yes .. I have to check if the first code bit works with the currentlibertine
at all (but then pdfLaTeX should be fine), the second bit is XeLaTeX/LuaLaTeX only, I should put that in the answer as well.
– doncherry
Dec 18 '13 at 16:18
3
3
I think this does not work with
pdflatex
.– Martin Thoma
Dec 18 '13 at 12:19
I think this does not work with
pdflatex
.– Martin Thoma
Dec 18 '13 at 12:19
@moose Yes .. I have to check if the first code bit works with the current
libertine
at all (but then pdfLaTeX should be fine), the second bit is XeLaTeX/LuaLaTeX only, I should put that in the answer as well.– doncherry
Dec 18 '13 at 16:18
@moose Yes .. I have to check if the first code bit works with the current
libertine
at all (but then pdfLaTeX should be fine), the second bit is XeLaTeX/LuaLaTeX only, I should put that in the answer as well.– doncherry
Dec 18 '13 at 16:18
add a comment |
PGF is overkill for this one application, but if you already have it loaded, you can use it:
documentclass{article}
usepackage{tikz}
newcommand{pgftextcircled}[1]{
setbox0=hbox{#1}%
dimen0wd0%
dividedimen0 by 2%
begin{tikzpicture}[baseline=(a.base)]%
useasboundingbox (-thedimen0,0pt) rectangle (thedimen0,1pt);
node[circle,draw,outer sep=0pt,inner sep=0.1ex] (a) {#1};
end{tikzpicture}
}
newcommand{pangram}{noindent{The textcircled{0} quick textcircled{1} brown textcircled{2} fox textcircled{3} jumps textcircled{4} over textcircled{5} the textcircled{6} lazy textcircled{7} dog.}
}
begin{document}
begin{minipage}{0.5textwidth}
pangram
bigskip
lettextcircled=pgftextcircled
pangram
end{minipage}
end{document}
As you can see there's some extra space around the circles compared to textcircled
but it's not bad.
pre-post edit: I see Stefan and morbusg have beat me to the punch. Oh well.
I think an external process is indeed overkill for something that can be done inside LaTeX. You can just as simply construct it as newcommand{Ring}[1]{raisebox{-1pt}{begin{tabular}{@{}c@{}}{small#1}[-11.5pt]BigCircleend{tabular}}}. Auto-adjustment of the dimensions is left as an exercise to the reader :-)
– Peter Flynn
Aug 6 '11 at 18:41
Peter, what external process?
– u0b34a0f6ae
Apr 3 '13 at 0:53
1
@u0b34a0f6ae: I think Peter is referring to the fact thattikz
uses a bunch ofspecial
commands added after TeX processes the input. So it's “external” to the normal TeX digestion system.
– Matthew Leingang
Apr 23 '13 at 18:47
add a comment |
PGF is overkill for this one application, but if you already have it loaded, you can use it:
documentclass{article}
usepackage{tikz}
newcommand{pgftextcircled}[1]{
setbox0=hbox{#1}%
dimen0wd0%
dividedimen0 by 2%
begin{tikzpicture}[baseline=(a.base)]%
useasboundingbox (-thedimen0,0pt) rectangle (thedimen0,1pt);
node[circle,draw,outer sep=0pt,inner sep=0.1ex] (a) {#1};
end{tikzpicture}
}
newcommand{pangram}{noindent{The textcircled{0} quick textcircled{1} brown textcircled{2} fox textcircled{3} jumps textcircled{4} over textcircled{5} the textcircled{6} lazy textcircled{7} dog.}
}
begin{document}
begin{minipage}{0.5textwidth}
pangram
bigskip
lettextcircled=pgftextcircled
pangram
end{minipage}
end{document}
As you can see there's some extra space around the circles compared to textcircled
but it's not bad.
pre-post edit: I see Stefan and morbusg have beat me to the punch. Oh well.
I think an external process is indeed overkill for something that can be done inside LaTeX. You can just as simply construct it as newcommand{Ring}[1]{raisebox{-1pt}{begin{tabular}{@{}c@{}}{small#1}[-11.5pt]BigCircleend{tabular}}}. Auto-adjustment of the dimensions is left as an exercise to the reader :-)
– Peter Flynn
Aug 6 '11 at 18:41
Peter, what external process?
– u0b34a0f6ae
Apr 3 '13 at 0:53
1
@u0b34a0f6ae: I think Peter is referring to the fact thattikz
uses a bunch ofspecial
commands added after TeX processes the input. So it's “external” to the normal TeX digestion system.
– Matthew Leingang
Apr 23 '13 at 18:47
add a comment |
PGF is overkill for this one application, but if you already have it loaded, you can use it:
documentclass{article}
usepackage{tikz}
newcommand{pgftextcircled}[1]{
setbox0=hbox{#1}%
dimen0wd0%
dividedimen0 by 2%
begin{tikzpicture}[baseline=(a.base)]%
useasboundingbox (-thedimen0,0pt) rectangle (thedimen0,1pt);
node[circle,draw,outer sep=0pt,inner sep=0.1ex] (a) {#1};
end{tikzpicture}
}
newcommand{pangram}{noindent{The textcircled{0} quick textcircled{1} brown textcircled{2} fox textcircled{3} jumps textcircled{4} over textcircled{5} the textcircled{6} lazy textcircled{7} dog.}
}
begin{document}
begin{minipage}{0.5textwidth}
pangram
bigskip
lettextcircled=pgftextcircled
pangram
end{minipage}
end{document}
As you can see there's some extra space around the circles compared to textcircled
but it's not bad.
pre-post edit: I see Stefan and morbusg have beat me to the punch. Oh well.
PGF is overkill for this one application, but if you already have it loaded, you can use it:
documentclass{article}
usepackage{tikz}
newcommand{pgftextcircled}[1]{
setbox0=hbox{#1}%
dimen0wd0%
dividedimen0 by 2%
begin{tikzpicture}[baseline=(a.base)]%
useasboundingbox (-thedimen0,0pt) rectangle (thedimen0,1pt);
node[circle,draw,outer sep=0pt,inner sep=0.1ex] (a) {#1};
end{tikzpicture}
}
newcommand{pangram}{noindent{The textcircled{0} quick textcircled{1} brown textcircled{2} fox textcircled{3} jumps textcircled{4} over textcircled{5} the textcircled{6} lazy textcircled{7} dog.}
}
begin{document}
begin{minipage}{0.5textwidth}
pangram
bigskip
lettextcircled=pgftextcircled
pangram
end{minipage}
end{document}
As you can see there's some extra space around the circles compared to textcircled
but it's not bad.
pre-post edit: I see Stefan and morbusg have beat me to the punch. Oh well.
answered Dec 13 '10 at 13:41
Matthew LeingangMatthew Leingang
35.1k10106177
35.1k10106177
I think an external process is indeed overkill for something that can be done inside LaTeX. You can just as simply construct it as newcommand{Ring}[1]{raisebox{-1pt}{begin{tabular}{@{}c@{}}{small#1}[-11.5pt]BigCircleend{tabular}}}. Auto-adjustment of the dimensions is left as an exercise to the reader :-)
– Peter Flynn
Aug 6 '11 at 18:41
Peter, what external process?
– u0b34a0f6ae
Apr 3 '13 at 0:53
1
@u0b34a0f6ae: I think Peter is referring to the fact thattikz
uses a bunch ofspecial
commands added after TeX processes the input. So it's “external” to the normal TeX digestion system.
– Matthew Leingang
Apr 23 '13 at 18:47
add a comment |
I think an external process is indeed overkill for something that can be done inside LaTeX. You can just as simply construct it as newcommand{Ring}[1]{raisebox{-1pt}{begin{tabular}{@{}c@{}}{small#1}[-11.5pt]BigCircleend{tabular}}}. Auto-adjustment of the dimensions is left as an exercise to the reader :-)
– Peter Flynn
Aug 6 '11 at 18:41
Peter, what external process?
– u0b34a0f6ae
Apr 3 '13 at 0:53
1
@u0b34a0f6ae: I think Peter is referring to the fact thattikz
uses a bunch ofspecial
commands added after TeX processes the input. So it's “external” to the normal TeX digestion system.
– Matthew Leingang
Apr 23 '13 at 18:47
I think an external process is indeed overkill for something that can be done inside LaTeX. You can just as simply construct it as newcommand{Ring}[1]{raisebox{-1pt}{begin{tabular}{@{}c@{}}{small#1}[-11.5pt]BigCircleend{tabular}}}. Auto-adjustment of the dimensions is left as an exercise to the reader :-)
– Peter Flynn
Aug 6 '11 at 18:41
I think an external process is indeed overkill for something that can be done inside LaTeX. You can just as simply construct it as newcommand{Ring}[1]{raisebox{-1pt}{begin{tabular}{@{}c@{}}{small#1}[-11.5pt]BigCircleend{tabular}}}. Auto-adjustment of the dimensions is left as an exercise to the reader :-)
– Peter Flynn
Aug 6 '11 at 18:41
Peter, what external process?
– u0b34a0f6ae
Apr 3 '13 at 0:53
Peter, what external process?
– u0b34a0f6ae
Apr 3 '13 at 0:53
1
1
@u0b34a0f6ae: I think Peter is referring to the fact that
tikz
uses a bunch of special
commands added after TeX processes the input. So it's “external” to the normal TeX digestion system.– Matthew Leingang
Apr 23 '13 at 18:47
@u0b34a0f6ae: I think Peter is referring to the fact that
tikz
uses a bunch of special
commands added after TeX processes the input. So it's “external” to the normal TeX digestion system.– Matthew Leingang
Apr 23 '13 at 18:47
add a comment |
The mathdesign
package defines figurecircled
which has better spacing for numbers than textcircled
does.
The mathdesign package is incompatible with amsfonts
and amssymb
but if you're using a mathdesign font anyway, that's not a problem.
2
This answer got voted down? Could whoever did this explain why they think this is a bad solution to the problem?
– Seamus
Jan 9 '11 at 11:42
I didn't downvote you but I did get an error with a simple test file. Can you provide a MWE? My error message:! TeX capacity exceeded, sorry [input stack size=5000]. figurecircled ->MDB-cmd figurecircled MDBfigurecircled l.14 ...footnote{of the emergency} $figurecircled {1}$ ! ==> Fatal error occurred, no output PDF file produced!
– Joe Corneli
Jul 3 '17 at 19:34
add a comment |
The mathdesign
package defines figurecircled
which has better spacing for numbers than textcircled
does.
The mathdesign package is incompatible with amsfonts
and amssymb
but if you're using a mathdesign font anyway, that's not a problem.
2
This answer got voted down? Could whoever did this explain why they think this is a bad solution to the problem?
– Seamus
Jan 9 '11 at 11:42
I didn't downvote you but I did get an error with a simple test file. Can you provide a MWE? My error message:! TeX capacity exceeded, sorry [input stack size=5000]. figurecircled ->MDB-cmd figurecircled MDBfigurecircled l.14 ...footnote{of the emergency} $figurecircled {1}$ ! ==> Fatal error occurred, no output PDF file produced!
– Joe Corneli
Jul 3 '17 at 19:34
add a comment |
The mathdesign
package defines figurecircled
which has better spacing for numbers than textcircled
does.
The mathdesign package is incompatible with amsfonts
and amssymb
but if you're using a mathdesign font anyway, that's not a problem.
The mathdesign
package defines figurecircled
which has better spacing for numbers than textcircled
does.
The mathdesign package is incompatible with amsfonts
and amssymb
but if you're using a mathdesign font anyway, that's not a problem.
edited Jan 9 '11 at 11:43
answered Dec 14 '10 at 16:01
SeamusSeamus
45.3k35217332
45.3k35217332
2
This answer got voted down? Could whoever did this explain why they think this is a bad solution to the problem?
– Seamus
Jan 9 '11 at 11:42
I didn't downvote you but I did get an error with a simple test file. Can you provide a MWE? My error message:! TeX capacity exceeded, sorry [input stack size=5000]. figurecircled ->MDB-cmd figurecircled MDBfigurecircled l.14 ...footnote{of the emergency} $figurecircled {1}$ ! ==> Fatal error occurred, no output PDF file produced!
– Joe Corneli
Jul 3 '17 at 19:34
add a comment |
2
This answer got voted down? Could whoever did this explain why they think this is a bad solution to the problem?
– Seamus
Jan 9 '11 at 11:42
I didn't downvote you but I did get an error with a simple test file. Can you provide a MWE? My error message:! TeX capacity exceeded, sorry [input stack size=5000]. figurecircled ->MDB-cmd figurecircled MDBfigurecircled l.14 ...footnote{of the emergency} $figurecircled {1}$ ! ==> Fatal error occurred, no output PDF file produced!
– Joe Corneli
Jul 3 '17 at 19:34
2
2
This answer got voted down? Could whoever did this explain why they think this is a bad solution to the problem?
– Seamus
Jan 9 '11 at 11:42
This answer got voted down? Could whoever did this explain why they think this is a bad solution to the problem?
– Seamus
Jan 9 '11 at 11:42
I didn't downvote you but I did get an error with a simple test file. Can you provide a MWE? My error message:
! TeX capacity exceeded, sorry [input stack size=5000]. figurecircled ->MDB-cmd figurecircled MDBfigurecircled l.14 ...footnote{of the emergency} $figurecircled {1}$ ! ==> Fatal error occurred, no output PDF file produced!
– Joe Corneli
Jul 3 '17 at 19:34
I didn't downvote you but I did get an error with a simple test file. Can you provide a MWE? My error message:
! TeX capacity exceeded, sorry [input stack size=5000]. figurecircled ->MDB-cmd figurecircled MDBfigurecircled l.14 ...footnote{of the emergency} $figurecircled {1}$ ! ==> Fatal error occurred, no output PDF file produced!
– Joe Corneli
Jul 3 '17 at 19:34
add a comment |
From symbols.pdf, it looks like pifont
can do what you want with ding{172}
through ding{181}
or ding{192}
through ding{201}
.
Or the igo
package with whitestone{1}
through whitestone{99}
, although that's meant for typesetting Go boards.
It sounds like the solution has been found, but here's a simple comparison.
documentclass{article}
usepackage{pifont}
defX#1{%
#1%
textcircled{#1}%
raisebox{.9pt}{textcircled{raisebox{-.9pt}{#1}}}%
ding{numexpr171+#1relax}%
}
begin{document}
X0X1X2X3X4X5X6X7X8X9
end{document}
This is a great solution. However, the pifonts are rather squished, compared to thetextcircled
output. The pro, though, is the pifonts are flush with the text, which may be a good thing for the author.
– Jimi Oke
Dec 13 '10 at 9:49
@TH: Nice. What does the textcomp package do?
– Jimi Oke
Dec 13 '10 at 10:09
@Jimi: I thought it was required fortextcircled
. I was incorrect. (I was looking at Table 17 of Symbols.pdf and it notes thattextcomp
is required fornewtie
, but I wasn't reading carefully enough.) I've updated the code.
– TH.
Dec 13 '10 at 23:05
add a comment |
From symbols.pdf, it looks like pifont
can do what you want with ding{172}
through ding{181}
or ding{192}
through ding{201}
.
Or the igo
package with whitestone{1}
through whitestone{99}
, although that's meant for typesetting Go boards.
It sounds like the solution has been found, but here's a simple comparison.
documentclass{article}
usepackage{pifont}
defX#1{%
#1%
textcircled{#1}%
raisebox{.9pt}{textcircled{raisebox{-.9pt}{#1}}}%
ding{numexpr171+#1relax}%
}
begin{document}
X0X1X2X3X4X5X6X7X8X9
end{document}
This is a great solution. However, the pifonts are rather squished, compared to thetextcircled
output. The pro, though, is the pifonts are flush with the text, which may be a good thing for the author.
– Jimi Oke
Dec 13 '10 at 9:49
@TH: Nice. What does the textcomp package do?
– Jimi Oke
Dec 13 '10 at 10:09
@Jimi: I thought it was required fortextcircled
. I was incorrect. (I was looking at Table 17 of Symbols.pdf and it notes thattextcomp
is required fornewtie
, but I wasn't reading carefully enough.) I've updated the code.
– TH.
Dec 13 '10 at 23:05
add a comment |
From symbols.pdf, it looks like pifont
can do what you want with ding{172}
through ding{181}
or ding{192}
through ding{201}
.
Or the igo
package with whitestone{1}
through whitestone{99}
, although that's meant for typesetting Go boards.
It sounds like the solution has been found, but here's a simple comparison.
documentclass{article}
usepackage{pifont}
defX#1{%
#1%
textcircled{#1}%
raisebox{.9pt}{textcircled{raisebox{-.9pt}{#1}}}%
ding{numexpr171+#1relax}%
}
begin{document}
X0X1X2X3X4X5X6X7X8X9
end{document}
From symbols.pdf, it looks like pifont
can do what you want with ding{172}
through ding{181}
or ding{192}
through ding{201}
.
Or the igo
package with whitestone{1}
through whitestone{99}
, although that's meant for typesetting Go boards.
It sounds like the solution has been found, but here's a simple comparison.
documentclass{article}
usepackage{pifont}
defX#1{%
#1%
textcircled{#1}%
raisebox{.9pt}{textcircled{raisebox{-.9pt}{#1}}}%
ding{numexpr171+#1relax}%
}
begin{document}
X0X1X2X3X4X5X6X7X8X9
end{document}
edited 6 mins ago
PatrickT
1,07421123
1,07421123
answered Dec 13 '10 at 9:45
TH.TH.
47.7k10130197
47.7k10130197
This is a great solution. However, the pifonts are rather squished, compared to thetextcircled
output. The pro, though, is the pifonts are flush with the text, which may be a good thing for the author.
– Jimi Oke
Dec 13 '10 at 9:49
@TH: Nice. What does the textcomp package do?
– Jimi Oke
Dec 13 '10 at 10:09
@Jimi: I thought it was required fortextcircled
. I was incorrect. (I was looking at Table 17 of Symbols.pdf and it notes thattextcomp
is required fornewtie
, but I wasn't reading carefully enough.) I've updated the code.
– TH.
Dec 13 '10 at 23:05
add a comment |
This is a great solution. However, the pifonts are rather squished, compared to thetextcircled
output. The pro, though, is the pifonts are flush with the text, which may be a good thing for the author.
– Jimi Oke
Dec 13 '10 at 9:49
@TH: Nice. What does the textcomp package do?
– Jimi Oke
Dec 13 '10 at 10:09
@Jimi: I thought it was required fortextcircled
. I was incorrect. (I was looking at Table 17 of Symbols.pdf and it notes thattextcomp
is required fornewtie
, but I wasn't reading carefully enough.) I've updated the code.
– TH.
Dec 13 '10 at 23:05
This is a great solution. However, the pifonts are rather squished, compared to the
textcircled
output. The pro, though, is the pifonts are flush with the text, which may be a good thing for the author.– Jimi Oke
Dec 13 '10 at 9:49
This is a great solution. However, the pifonts are rather squished, compared to the
textcircled
output. The pro, though, is the pifonts are flush with the text, which may be a good thing for the author.– Jimi Oke
Dec 13 '10 at 9:49
@TH: Nice. What does the textcomp package do?
– Jimi Oke
Dec 13 '10 at 10:09
@TH: Nice. What does the textcomp package do?
– Jimi Oke
Dec 13 '10 at 10:09
@Jimi: I thought it was required for
textcircled
. I was incorrect. (I was looking at Table 17 of Symbols.pdf and it notes that textcomp
is required for newtie
, but I wasn't reading carefully enough.) I've updated the code.– TH.
Dec 13 '10 at 23:05
@Jimi: I thought it was required for
textcircled
. I was incorrect. (I was looking at Table 17 of Symbols.pdf and it notes that textcomp
is required for newtie
, but I wasn't reading carefully enough.) I've updated the code.– TH.
Dec 13 '10 at 23:05
add a comment |
@Stefan's answer is good, however, I improved his answer.
Firstly, if circled{1}
and circled{10}
are placed together, the two circles will not be the same size, so I added an optional parameter to the circled
command. The optional parameter was regraded as a placeholder to make sure that these circles appear in the same size.
Additionally, since I'd used ifblank
, which is provided by package etoolbox
, to check if the optional parameter was provided, I used robustify
to make the command robust. This bypassed the disadvantage of using DeclearRobustCommand
, mentioned by @Stefan in a comment of his answer. Thus, the protact
is no longer needed.
Code:
documentclass{article}
usepackage{enumitem}
usepackage{tikz}
usepackage{etoolbox}
newcommand{circled}[2]{%
tikz[baseline=(char.base)]{%
node[shape = circle, draw, inner sep = 1pt]
(char) {phantom{ifblank{#1}{#2}{#1}}};%
node at (char.center) {makebox[0pt][c]{#2}};}}
robustify{circled}
begin{document}
mbox{}rlap{rule{.7linewidth}{.4pt}}%
The original version: circled{1} and circled{10}.
mbox{}rlap{rule{.7linewidth}{.4pt}}%
The improved version: circled[10]{1} and circled[10]{10}.
newcommand{dcircled}[1]{circled[00]{#1}}
begin{enumerate}[label=dcircled{arabic*}, noitemsep]
item I
item am
item happy
item to
item join
item with
item you
item today
item in
item what
item will
item go
item down
item in
item history
item as
item the
item greatest
item demonstration
item for
item freedom
item in
item the
item history
item of
item our
item nation.
end{enumerate}
end{document}
Result:
1
you know the optionminimum size
for nodes?
– percusse
Dec 20 '14 at 18:13
@percusse Sorry, but I don't understand you.
– Ch'en Meng
Dec 21 '14 at 12:30
You can define a minimum size for circle nodes without a box or phantom with uniform size.
– percusse
Dec 21 '14 at 12:33
1
@percusse That's a good suggestion, however, I don't think you understand the idea in my post. I designed this optional parameter to uniform the size of the circles, since different sized circles that are aligned together will give a unfriendly looking.
– Ch'en Meng
Dec 23 '14 at 10:04
add a comment |
@Stefan's answer is good, however, I improved his answer.
Firstly, if circled{1}
and circled{10}
are placed together, the two circles will not be the same size, so I added an optional parameter to the circled
command. The optional parameter was regraded as a placeholder to make sure that these circles appear in the same size.
Additionally, since I'd used ifblank
, which is provided by package etoolbox
, to check if the optional parameter was provided, I used robustify
to make the command robust. This bypassed the disadvantage of using DeclearRobustCommand
, mentioned by @Stefan in a comment of his answer. Thus, the protact
is no longer needed.
Code:
documentclass{article}
usepackage{enumitem}
usepackage{tikz}
usepackage{etoolbox}
newcommand{circled}[2]{%
tikz[baseline=(char.base)]{%
node[shape = circle, draw, inner sep = 1pt]
(char) {phantom{ifblank{#1}{#2}{#1}}};%
node at (char.center) {makebox[0pt][c]{#2}};}}
robustify{circled}
begin{document}
mbox{}rlap{rule{.7linewidth}{.4pt}}%
The original version: circled{1} and circled{10}.
mbox{}rlap{rule{.7linewidth}{.4pt}}%
The improved version: circled[10]{1} and circled[10]{10}.
newcommand{dcircled}[1]{circled[00]{#1}}
begin{enumerate}[label=dcircled{arabic*}, noitemsep]
item I
item am
item happy
item to
item join
item with
item you
item today
item in
item what
item will
item go
item down
item in
item history
item as
item the
item greatest
item demonstration
item for
item freedom
item in
item the
item history
item of
item our
item nation.
end{enumerate}
end{document}
Result:
1
you know the optionminimum size
for nodes?
– percusse
Dec 20 '14 at 18:13
@percusse Sorry, but I don't understand you.
– Ch'en Meng
Dec 21 '14 at 12:30
You can define a minimum size for circle nodes without a box or phantom with uniform size.
– percusse
Dec 21 '14 at 12:33
1
@percusse That's a good suggestion, however, I don't think you understand the idea in my post. I designed this optional parameter to uniform the size of the circles, since different sized circles that are aligned together will give a unfriendly looking.
– Ch'en Meng
Dec 23 '14 at 10:04
add a comment |
@Stefan's answer is good, however, I improved his answer.
Firstly, if circled{1}
and circled{10}
are placed together, the two circles will not be the same size, so I added an optional parameter to the circled
command. The optional parameter was regraded as a placeholder to make sure that these circles appear in the same size.
Additionally, since I'd used ifblank
, which is provided by package etoolbox
, to check if the optional parameter was provided, I used robustify
to make the command robust. This bypassed the disadvantage of using DeclearRobustCommand
, mentioned by @Stefan in a comment of his answer. Thus, the protact
is no longer needed.
Code:
documentclass{article}
usepackage{enumitem}
usepackage{tikz}
usepackage{etoolbox}
newcommand{circled}[2]{%
tikz[baseline=(char.base)]{%
node[shape = circle, draw, inner sep = 1pt]
(char) {phantom{ifblank{#1}{#2}{#1}}};%
node at (char.center) {makebox[0pt][c]{#2}};}}
robustify{circled}
begin{document}
mbox{}rlap{rule{.7linewidth}{.4pt}}%
The original version: circled{1} and circled{10}.
mbox{}rlap{rule{.7linewidth}{.4pt}}%
The improved version: circled[10]{1} and circled[10]{10}.
newcommand{dcircled}[1]{circled[00]{#1}}
begin{enumerate}[label=dcircled{arabic*}, noitemsep]
item I
item am
item happy
item to
item join
item with
item you
item today
item in
item what
item will
item go
item down
item in
item history
item as
item the
item greatest
item demonstration
item for
item freedom
item in
item the
item history
item of
item our
item nation.
end{enumerate}
end{document}
Result:
@Stefan's answer is good, however, I improved his answer.
Firstly, if circled{1}
and circled{10}
are placed together, the two circles will not be the same size, so I added an optional parameter to the circled
command. The optional parameter was regraded as a placeholder to make sure that these circles appear in the same size.
Additionally, since I'd used ifblank
, which is provided by package etoolbox
, to check if the optional parameter was provided, I used robustify
to make the command robust. This bypassed the disadvantage of using DeclearRobustCommand
, mentioned by @Stefan in a comment of his answer. Thus, the protact
is no longer needed.
Code:
documentclass{article}
usepackage{enumitem}
usepackage{tikz}
usepackage{etoolbox}
newcommand{circled}[2]{%
tikz[baseline=(char.base)]{%
node[shape = circle, draw, inner sep = 1pt]
(char) {phantom{ifblank{#1}{#2}{#1}}};%
node at (char.center) {makebox[0pt][c]{#2}};}}
robustify{circled}
begin{document}
mbox{}rlap{rule{.7linewidth}{.4pt}}%
The original version: circled{1} and circled{10}.
mbox{}rlap{rule{.7linewidth}{.4pt}}%
The improved version: circled[10]{1} and circled[10]{10}.
newcommand{dcircled}[1]{circled[00]{#1}}
begin{enumerate}[label=dcircled{arabic*}, noitemsep]
item I
item am
item happy
item to
item join
item with
item you
item today
item in
item what
item will
item go
item down
item in
item history
item as
item the
item greatest
item demonstration
item for
item freedom
item in
item the
item history
item of
item our
item nation.
end{enumerate}
end{document}
Result:
edited Mar 9 '17 at 17:31
Community♦
1
1
answered Dec 20 '14 at 14:17
Ch'en MengCh'en Meng
3,0751237
3,0751237
1
you know the optionminimum size
for nodes?
– percusse
Dec 20 '14 at 18:13
@percusse Sorry, but I don't understand you.
– Ch'en Meng
Dec 21 '14 at 12:30
You can define a minimum size for circle nodes without a box or phantom with uniform size.
– percusse
Dec 21 '14 at 12:33
1
@percusse That's a good suggestion, however, I don't think you understand the idea in my post. I designed this optional parameter to uniform the size of the circles, since different sized circles that are aligned together will give a unfriendly looking.
– Ch'en Meng
Dec 23 '14 at 10:04
add a comment |
1
you know the optionminimum size
for nodes?
– percusse
Dec 20 '14 at 18:13
@percusse Sorry, but I don't understand you.
– Ch'en Meng
Dec 21 '14 at 12:30
You can define a minimum size for circle nodes without a box or phantom with uniform size.
– percusse
Dec 21 '14 at 12:33
1
@percusse That's a good suggestion, however, I don't think you understand the idea in my post. I designed this optional parameter to uniform the size of the circles, since different sized circles that are aligned together will give a unfriendly looking.
– Ch'en Meng
Dec 23 '14 at 10:04
1
1
you know the option
minimum size
for nodes?– percusse
Dec 20 '14 at 18:13
you know the option
minimum size
for nodes?– percusse
Dec 20 '14 at 18:13
@percusse Sorry, but I don't understand you.
– Ch'en Meng
Dec 21 '14 at 12:30
@percusse Sorry, but I don't understand you.
– Ch'en Meng
Dec 21 '14 at 12:30
You can define a minimum size for circle nodes without a box or phantom with uniform size.
– percusse
Dec 21 '14 at 12:33
You can define a minimum size for circle nodes without a box or phantom with uniform size.
– percusse
Dec 21 '14 at 12:33
1
1
@percusse That's a good suggestion, however, I don't think you understand the idea in my post. I designed this optional parameter to uniform the size of the circles, since different sized circles that are aligned together will give a unfriendly looking.
– Ch'en Meng
Dec 23 '14 at 10:04
@percusse That's a good suggestion, however, I don't think you understand the idea in my post. I designed this optional parameter to uniform the size of the circles, since different sized circles that are aligned together will give a unfriendly looking.
– Ch'en Meng
Dec 23 '14 at 10:04
add a comment |
with the default picture commands:
documentclass{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{pict2e,picture}
newsaveboxCBox
newlengthCLength
defCircled#1{sboxCBox{#1}%
ifdimwdCBox>htCBox CLength=wdCBoxelseCLength=htCBoxfi
makebox[1.2CLength]{makebox(0,1.2CLength){put(0,0){circle{1.2CLength}}}%
makebox(0,1.2CLength){put(-.5wdCBox,0){#1}}}}
begin{document}
Huge
foo
Circled{1}
Circled{2}
Circled{ABC}
end{document}
add a comment |
with the default picture commands:
documentclass{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{pict2e,picture}
newsaveboxCBox
newlengthCLength
defCircled#1{sboxCBox{#1}%
ifdimwdCBox>htCBox CLength=wdCBoxelseCLength=htCBoxfi
makebox[1.2CLength]{makebox(0,1.2CLength){put(0,0){circle{1.2CLength}}}%
makebox(0,1.2CLength){put(-.5wdCBox,0){#1}}}}
begin{document}
Huge
foo
Circled{1}
Circled{2}
Circled{ABC}
end{document}
add a comment |
with the default picture commands:
documentclass{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{pict2e,picture}
newsaveboxCBox
newlengthCLength
defCircled#1{sboxCBox{#1}%
ifdimwdCBox>htCBox CLength=wdCBoxelseCLength=htCBoxfi
makebox[1.2CLength]{makebox(0,1.2CLength){put(0,0){circle{1.2CLength}}}%
makebox(0,1.2CLength){put(-.5wdCBox,0){#1}}}}
begin{document}
Huge
foo
Circled{1}
Circled{2}
Circled{ABC}
end{document}
with the default picture commands:
documentclass{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{pict2e,picture}
newsaveboxCBox
newlengthCLength
defCircled#1{sboxCBox{#1}%
ifdimwdCBox>htCBox CLength=wdCBoxelseCLength=htCBoxfi
makebox[1.2CLength]{makebox(0,1.2CLength){put(0,0){circle{1.2CLength}}}%
makebox(0,1.2CLength){put(-.5wdCBox,0){#1}}}}
begin{document}
Huge
foo
Circled{1}
Circled{2}
Circled{ABC}
end{document}
answered Jan 9 '11 at 11:35
HerbertHerbert
274k24415729
274k24415729
add a comment |
add a comment |
With Plain (stumbled upon this by chance and remembered this question):
defcircled#1{{ooalign{hfillower.1exhbox{#1}hfilcrcrOrb}}}
$circled1 circled2 circled3 ldots circled9 quad circled{23}$
bye
With XeTeX:
fontcircled="Arial Unicode MS"
{circled ➀} Didn't occur to me {circled ➄} earlier that some fonts have {circled ➇} these.
bye
Or maybe with TikZ:
input tikz
baseline ain't so pretty par
baseline ain't so pretty par
baseline tikz node[circle,draw] {2}; ain't par
so pretty tikz[baseline] node[circle,draw] {2}; baseline par
ain't so pretty baseline par
ain't tikz[inner sep=1pt,baseline=-.75ex] node[circle,draw] {2}; so pretty par
baseline tikz[inner sep=2pt,baseline=-.75ex] node[circle,draw] {2}; ain't so par
pretty baseline ain't so par
pretty tikz[inner sep=.25ex,baseline=-.75ex] node[circle,draw] {2}; baseline par
... actually, now it sorta is par
baseline ain't so pretty par
baseline ain't so pretty
bye
Darn, Stefan beat me to it with a nicer one.
add a comment |
With Plain (stumbled upon this by chance and remembered this question):
defcircled#1{{ooalign{hfillower.1exhbox{#1}hfilcrcrOrb}}}
$circled1 circled2 circled3 ldots circled9 quad circled{23}$
bye
With XeTeX:
fontcircled="Arial Unicode MS"
{circled ➀} Didn't occur to me {circled ➄} earlier that some fonts have {circled ➇} these.
bye
Or maybe with TikZ:
input tikz
baseline ain't so pretty par
baseline ain't so pretty par
baseline tikz node[circle,draw] {2}; ain't par
so pretty tikz[baseline] node[circle,draw] {2}; baseline par
ain't so pretty baseline par
ain't tikz[inner sep=1pt,baseline=-.75ex] node[circle,draw] {2}; so pretty par
baseline tikz[inner sep=2pt,baseline=-.75ex] node[circle,draw] {2}; ain't so par
pretty baseline ain't so par
pretty tikz[inner sep=.25ex,baseline=-.75ex] node[circle,draw] {2}; baseline par
... actually, now it sorta is par
baseline ain't so pretty par
baseline ain't so pretty
bye
Darn, Stefan beat me to it with a nicer one.
add a comment |
With Plain (stumbled upon this by chance and remembered this question):
defcircled#1{{ooalign{hfillower.1exhbox{#1}hfilcrcrOrb}}}
$circled1 circled2 circled3 ldots circled9 quad circled{23}$
bye
With XeTeX:
fontcircled="Arial Unicode MS"
{circled ➀} Didn't occur to me {circled ➄} earlier that some fonts have {circled ➇} these.
bye
Or maybe with TikZ:
input tikz
baseline ain't so pretty par
baseline ain't so pretty par
baseline tikz node[circle,draw] {2}; ain't par
so pretty tikz[baseline] node[circle,draw] {2}; baseline par
ain't so pretty baseline par
ain't tikz[inner sep=1pt,baseline=-.75ex] node[circle,draw] {2}; so pretty par
baseline tikz[inner sep=2pt,baseline=-.75ex] node[circle,draw] {2}; ain't so par
pretty baseline ain't so par
pretty tikz[inner sep=.25ex,baseline=-.75ex] node[circle,draw] {2}; baseline par
... actually, now it sorta is par
baseline ain't so pretty par
baseline ain't so pretty
bye
Darn, Stefan beat me to it with a nicer one.
With Plain (stumbled upon this by chance and remembered this question):
defcircled#1{{ooalign{hfillower.1exhbox{#1}hfilcrcrOrb}}}
$circled1 circled2 circled3 ldots circled9 quad circled{23}$
bye
With XeTeX:
fontcircled="Arial Unicode MS"
{circled ➀} Didn't occur to me {circled ➄} earlier that some fonts have {circled ➇} these.
bye
Or maybe with TikZ:
input tikz
baseline ain't so pretty par
baseline ain't so pretty par
baseline tikz node[circle,draw] {2}; ain't par
so pretty tikz[baseline] node[circle,draw] {2}; baseline par
ain't so pretty baseline par
ain't tikz[inner sep=1pt,baseline=-.75ex] node[circle,draw] {2}; so pretty par
baseline tikz[inner sep=2pt,baseline=-.75ex] node[circle,draw] {2}; ain't so par
pretty baseline ain't so par
pretty tikz[inner sep=.25ex,baseline=-.75ex] node[circle,draw] {2}; baseline par
... actually, now it sorta is par
baseline ain't so pretty par
baseline ain't so pretty
bye
Darn, Stefan beat me to it with a nicer one.
edited Nov 5 '11 at 3:50
KF Leong
6017
6017
answered Dec 13 '10 at 13:34
morbusgmorbusg
20.1k362137
20.1k362137
add a comment |
add a comment |
Even easier:
textcircled{small{2}}
or
{large textcircled{small 2}}
or
{Large textcircled{normalsize 2}}
[ed. Segletes, providing MWE & image]
documentclass{article}
usepackage{enumitem}
begin{document}
begin{enumerate}[label=largeprotecttextcircled{smallarabic*}]
item First item
item Second item
item Third item
item Fourth item
end{enumerate}
textcircled{small{2}}
or
{large textcircled{small 2}}
or
{Large textcircled{normalsize 2}}
end{document}
1
This might work when the circle is not surrounded by text, and the font size of the number is not an issue -- but I'd rather use one of the other solutions instead.
– Martin Tapankov
Jan 10 '11 at 18:31
add a comment |
Even easier:
textcircled{small{2}}
or
{large textcircled{small 2}}
or
{Large textcircled{normalsize 2}}
[ed. Segletes, providing MWE & image]
documentclass{article}
usepackage{enumitem}
begin{document}
begin{enumerate}[label=largeprotecttextcircled{smallarabic*}]
item First item
item Second item
item Third item
item Fourth item
end{enumerate}
textcircled{small{2}}
or
{large textcircled{small 2}}
or
{Large textcircled{normalsize 2}}
end{document}
1
This might work when the circle is not surrounded by text, and the font size of the number is not an issue -- but I'd rather use one of the other solutions instead.
– Martin Tapankov
Jan 10 '11 at 18:31
add a comment |
Even easier:
textcircled{small{2}}
or
{large textcircled{small 2}}
or
{Large textcircled{normalsize 2}}
[ed. Segletes, providing MWE & image]
documentclass{article}
usepackage{enumitem}
begin{document}
begin{enumerate}[label=largeprotecttextcircled{smallarabic*}]
item First item
item Second item
item Third item
item Fourth item
end{enumerate}
textcircled{small{2}}
or
{large textcircled{small 2}}
or
{Large textcircled{normalsize 2}}
end{document}
Even easier:
textcircled{small{2}}
or
{large textcircled{small 2}}
or
{Large textcircled{normalsize 2}}
[ed. Segletes, providing MWE & image]
documentclass{article}
usepackage{enumitem}
begin{document}
begin{enumerate}[label=largeprotecttextcircled{smallarabic*}]
item First item
item Second item
item Third item
item Fourth item
end{enumerate}
textcircled{small{2}}
or
{large textcircled{small 2}}
or
{Large textcircled{normalsize 2}}
end{document}
edited May 22 '17 at 21:10
Steven B. Segletes
154k9198405
154k9198405
answered Jan 9 '11 at 10:06
user2845
1
This might work when the circle is not surrounded by text, and the font size of the number is not an issue -- but I'd rather use one of the other solutions instead.
– Martin Tapankov
Jan 10 '11 at 18:31
add a comment |
1
This might work when the circle is not surrounded by text, and the font size of the number is not an issue -- but I'd rather use one of the other solutions instead.
– Martin Tapankov
Jan 10 '11 at 18:31
1
1
This might work when the circle is not surrounded by text, and the font size of the number is not an issue -- but I'd rather use one of the other solutions instead.
– Martin Tapankov
Jan 10 '11 at 18:31
This might work when the circle is not surrounded by text, and the font size of the number is not an issue -- but I'd rather use one of the other solutions instead.
– Martin Tapankov
Jan 10 '11 at 18:31
add a comment |
Here is a pdfliteral
solution. It only works for single numbers.
defcircled#1{%
#1%
pdfliteral{
q .5 w
10 0 0 10 -2.5 3.5 cm .05 w .5 0 m
.5 .276 .276 .5 0 .5 c -.276 .5 -.5 .276 -.5 0 c
-.5 -.276 -.276 -.5 0 -.5 c .276 -.5 .5 -.276 .5 0 c h
S Q
}%
}
circled{1} a
circled{2} b
circled{3} c
circled{10}
bye
Why the coordinate transformations ?
– percusse
Nov 23 '15 at 6:07
@percusse Actually, I just copied code from here and modified it a little. If you can provide any resources to learn more about PDF coding, I would be really happy.
– Henri Menke
Nov 23 '15 at 8:09
1
It is actually PostScript but PDF also supports many graphics objects. So it's a bit cumbersome to understand the set of all operators supported in PDF. But at least to start reading this code you can use the reference guide adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/…. Also in the ISO spec (table 59 in adobe.com/devnet/pdf/pdf_reference.html ) you can recognize the TikZ operators mapped to frontend ;). The initial problem to grasp is setting up the bounding box the rest is usual PS notation.
– percusse
Nov 23 '15 at 8:43
add a comment |
Here is a pdfliteral
solution. It only works for single numbers.
defcircled#1{%
#1%
pdfliteral{
q .5 w
10 0 0 10 -2.5 3.5 cm .05 w .5 0 m
.5 .276 .276 .5 0 .5 c -.276 .5 -.5 .276 -.5 0 c
-.5 -.276 -.276 -.5 0 -.5 c .276 -.5 .5 -.276 .5 0 c h
S Q
}%
}
circled{1} a
circled{2} b
circled{3} c
circled{10}
bye
Why the coordinate transformations ?
– percusse
Nov 23 '15 at 6:07
@percusse Actually, I just copied code from here and modified it a little. If you can provide any resources to learn more about PDF coding, I would be really happy.
– Henri Menke
Nov 23 '15 at 8:09
1
It is actually PostScript but PDF also supports many graphics objects. So it's a bit cumbersome to understand the set of all operators supported in PDF. But at least to start reading this code you can use the reference guide adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/…. Also in the ISO spec (table 59 in adobe.com/devnet/pdf/pdf_reference.html ) you can recognize the TikZ operators mapped to frontend ;). The initial problem to grasp is setting up the bounding box the rest is usual PS notation.
– percusse
Nov 23 '15 at 8:43
add a comment |
Here is a pdfliteral
solution. It only works for single numbers.
defcircled#1{%
#1%
pdfliteral{
q .5 w
10 0 0 10 -2.5 3.5 cm .05 w .5 0 m
.5 .276 .276 .5 0 .5 c -.276 .5 -.5 .276 -.5 0 c
-.5 -.276 -.276 -.5 0 -.5 c .276 -.5 .5 -.276 .5 0 c h
S Q
}%
}
circled{1} a
circled{2} b
circled{3} c
circled{10}
bye
Here is a pdfliteral
solution. It only works for single numbers.
defcircled#1{%
#1%
pdfliteral{
q .5 w
10 0 0 10 -2.5 3.5 cm .05 w .5 0 m
.5 .276 .276 .5 0 .5 c -.276 .5 -.5 .276 -.5 0 c
-.5 -.276 -.276 -.5 0 -.5 c .276 -.5 .5 -.276 .5 0 c h
S Q
}%
}
circled{1} a
circled{2} b
circled{3} c
circled{10}
bye
answered Nov 22 '15 at 21:33
Henri MenkeHenri Menke
73.6k8162273
73.6k8162273
Why the coordinate transformations ?
– percusse
Nov 23 '15 at 6:07
@percusse Actually, I just copied code from here and modified it a little. If you can provide any resources to learn more about PDF coding, I would be really happy.
– Henri Menke
Nov 23 '15 at 8:09
1
It is actually PostScript but PDF also supports many graphics objects. So it's a bit cumbersome to understand the set of all operators supported in PDF. But at least to start reading this code you can use the reference guide adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/…. Also in the ISO spec (table 59 in adobe.com/devnet/pdf/pdf_reference.html ) you can recognize the TikZ operators mapped to frontend ;). The initial problem to grasp is setting up the bounding box the rest is usual PS notation.
– percusse
Nov 23 '15 at 8:43
add a comment |
Why the coordinate transformations ?
– percusse
Nov 23 '15 at 6:07
@percusse Actually, I just copied code from here and modified it a little. If you can provide any resources to learn more about PDF coding, I would be really happy.
– Henri Menke
Nov 23 '15 at 8:09
1
It is actually PostScript but PDF also supports many graphics objects. So it's a bit cumbersome to understand the set of all operators supported in PDF. But at least to start reading this code you can use the reference guide adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/…. Also in the ISO spec (table 59 in adobe.com/devnet/pdf/pdf_reference.html ) you can recognize the TikZ operators mapped to frontend ;). The initial problem to grasp is setting up the bounding box the rest is usual PS notation.
– percusse
Nov 23 '15 at 8:43
Why the coordinate transformations ?
– percusse
Nov 23 '15 at 6:07
Why the coordinate transformations ?
– percusse
Nov 23 '15 at 6:07
@percusse Actually, I just copied code from here and modified it a little. If you can provide any resources to learn more about PDF coding, I would be really happy.
– Henri Menke
Nov 23 '15 at 8:09
@percusse Actually, I just copied code from here and modified it a little. If you can provide any resources to learn more about PDF coding, I would be really happy.
– Henri Menke
Nov 23 '15 at 8:09
1
1
It is actually PostScript but PDF also supports many graphics objects. So it's a bit cumbersome to understand the set of all operators supported in PDF. But at least to start reading this code you can use the reference guide adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/…. Also in the ISO spec (table 59 in adobe.com/devnet/pdf/pdf_reference.html ) you can recognize the TikZ operators mapped to frontend ;). The initial problem to grasp is setting up the bounding box the rest is usual PS notation.
– percusse
Nov 23 '15 at 8:43
It is actually PostScript but PDF also supports many graphics objects. So it's a bit cumbersome to understand the set of all operators supported in PDF. But at least to start reading this code you can use the reference guide adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/…. Also in the ISO spec (table 59 in adobe.com/devnet/pdf/pdf_reference.html ) you can recognize the TikZ operators mapped to frontend ;). The initial problem to grasp is setting up the bounding box the rest is usual PS notation.
– percusse
Nov 23 '15 at 8:43
add a comment |
Using pifont package and symbols from ding{172}
to ding{211}
you easily have very excellent circled numbers, but if you want circled numbers bigger than 10 we have a problem. As showed by other stackexchange users here, we can solve the problem if numbers are not too big, but things became hard (complex LaTeX codes) and we can have problems if we are writing inside a text (if the circle became big, LaTeX can be forced to enlarge space between lines, or maybe to overlap circle upon adjacent upper and lower lines): things are a bit simpler if we only want circled number in a itemize list. This lack in flexibility could be in some case bothersome. A reasonable solution seems to use the tcolorbox package: after attempts I found that we simply have to add in preamble this
usepackage{tcolorbox} newcommand{ciao}[1]{{setlengthfboxrule{0pt}fbox{tcbox[colframe=black,colback=white,shrink tight,boxrule=0.5pt,extrude by=1mm]{small #1}}}}
and call in the document the command ciao when we want a "circled" number (example: ciao{12} will "circle" the number 12). By the way, the use of fbox in the preamble line is important because without it, rounded box could protrude out of the line on the left or on the right when they are at the margin of the line: this would be very unaesthetic.
Resuming, I see in this solution 3 pros and 1 cons:
pros: simple code, good working inside a text too, flexibility (big numbers too & in case we can easily play with borders or colors: see 0.5pt or black&white in the preamble line).
cons: we don't have circles but rounded box, but I find this a reasonable compromise.
An example of application of this method is
Quel ramo del lago di Como ciao{1}, che volge a mezzogiorno, tra due catene ciao{20} non interrotte di monti, tutto a seni e a golfi, a seconda dello sporgere e del rientrare di quelli, vien, quasi a un tratto, a restringersi, e a prender corso ciao{252} e figura di fiume, tra un promontorio a destra, e un'ampia costiera dall'altra parte; ciao{3432} e il ponte che ivi congiunge le due rive, par che renda ancor più sensibile all'occhio questa trasformazione, e segni il punto in cui il lago cessa, e l'Adda ricomincia, per ripigliar poi nome di lago dove le rive, allontanandosi di nuovo, lascian l'acqua distendersi e rallentarsi in nuovi golfi e in nuovi seni.
that gives
please note that numbers doesn't protrude and that the space between lines is always the same: no matter if we have a number or not. In short, this almost circled numbers works very well even if they are inside a text.
add a comment |
Using pifont package and symbols from ding{172}
to ding{211}
you easily have very excellent circled numbers, but if you want circled numbers bigger than 10 we have a problem. As showed by other stackexchange users here, we can solve the problem if numbers are not too big, but things became hard (complex LaTeX codes) and we can have problems if we are writing inside a text (if the circle became big, LaTeX can be forced to enlarge space between lines, or maybe to overlap circle upon adjacent upper and lower lines): things are a bit simpler if we only want circled number in a itemize list. This lack in flexibility could be in some case bothersome. A reasonable solution seems to use the tcolorbox package: after attempts I found that we simply have to add in preamble this
usepackage{tcolorbox} newcommand{ciao}[1]{{setlengthfboxrule{0pt}fbox{tcbox[colframe=black,colback=white,shrink tight,boxrule=0.5pt,extrude by=1mm]{small #1}}}}
and call in the document the command ciao when we want a "circled" number (example: ciao{12} will "circle" the number 12). By the way, the use of fbox in the preamble line is important because without it, rounded box could protrude out of the line on the left or on the right when they are at the margin of the line: this would be very unaesthetic.
Resuming, I see in this solution 3 pros and 1 cons:
pros: simple code, good working inside a text too, flexibility (big numbers too & in case we can easily play with borders or colors: see 0.5pt or black&white in the preamble line).
cons: we don't have circles but rounded box, but I find this a reasonable compromise.
An example of application of this method is
Quel ramo del lago di Como ciao{1}, che volge a mezzogiorno, tra due catene ciao{20} non interrotte di monti, tutto a seni e a golfi, a seconda dello sporgere e del rientrare di quelli, vien, quasi a un tratto, a restringersi, e a prender corso ciao{252} e figura di fiume, tra un promontorio a destra, e un'ampia costiera dall'altra parte; ciao{3432} e il ponte che ivi congiunge le due rive, par che renda ancor più sensibile all'occhio questa trasformazione, e segni il punto in cui il lago cessa, e l'Adda ricomincia, per ripigliar poi nome di lago dove le rive, allontanandosi di nuovo, lascian l'acqua distendersi e rallentarsi in nuovi golfi e in nuovi seni.
that gives
please note that numbers doesn't protrude and that the space between lines is always the same: no matter if we have a number or not. In short, this almost circled numbers works very well even if they are inside a text.
add a comment |
Using pifont package and symbols from ding{172}
to ding{211}
you easily have very excellent circled numbers, but if you want circled numbers bigger than 10 we have a problem. As showed by other stackexchange users here, we can solve the problem if numbers are not too big, but things became hard (complex LaTeX codes) and we can have problems if we are writing inside a text (if the circle became big, LaTeX can be forced to enlarge space between lines, or maybe to overlap circle upon adjacent upper and lower lines): things are a bit simpler if we only want circled number in a itemize list. This lack in flexibility could be in some case bothersome. A reasonable solution seems to use the tcolorbox package: after attempts I found that we simply have to add in preamble this
usepackage{tcolorbox} newcommand{ciao}[1]{{setlengthfboxrule{0pt}fbox{tcbox[colframe=black,colback=white,shrink tight,boxrule=0.5pt,extrude by=1mm]{small #1}}}}
and call in the document the command ciao when we want a "circled" number (example: ciao{12} will "circle" the number 12). By the way, the use of fbox in the preamble line is important because without it, rounded box could protrude out of the line on the left or on the right when they are at the margin of the line: this would be very unaesthetic.
Resuming, I see in this solution 3 pros and 1 cons:
pros: simple code, good working inside a text too, flexibility (big numbers too & in case we can easily play with borders or colors: see 0.5pt or black&white in the preamble line).
cons: we don't have circles but rounded box, but I find this a reasonable compromise.
An example of application of this method is
Quel ramo del lago di Como ciao{1}, che volge a mezzogiorno, tra due catene ciao{20} non interrotte di monti, tutto a seni e a golfi, a seconda dello sporgere e del rientrare di quelli, vien, quasi a un tratto, a restringersi, e a prender corso ciao{252} e figura di fiume, tra un promontorio a destra, e un'ampia costiera dall'altra parte; ciao{3432} e il ponte che ivi congiunge le due rive, par che renda ancor più sensibile all'occhio questa trasformazione, e segni il punto in cui il lago cessa, e l'Adda ricomincia, per ripigliar poi nome di lago dove le rive, allontanandosi di nuovo, lascian l'acqua distendersi e rallentarsi in nuovi golfi e in nuovi seni.
that gives
please note that numbers doesn't protrude and that the space between lines is always the same: no matter if we have a number or not. In short, this almost circled numbers works very well even if they are inside a text.
Using pifont package and symbols from ding{172}
to ding{211}
you easily have very excellent circled numbers, but if you want circled numbers bigger than 10 we have a problem. As showed by other stackexchange users here, we can solve the problem if numbers are not too big, but things became hard (complex LaTeX codes) and we can have problems if we are writing inside a text (if the circle became big, LaTeX can be forced to enlarge space between lines, or maybe to overlap circle upon adjacent upper and lower lines): things are a bit simpler if we only want circled number in a itemize list. This lack in flexibility could be in some case bothersome. A reasonable solution seems to use the tcolorbox package: after attempts I found that we simply have to add in preamble this
usepackage{tcolorbox} newcommand{ciao}[1]{{setlengthfboxrule{0pt}fbox{tcbox[colframe=black,colback=white,shrink tight,boxrule=0.5pt,extrude by=1mm]{small #1}}}}
and call in the document the command ciao when we want a "circled" number (example: ciao{12} will "circle" the number 12). By the way, the use of fbox in the preamble line is important because without it, rounded box could protrude out of the line on the left or on the right when they are at the margin of the line: this would be very unaesthetic.
Resuming, I see in this solution 3 pros and 1 cons:
pros: simple code, good working inside a text too, flexibility (big numbers too & in case we can easily play with borders or colors: see 0.5pt or black&white in the preamble line).
cons: we don't have circles but rounded box, but I find this a reasonable compromise.
An example of application of this method is
Quel ramo del lago di Como ciao{1}, che volge a mezzogiorno, tra due catene ciao{20} non interrotte di monti, tutto a seni e a golfi, a seconda dello sporgere e del rientrare di quelli, vien, quasi a un tratto, a restringersi, e a prender corso ciao{252} e figura di fiume, tra un promontorio a destra, e un'ampia costiera dall'altra parte; ciao{3432} e il ponte che ivi congiunge le due rive, par che renda ancor più sensibile all'occhio questa trasformazione, e segni il punto in cui il lago cessa, e l'Adda ricomincia, per ripigliar poi nome di lago dove le rive, allontanandosi di nuovo, lascian l'acqua distendersi e rallentarsi in nuovi golfi e in nuovi seni.
that gives
please note that numbers doesn't protrude and that the space between lines is always the same: no matter if we have a number or not. In short, this almost circled numbers works very well even if they are inside a text.
answered May 22 '17 at 20:59
Fausto VezzaroFausto Vezzaro
1312
1312
add a comment |
add a comment |
protected by Community♦ May 25 '14 at 12:58
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Got two good answers here, for less than 30 minutes (you guys are fast!). I'll probably make a community wiki answer summarizing all options one of these days, maybe some other solutions will come along in the meantime.
– Martin Tapankov
Dec 13 '10 at 9:58
I'm sleep-deprived, that's why!
– Jimi Oke
Dec 13 '10 at 10:08
1
What package provides
textcircled
?– Matthew Leingang
Dec 13 '10 at 13:08
1
@Matthew: It seems to be built-in with LaTeX. Works out of the box.
– Martin Tapankov
Dec 13 '10 at 13:24
2
You could use Unicode. U+2460-2473 for 1 to 20, U+24EA for 0, U+3251-325F for 21-35, and U+32B1-32BF for 36-50.
– user41833
Nov 28 '13 at 3:10