如何打造這樣的風格

如何打造這樣的風格

任何人都可以幫助我為我的課程做乳膠風格,如下面的螢幕截圖所示: 在此輸入影像描述

謝謝。

答案1

您可能知道,tcolorbox可以創建各種彩色框,還包括一個theorems庫來支援為定理、定義等創建彩色環境...

此類盒子的主要命令是:

\newtcbtheorem[init options]{env-name}{displayed name}{format options}{reference prefix}

第 16.1 節對此進行了解釋tcolorbox 文檔。此指令建立一個env-name具有兩個強制參數的環境,一個定理標題和一個標籤,其前面將reference prefix建立與該特定框關聯的標籤。

以下程式碼展示如何使用三個\newtcbtheorem指令來定義具有所需樣式的定理、定義和推論。所有框都會在頁面邊界上斷開,但只有第一個片段會被標記。如果框內容高度比旋轉標題高度短,則會出現不良效果,如第一個範例所示。

(附註:如果以下程式碼顯示與tcolorbox選項相關的錯誤,請更新tcolorbox套件`)

\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}

\tcbset{%
    theo/.style={%
        enhanced,
        breakable,
        sharp corners,
        toprule=0pt, rightrule=0pt, bottomrule=0pt, leftrule=1mm,
        colback=#1!5, colframe=#1!80!black, coltitle=#1!80!black, 
        detach title,
        overlay unbroken and first ={
            \node[rotate=90, minimum width=1cm, anchor=south, font=\bfseries] 
               at (frame.west) {\tcbtitle};
        }
    }
}

\newtcbtheorem[auto counter]{mytheo}{Théorème}
{theo=green}{th}

\newtcbtheorem[auto counter]{mydef}{Définition}
{theo=blue}{df}

\newtcbtheorem[auto counter]{mycoro}{Corollaire}
{theo=green}{cl}

\begin{document}

\begin{mytheo}{}{}
\lipsum[1]
\end{mytheo}

\begin{mydef}{}{}
\lipsum[2]
\end{mydef}

\begin{mycoro}{}{}
\lipsum[3]
\end{mycoro}

\end{document}

在此輸入影像描述

相關內容