tcolorbox:框架边框处的旋转文本

tcolorbox:框架边框处的旋转文本

我正在尝试将文本放在框的左边框。目前我有这个:

\newtcolorbox{reminderbox}[1]{enhanced,
before skip=2mm,after skip=3mm,
boxrule=0.4pt,left=5mm,right=2mm,top=1mm,bottom=1mm,
colback=white,
colframe=black,
sharp corners,
underlay={%
    \path[draw=none] (interior.south west) rectangle node[black,rotate=90]{\small #1} ([xshift=4mm]interior.north west);
}}

我是这样使用它的:

\begin{reminderbox}{For reference:}
    This is a well known fact!
\end{reminderbox}

这使: 我的问题的输出

如何让框与文本一起缩放?

答案1

可能需要一些额外的工作,但您可以从这样的事情开始。

\documentclass{article}
\usepackage[most]{tcolorbox}

\newlength{\mywidth}

\newtcolorbox{reminderbox}[1]{enhanced,
before skip=2mm,after skip=3mm,
boxrule=0.4pt,left=5mm,right=2mm,top=1mm,bottom=1mm,
colback=white,
colframe=black,
sharp corners,
underlay={%
    \path[draw=none] (interior.south west) rectangle node[black,rotate=90]{\small #1} ([xshift=4mm]interior.north west);
},
code={\settowidth{\mywidth}{#1}},
height=\mywidth,
}

\begin{document}
\begin{reminderbox}{For reference:}
    This is a well known fact!
\end{reminderbox}

\begin{reminderbox}{Another reference:}
    This is a well known fact!
\end{reminderbox}
\end{document}

在此处输入图片描述

相关内容