我正在使用 tcolorbox 和 tcbset,標題位於頁邊距中,並且每個連續的標題一起運行

我正在使用 tcolorbox 和 tcbset,標題位於頁邊距中,並且每個連續的標題一起運行

在我的上一個問題中,我需要 tcolorbox 的幫助才能在左邊距(並旋轉 90 度)為我的框創建一個「標題」。這個解決方案很棒,但在某些情況下,就像下面我的 MWE 中一樣,「標題」一起運行。

\documentclass[12pt]{article}

\usepackage{framed}
\usepackage{color}

\usepackage[skins,breakable]{tcolorbox} % changed <<<<<<<<<<<<

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

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

%opening
\title{}
\author{}



\begin{document}

\maketitle


Gladsome Light of the Holy Glory of the Immortal Father, Heavenly, Holy, Blessed: O Jesus Christ. Now that we have come to the setting of the sun, and behold the light of evening, we praise God: Father, Son, and Holy Spirit, for meet it is at all times to worship Thee with voices of praise, O Son of God and Giver of life: therefore, all the world doth glorify Thee.\\

We now sing the appointed Prokimenon according to the day of the week:

\section*{Evening Prokimenon}

\begin{mybox}[colframe=blue]{Saturday Evening}
    
    
    The Lord is King: / He is robed in majesty.\\
    
    The Lord is robed, He is girded with strength.\\
    
    For He has established the world, so that it shall never be
    moved.\\
    
    Holiness befits Thy house, O Lord, forevermore!\\
    
\end{mybox}

\begin{mybox}[colframe=blue]{Sunday Evening}

    
    Behold now, bless the Lord, / all you servants of the Lord.\\
    
    
\end{mybox}

\begin{mybox}[colframe=blue]{Monday Evening}

    
    The Lord will hear me / when I call upon Him.\\
    
    When I called, the God of my righteousness heard me.\\
\end{mybox}


\end{document}

結果

我對 tcolorbox 幾乎一無所知,只是對 LaTeX 中的新環境和新指令有些了解,所以我嘗試了一些新增的內容:

\small

以及其他一些字體大小如下:

{\small{\itshape #1}}

但由於我不知道在哪裡更改框的字體大小,我不確定如何繼續。

答案1

我對mytitle風格做了一些改變。標題現在跨越了框的整個文字高度。如果您事先知道框高度會很小,則可以手動將其設定為足夠大的值,以便正確呈現標題(請參閱本範例中的第二個和第三個框)。

\documentclass[12pt]{article}

\usepackage{framed}
\usepackage{color}

\usepackage[skins,breakable]{tcolorbox} % changed <<<<<<<<<<<<

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

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

%opening
\title{}
\author{}



\begin{document}
    
    \maketitle
    
    
    Gladsome Light of the Holy Glory of the Immortal Father, Heavenly, Holy, Blessed: O Jesus Christ. Now that we have come to the setting of the sun, and behold the light of evening, we praise God: Father, Son, and Holy Spirit, for meet it is at all times to worship Thee with voices of praise, O Son of God and Giver of life: therefore, all the world doth glorify Thee.\\
    
    We now sing the appointed Prokimenon according to the day of the week:
    
    \section*{Evening Prokimenon}
    
    \begin{mybox}[colframe=blue]{Saturday Evening}
        The Lord is King: / He is robed in majesty.\\
        
        The Lord is robed, He is girded with strength.\\
        
        For He has established the world, so that it shall never be
        moved.\\
        
        Holiness befits Thy house, O Lord, forevermore!
    \end{mybox}
    
    \begin{mybox}[colframe=blue,height=5em]{Sunday Evening}
        Behold now, bless the Lord, / all you servants of the Lord.
    \end{mybox}
    
    \begin{mybox}[colframe=blue,height=5em]{Monday Evening}
        The Lord will hear me / when I call upon Him.\\
        
        When I called, the God of my righteousness heard me.
    \end{mybox}
    
    
\end{document}

在此輸入影像描述

相關內容