以下mwe
展示了我目前正在工作的环境:
\documentclass{article}
\usepackage[tikz]{mdframed}
\definecolor{greentitle}{RGB}{165,224,168}
\newenvironment{notation}[1]
{\begin{mdframed}[
bottomline=true,
leftline=true,
linecolor=greentitle,
innerrightmargin=25pt,
singleextra={
\node[overlay,anchor=east,fill=greentitle,rotate=90,font=\footnotesize\scshape] at ([yshift=0.4pt]O|-P) {#1};
},
firstextra={
\node[overlay,anchor=east,fill=greentitle,rotate=90,font=\footnotesize\scshape] at ([yshift=0.4pt]O|-P) {#1};
},
]
}
{\end{mdframed}}
\begin{document}
\begin{notation}{Notation}
Sample Text
\end{notation}
\begin{notation}{Notation}
\begin{enumerate}
\item sample
\item sample
\item sample
\item sample
\item sample
\item sample
\end{enumerate}
\end{notation}
\begin{notation}{Notation}
\begin{enumerate}
\item sample
\item sample
\end{enumerate}
\end{notation}
\begin{notation}{Notation}
\begin{enumerate}
\item sample
\item sample
\end{enumerate}
\end{notation}
\end{document}
我的问题是,我希望环境能够扩展到任何单词的高度,在本例中,默认为 notation。因此,框架环境的最小高度应该是带框单词“notation”的高度。在最后的例子中,您可以看到底线与带框单词不对齐。
另外,我希望将方框内的单词固定在右上角的框架框外面,而不是原样。
答案1
这就是我所做的事情tcolorbox
:
\documentclass{article}
\usepackage{graphicx}
\usepackage[most]{tcolorbox}
\definecolor{greentitle}{RGB}{165,224,168}
\newcommand{\mytitle}[1]{\rotatebox[origin=c]{90}{#1}}
\newtcolorbox{notation}{
sharp corners,
bicolor,
sidebyside,
colback=greentitle,
colframe=greentitle,
colbacklower=white,
lefthand width=.2cm,
sidebyside align=top seam,
left=0pt,
middle=0pt,
sidebyside gap=10pt,
fontupper=\footnotesize\scshape,
}
\begin{document}
\begin{notation}
\mytitle{Notation}
\tcblower
Sample Text
\end{notation}
\begin{notation}
\mytitle{Notation}
\tcblower
\begin{enumerate}
\item sample
\item sample
\item sample
\item sample
\item sample
\item sample
\end{enumerate}
\end{notation}
\begin{notation}
\mytitle{Notation}
\tcblower
\begin{enumerate}
\item sample
\item sample
\end{enumerate}
\end{notation}
\begin{notation}
\mytitle{Notation}
\tcblower
\begin{enumerate}
\item sample
\item sample
\end{enumerate}
\end{notation}
\end{document}