I am trying to circle some numbers inside tikz enviroment. I followed answers for this question: Good way to make \textcircled numbers?
And I used this solution, which work excellent inside normal text.
\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}
Unfortunately I encountered a problem. I want to create a few numbers in circle inside bigger tikz node. But it seems like new "nested" node inherits minimum width from "parent" node so the circle became very huge. Is there any way to work around this?
Thanks for any help.
EDIT:
I added MWE with my problem.
\documentclass{standalone}
\usepackage{tikz}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
\node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
\begin{document}
\begin{tikzpicture}
\tikzstyle{big}=[draw,rectangle,rounded corners, fill=blue!20,minimum width=2cm, minimum height=2cm]
\node[big] (0) {First number = \circled{20}, Second number = \circled{20}};
\end{tikzpicture}
\end{document}



tikzpictures. You can store the inner ones in\saveboxes and reuse them inside the outer tikzpicture, though, see https://tex.stackexchange.com/q/47377/121799. – May 01 '19 at 22:14\newcommand*\circled[1]{\tikz[baseline=(char.base)]{ \node[shape=circle,draw,inner sep=2pt] (char) {#1};}} \newsavebox\SBoxA
\newsavebox\SBoxB \newsavebox\SBoxC \begin{document} \savebox\SBoxA{\circled{1}}\savebox\SBoxB{\circled{2}}\savebox\SBoxC{\circled{3}}% Numbers aligned with the text: \circled{1} \circled{2} \circled{3} end.
\circled{\usebox{\SBoxA} \usebox{\SBoxB} \usebox{\SBoxC}} \end{document}` works.
– May 01 '19 at 22:17\documentclassand the appropriate packages that reproduces the problem in atikznode. Basic usage\begin{tikzpicture} \node at (0,0) {\circled{1} \circled{2} \circled{3}}; \end{tikzpicture}seems to work, even though it is not recommended. – Peter Grill May 01 '19 at 23:02tikzpictures are hard to predict, which makes it hard for others to reproduce the issue without knowing what precisely the OP did. And once we know we will be able to to provide a workaround for that specific case, but I am pretty sure that we won't be able to find something that always works, so my recommendation is: do not nest tikzpictures. – May 01 '19 at 23:21\nodeoptionbigis being inherited ny\circled, so if you change\circledto specifyminimum width=1em, minimum height=1em, then you get the desired results. However, please note @marmot's comments. – Peter Grill May 02 '19 at 08:10