带标题的边框文本位于左边

带标题的边框文本位于左边

我尝试在左侧键入一个边注(书籍格式),并在其下方添加一条线,但与正文“垂直”,如下面的附件所示:

在此处输入图片描述

\documentclass[12pt]{article}

\usepackage{tcolorbox}

\usepackage{mdframed}

\newenvironment{myenv}[1]
{\mdfsetup{
        frametitle={\colorbox{white}{\space#1\space}},
        innertopmargin=10pt,
        frametitleaboveskip=-\ht\strutbox,
        frametitlealignment=\center,
        everyline=true
    }
    \begin{mdframed}%
    }
    {\end{mdframed}}


\newtcolorbox[auto counter,number within=section]{pabox}[2][]{%
    colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,
    title=Examp.~\thetcbcounter: #2,#1}

\title{Prayerbook}
\author{}

\begin{document}

\maketitle

\begin{pabox}[colback=yellow]{Paschal Season}
    
    From Bright Monday through the Leavetaking of Pascha, after the initial “Amen”, we immediately say: 
    
\end{pabox}


\begin{tcolorbox}[colframe=red!75!black,title=Pascal Season]
    
    From Bright Monday through the Leavetaking of Pascha, after the initial “Amen”, we immediately say:
    
\end{tcolorbox}

\end{document}

答案1

您可以通过在 中定义用户定义键来实现这一点tcolorbox。此代码中定义了一个新键mytitle,随后用于定义新的框样式。

\documentclass[12pt]{article}

\usepackage{blindtext}
\usepackage[skins]{tcolorbox}

\tcbset{%
    mytitle/.style={%
        enhanced,
        overlay={
            \node [rotate=90, anchor=south, fill=tcbcolframe!25] at (frame.west) {\itshape #1};
        },
    },
}

\newtcolorbox{mybox}[2][]{%
    mytitle={#2},
    toprule=0pt,
    bottomrule=0pt,
    rightrule=0pt,
    sharp corners,
    #1
}

\title{Prayerbook}
\author{}

\begin{document}
\maketitle
\blindtext

\begin{mybox}[colframe=blue]{Paschal Season}
    From Bright Monday through the Leavetaking of Pascha, after the initial “Amen”, we immediately say:\\
    \blindtext
\end{mybox}
\end{document}

在此处输入图片描述

相关内容