答案1
使用titlesec
和tcolorbox
。看看这个解决方案:章节样式与 tcolorbox 有关?它使用不同的盒子布局,但您可以调整tcolorbox
选项以获得所需的布局。
这是针对编号章节的解决方案的初步调整:您需要通过调整颜色、尺寸等对其进行调整。
\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}
{}
{20pt}
{%
\begin{tcolorbox}[
enhanced,
rounded corners,
shadow={1mm}{-1mm}{-2.2mm}{black!20!white},
colback=white,
boxrule=0mm,
arc=3mm,
leftrule=0pt,
rightrule=0pt,
fontupper=\color{blueish}\sffamily\bfseries\huge,
width=\textwidth-3.2mm, % account for shadow width.
top=0.6cm,
bottom=0.6cm,
overlay={
\node[
fill=blueish,
line width=0cm,
inner sep=0pt,
text width=13mm,
minimum height=16mm,
align=center,
anchor=south east,
xshift=2.2mm, yshift=9mm,
font=\color{white}\sffamily\bfseries\fontsize{30}{36}\selectfont
]
(chapname) at (frame.north east) {\thechapter};
\node[color=gray,font=\large,anchor=base east,inner sep=1mm] at (chapname.base west)
{\chaptertitlename};
}
]
\MakeUppercase{#1}
\end{tcolorbox}%
}
这给出