I want to embed tikzcircuit
s in tcolorbox
es in a document; I am struggling to find a way of making the box behaving more or less like an fbox
with respect to the width.
I am solving the problem by setting the width by hand (see code below), but it would be nice to have a way to tell tcolorbox
to make a box as wide as needed. Is it possible?
This is the MWE:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{tcolorbox}
\tcbset{common/.style={
colback=yellow!10,
colframe=blue!60,
halign=flush left, leftrule=4mm,
}}
\newtcolorbox{circbox}[3][]{common,
width=#2\linewidth, title = {#3}, nobeforeafter,
#1}
\begin{document}
\begin{circbox}{0.3}{Polarización}
\begin{tikzpicture}
\draw[thick] (0,0) circle (1cm);
\end{tikzpicture}
\end{circbox}
\begin{circbox}{0.5}{Señal}
\begin{tikzpicture}
\draw[thick] (0,0) circle (1cm) (1.3,0) circle (1cm);
\end{tikzpicture}
\end{circbox}
\bigskip
\fbox{
\begin{tikzpicture}
\draw[thick] (0,0) circle (1cm);
\end{tikzpicture}
}
\fbox{
\begin{tikzpicture}
\draw[thick] (0,0) circle (1cm) (1.3,0) circle (1cm);
\end{tikzpicture}
}
\end{document}
which, compiled, led to: