
답변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}