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}
tikzpicture
s. You can store the inner ones in\savebox
es and reuse them inside the outer tikzpicture, though, see tex.stackexchange.com/q/47377/121799.\documentclass{article} \usepackage{tikz} \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.\documentclass
and the appropriate packages that reproduces the problem in atikz
node. 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.tikzpicture
s 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.