I would like to dynamically calculate the width of a tcolorbox. Is this possible using pgfmath?
This is what I have so far:
\documentclass{article}
\usepackage{tikz}
\usepackage{tcolorbox}
\begin{document}
\pgfmathsetlengthmacro{\y}{%
floor(\linewidth / \baselineskip) * \baselineskip}
y: \y
\begin{tcolorbox}[width={\pgfmathsetlengthmacro{\x}{%
floor(\linewidth / \baselineskip) * \baselineskip} \x}]
This is my box.
\end{tcolorbox}
\end{document}
The problem is that it produces the error message: ! Missing number, treated as zero.. I guess the macro does not actually get evaluated before the width option looks for a number. Is there a way to achieve such a thing?


