将标题框移至 tcbtheorem 的右侧

将标题框移至 tcbtheorem 的右侧

我有以下文档,但希望标题(“c”是占位符)仅位于 tcbtheorem 的右侧(不要也位于示例 1.2: 旁边)。我还希望右侧的 c 位于带有橙色轮廓的灰色框中,就像“示例 1.1”等一样。如果没有标题,右侧不应有灰色框。我该怎么做?

\documentclass[11pt,a4paper]{article}
\usepackage[margin=1.75cm]{geometry}
\usepackage{amsmath,amssymb,microtype}
\usepackage{varwidth}
\usepackage[most]{tcolorbox}
\tcbuselibrary{skins}

\makeatletter

% THEOREM
\newtcbtheorem[auto counter,number within=section]{theorem}{Theorem}%
{enhanced,
frame empty,
interior empty,
coltitle=black,
boxsep=0pt, % Set boxsep to 0pt to remove inner padding
fonttitle=\bfseries,colbacktitle=cyan!15!white,
attach boxed title to top left={xshift=12pt,yshift=-1pt/2-\tcboxedtitleheight/2},
boxed title style={boxrule=1pt, boxsep=0pt,left=3pt,right=3pt,bottom=3pt,top=3pt}, % Adjust boxsep here as well
varwidth boxed title}{thm}

% LEMMA
\newtcbtheorem[use counter from=theorem, number within=section]{lemma}{Exam\smash{p}le}%
{enhanced,
breakable,
frame empty,
interior empty,
colframe=orange!50!white, 
coltitle=black,
boxsep=0pt, % Set boxsep to 0pt to remove inner padding
overlay={\node[
left, 
text=black,
anchor=east,
font=\bfseries] 
at (frame.north east) {#2};},
attach boxed title to top left={xshift=12pt,yshift=-1pt/2-\tcboxedtitleheight/2},
boxed title style={boxrule=1pt, boxsep=0pt,left=3pt,right=3pt,bottom=3pt,top=3pt}, % Adjust boxsep here as well
varwidth boxed title}{thm}

\makeatother

\renewcommand{\familydefault}{\sfdefault}

\begin{document}

    \section{First Section}


        \begin{lemma}{}{}
            lemma
        \end{lemma}
    
        \begin{lemma}{c}{}
            Some text
        \end{lemma}

\end{document}

在此处输入图片描述

相关内容