答案1
第一个初步版本,通过改变框架和内部代码tcolorbox
,并在左上角设置一个带有阴影的标题。
基本配置都在 的定义中strangebox
。
内部/框架代码不适应盒子内容的潜在形状,即向内的扭结可能会被文字等套印。
使用顺序的第二个强制参数strangebox
来控制内部弯曲的量,即\begin{strangebox}{Your title}{2cm}
会在外部使用扭结,即像“数组”一样,而-2cm
会将内部扭结移动2cm
。
\documentclass{book}
\usepackage[margin=2cm]{geometry}
\usepackage[svgnames,dvipsnames,x11names]{xcolor}
\usepackage{blindtext}
\usepackage[most]{tcolorbox}
\usetikzlibrary{calc,shadows}
\newtcolorbox{strangebox}[3][]{%
enhanced,
nobeforeafter,
sharp corners,
colupper=Green4,
colback=white,
frame code={%
\path[drop shadow,tcbcol@frame,fill=tcbcol@back,line width=1pt,draw] (frame.north east) -- ($(frame.north east)!.5!([xshift=#3]frame.south east)$) -- (frame.south east) -- (frame.south west) -- (frame.north west) -- cycle;
},
interior code={
\path[color=tcbcol@back] (interior.north east) -- ($(frame.north east)!.5!([xshift=#3]frame.south east)$) -- (frame.south east) -- cycle;
},
fonttitle=\bfseries\Large\sffamily,
attach boxed title to top left,
boxed title style={enhanced,colback=cyan,coltitle=white,arc=2mm, auto outer arc,boxsep=3mm},
title={\MakeUppercase{#2}},
width=0.8\textwidth,
#1
}
\makeatletter
% Redefining the chapter head macro.
\def\@makechapterhead#1{%
\begin{strangebox}{Activity Sheet}{-1cm}
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\huge\bfseries \@chapapp\space \thechapter~
\fi
\fi
% \interlinepenalty\@M
\huge\bfseries #1\par\nobreak
}%
\end{strangebox}
}
\makeatother
\begin{document}
\chapter{Showcase: Analysing a science media article}
\end{document}