取得 tcolorbox 選項的值

取得 tcolorbox 選項的值

我嘗試從tcolorbox的選項取得值,如下例所示,但失敗了。我錯過了什麼嗎?

\documentclass{article}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{tcolorbox}[width=0.5\textwidth]
  \pgfkeysvalueof{/tcb/width}%This typeset nothing.
  \rule{0.5*\pgfkeysvalueof{/tcb/width}}{5pt} %This causes error.
\end{tcolorbox}
\end{document}

相關內容