使用与以下相同的代码如何自定义“可破坏盒子内的可破坏盒子”的标题?非常感谢@Ignasi,我遇到了以下问题:
一个例子:
% !TeX program = xelatex
\documentclass[fromlogo = true]{article}
\usepackage{varwidth,cancel}
\usepackage{eso-pic,mathtools}
\usepackage{tikz}
\usepackage[many]{tcolorbox}
\tcbuselibrary{skins,breakable,xparse}
\tikzset{coltria/.style = {fill=bllue}}
\tikzset{cccoltria/.style= {fill=bllack}}
\tikzset{cccccoltria/.style = {fill=red}}
\usepackage{refcount}
\usetikzlibrary{backgrounds,calc}
\usepackage{tikzpagenodes}
\usepackage{lipsum}
\usepackage{fontspec}
\usepackage[first=-90, last = 90]{lcg}
\newcommand{\random}{0.2*rand}
\newcommand{\rulewidth}{5 mm}
\definecolor{grey}{RGB}{220,220,220}
\usepackage{varwidth}
\allowdisplaybreaks
\usepackage{polyglossia}
\usepackage{amsmath}
\usetikzlibrary{shapes.callouts,shapes.arrows,matrix,shapes.misc,shadows.blur,shapes,arrows, patterns, hobby,shapes.multipart}
\usepackage{pgfplots}
\pgfplotsset{compat=1.6}
\definecolor{bllue}{RGB}{0,0,255}
\definecolor{bllack}{RGB}{0,255,0}
\newcommand{\bllackpicture}{\textcolor{black}{Box}}
\newcommand{\redpicture}{
\textcolor{red}{Box}}
\newcommand{\blluepicture}{
\textcolor{bllue}{Box}}
\newcommand{\Rn}{purple}
\tcbset{setskinf/.style = {skin first is subskin of={emptyfirst}{
oversize, enhanced,
frame code = {\path[tcb fill frame,rounded corners] (frame.south west)--(frame.north west) -- (frame.north east)--(frame.south east)--cycle;
\path[#1] ([xshift = 2.5mm, yshift = 1mm]frame.south west) -- +(120:2mm) -- +(60:2mm)-- cycle;},
interior code={\path[tcb fill interior,rounded corners] (interior.south west|-frame.south)--(interior.north west)--([xshift=-4.8mm]interior.north east)--([yshift=-4.8mm]interior.north east)--(interior.south east|-frame.south)--cycle;}
,}}}
\tcbset{setskinm/.style = {
skin middle is subskin of={emptymiddle}{
oversize, enhanced,
frame code = {\path[tcb fill frame,rounded corners] (frame.south west)--(frame.north west) -- (frame.north east)--(frame.south east)--cycle;
\path[#1] ([xshift = 2.5mm, yshift = -1mm]frame.north west) -- +(240:2mm) -- +(300:2mm)-- cycle;
\path[#1] ([xshift = 2.5mm, yshift = 1mm]frame.south west) -- +(120:2mm) -- +(60:2mm)-- cycle;},
interior code={\path[tcb fill interior,rounded corners] (interior.south west|-frame.south)--(interior.north west)--([xshift=-4.8mm]interior.north east)--([yshift=-4.8mm]interior.north east)--(interior.south east|-frame.south)--cycle;}
,}}}
\tcbset{setskinl/.style = {
skin last is subskin of={emptylast}{
oversize, enhanced,
frame code = {\path[tcb fill frame,rounded corners] (frame.south west)--(frame.north west) -- (frame.north east)--(frame.south east)--cycle;
\path[#1] ([xshift = 2.5mm, yshift = -1mm]frame.north west) -- +(240:2mm) -- +(300:2mm)-- cycle;},
interior code={\path[tcb fill interior,rounded corners] (interior.south west|-frame.south)--(interior.north west)--([xshift=-4.8mm]interior.north east)--([yshift=-4.8mm]interior.north east)--(interior.south east|-frame.south)--cycle;}
,}}}
\tcbset{boxedtitle/.style = {attach boxed title to top left = {xshift = 1cm, yshift*=1mm-\tcboxedtitleheight}, varwidth boxed title*=-3cm,
boxed title style={frame code = {
\path[fill=tcbcol@back!30!black]
([yshift = -1mm,xshift = -1mm] frame.north west)
arc[start angle=0,end angle=180,radius=1mm]
([yshift = -1mm,xshift = 1mm] frame.north east)
arc[start angle = 180, end angle = 0, radius = 1mm];
\path[left color = tcbcol@back!60!black, right color = tcbcol@back!60!black, middle color = tcbcol@back!80!black]
([xshift=-2mm]frame.north west)--([xshift=2mm]frame.north east) [rounded corners=1mm]--([xshift=1mm,yshift=-1mm]frame.north east) --(frame.south east)--(frame.south west)
--([xshift=-1mm,yshift=-1mm]frame.north west)
[sharp corners]-- cycle;
},interior engine=empty,
},
fonttitle=\bfseries}}
\tcbset{normal/.style n args = {1}{enlarge top initially by = 1cm,enlarge bottom finally by = 7mm,enlarge left by = 5mm,
enlarge right by = 5mm,
width = \linewidth+2cm,
overlay unbroken = {\draw[\Rn!70!black, line width = .8mm, rounded corners]
([xshift = -5mm, yshift = -5mm]frame.south west)|-([yshift = 9mm]frame.north)-|
([xshift = 5mm, yshift = -5mm]frame.south east) -- cycle;
\coordinate (outernw) at ([shift = {(-5mm,1cm)}]frame.north west);
\node[fill=\Rn!70!black, minimum height = 5mm,
anchor = north west, text = white, rounded corners] at ([xshift = 1cm]outernw) (outertitle) {Title #1};
\path[fill = \Rn!30!black]
([yshift = -1mm, xshift = -1mm]outertitle.north west)
arc[start angle = 0, end angle = 180, radius = 1mm]
([yshift = -1mm, xshift = 1mm]outertitle.north east)
arc[start angle = 180, end angle = 0, radius = 1mm];
\path[left color = \Rn!60!black, right color = \Rn!60!black, middle color = \Rn!80!black]
([xshift = -2mm]outertitle.north west) -- ([xshift = 2mm]outertitle.north east)[rounded corners = 1mm]
-- ([xshift = 1mm, yshift = -1mm]outertitle.north east) -- (outertitle.south east) -- (outertitle.south west)
-- ([xshift = -1mm, yshift = -1mm]outertitle.north west)
[sharp corners] -- cycle;
\node[text = white] at (outertitle) {Title #1};
},
overlay first = {\draw[\Rn!70!black, line width = .8mm, rounded corners]
([xshift = -5mm]frame.south west)|-([yshift = 9mm]frame.north)-|
([xshift = 5mm]frame.south east);
\coordinate (outernw) at ([shift = {(-5mm,1cm)}]frame.north west);
\node[fill=\Rn!70!black, minimum height = 5mm,
anchor = north west, text = white, rounded corners] at ([xshift = 1cm]outernw) (outertitle) {Question #1};
\path[fill = \Rn!30!black]
([yshift = -1mm, xshift = -1mm]outertitle.north west)
arc[start angle = 0, end angle = 180, radius = 1mm]
([yshift = -1mm, xshift = 1mm]outertitle.north east)
arc[start angle = 180, end angle = 0, radius = 1mm];
\path[left color = \Rn!60!black, right color = \Rn!60!black, middle color = \Rn!80!black]
([xshift = -2mm]outertitle.north west) -- ([xshift = 2mm]outertitle.north east)[rounded corners = 1mm]
-- ([xshift = 1mm, yshift = -1mm]outertitle.north east) -- (outertitle.south east) -- (outertitle.south west)
-- ([xshift = -1mm, yshift = -1mm]outertitle.north west)
[sharp corners] -- cycle;
\node[text = white] at (outertitle) {Question #1};
},
overlay middle = {
\draw[\Rn!70!black, line width = .8mm]
([xshift = -5mm]frame.north west)--([xshift = -5mm]frame.south west)
([xshift = 5mm]frame.north east)--([xshift = 5mm]frame.south east);
},
overlay last = {\draw[\Rn!70!black, line width = .8mm, rounded corners]
([xshift = -5mm]frame.north west)|-([yshift = -5mm]frame.south)-|
([xshift = 5mm]frame.north east);
}
}}
\tcbset{top/.style n args = {1}{enlarge top initially by = 1cm, enlarge bottom finally by = 1mm,
enlarge left by = 5mm,
enlarge right by = 5mm,
width = \linewidth+2cm,
overlay unbroken and first = {
\draw[\Rn!70!black, line width = .8mm, rounded corners]
([xshift = -5mm, yshift = -2mm]frame.south west)|-([yshift = 9mm]frame.north)-|
([xshift = 5mm, yshift = -2mm]frame.south east);
\coordinate (outernw) at ([shift = {(-5mm,1cm)}]frame.north west);
\node[fill=\Rn!70!black, minimum height = 5mm,
anchor = north west, text = white, rounded corners] at ([xshift = 1cm]outernw) (outertitle) {Title #1};
\path[fill = \Rn!30!black]
([yshift = -1mm, xshift = -1mm]outertitle.north west)
arc[start angle = 0, end angle = 180, radius = 1mm]
([yshift = -1mm, xshift = 1mm]outertitle.north east)
arc[start angle = 180, end angle = 0, radius = 1mm];
\path[left color = \Rn!60!black, right color = \Rn!60!black, middle color = \Rn!80!black]
([xshift = -2mm]outertitle.north west) -- ([xshift = 2mm]outertitle.north east)[rounded corners = 1mm]
-- ([xshift = 1mm, yshift = -1mm]outertitle.north east) -- (outertitle.south east) -- (outertitle.south west)
-- ([xshift = -1mm, yshift = -1mm]outertitle.north west)
[sharp corners] -- cycle;
\node[text = white] at (outertitle) {Title #1};
},
overlay middle and last = {
\draw[\Rn!70!black, line width = .8mm]
([xshift = -5mm]frame.north west)--([xshift = -5mm]frame.south west)
([xshift = 5mm]frame.north east)--([xshift = 5mm]frame.south east);
}}}
\tcbset{middle/.style n args = {1}{enlarge top initially by = 1mm, enlarge bottom finally by = 1mm,
enlarge left by = 5mm,
enlarge right by = 5mm,
width = \linewidth+2cm,
overlay unbroken = {
\draw[\Rn!70!black,line width = .8mm]
([shift = {(-5mm,3mm)}]frame.north west)--([shift = {(-5mm,-3mm)}]frame.south west)
([shift = {(5mm,3mm)}]frame.north east)--([shift = {(5mm,-3mm)}]frame.south east);
},
overlay first = {
\draw[\Rn!70!black,line width = .8mm]
([shift = {(-5mm,5mm)}]frame.north west)--([xshift = -5mm]frame.south west)
([shift = {(5mm,5mm)}]frame.north east)--([xshift = 5mm]frame.south east);
},
overlay middle = {
\draw[\Rn!70!black,line width = .8mm]
([xshift = -5mm]frame.north west)--([xshift = -5mm]frame.south west)
([xshift = 5mm]frame.north east)--([xshift = 5mm]frame.south east);
},
overlay last = {
\draw[\Rn!70!black,line width = .8mm]
([xshift = -5mm]frame.north west)--([shift = {(-5mm,-5mm)}]frame.south west)
([xshift = 5mm]frame.north east)--([shift = {(5mm,-5mm)}]frame.south east);
},
}}
\tcbset{bottom/.style = {enlarge bottom finally by = 7mm, enlarge top initially by = 1mm,
enlarge left by = 5mm,
enlarge right by = 5mm,
width = \linewidth+2cm,
overlay unbroken and last = {
\draw[\Rn!70!black, line width = .8mm, rounded corners]
([xshift = -5mm, yshift = 2mm]frame.north west)|-([yshift = -5mm]frame.south)-|
([xshift = 5mm, yshift = 2mm]frame.north east);
},
overlay first and middle = {
\draw[\Rn!70!black, line width = .8mm]
([xshift = -5mm]frame.north west)--([xshift = -5mm]frame.south west)
([xshift = 5mm]frame.north east)--([xshift = 5mm]frame.south east);
}}}
\newtcolorbox{generic}[5][]{empty,leftrule=\rulewidth,oversize, enhanced,
frame style = {left color = #2!20, right color = white},interior style = {left color = #2!5, right color = white}, left = 0pt, right = 0pt, %top = 4pt, bottom = 4pt,
before skip = 0pt, after skip = 0pt,% boxrule = 0.1pt,
title = #3, underlay={\begin{tcbclipinterior}
\shade[inner color = #2!10, outer color = white] (interior.north west) circle (2cm);
\draw[help lines, step = 5mm, #2!5,shift={(interior.north west)}] (interior.south west) grid (interior.north east);
\end{tcbclipinterior}
}, drop small lifted shadow,
breakable,rotate = \random
,
frame code = {\path[tcb fill frame,rounded corners] (frame.south west)--(frame.north west) -- (frame.north east)--(frame.south east)--cycle;
},
interior code={\path[tcb fill interior,rounded corners] (interior.south west|-frame.south)--(interior.north west)--([xshift=-4.8mm]interior.north east)--([yshift=-4.8mm]interior.north east)--(interior.south east|-frame.south)--cycle;},
% test
setskinf = {#4},setskinm = {#4},setskinl = {#4},#5, #1}
\newcommand{\bllack}[3][]{\begin{generic}[#1]{bllack}{\bllackpicture}{cccoltria}
{normal = #2}
#3
\end{generic}}
\newcommand{\tbllack}[3][]{\begin{generic}[#1]{bllack}{\bllackpicture}{cccoltria}
{top = #2}
#3
\end{generic}}
\newcommand{\mbllack}[2][]{\begin{generic}[#1]{bllack}{\bllackpicture}{cccoltria}
{middle}
#2
\end{generic}}
\newcommand{\bbllack}[2][]{\begin{generic}[#1]{bllack}{\bllackpicture}{cccoltria}
{bottom}
#2
\end{generic}}
\newcommand{\red}[3][]{
\begin{generic}[#1]{red}{\redpicture}{cccccoltria}
{normal = #2}
#3
\end{generic}}
\newcommand{\tred}[3][]{
\begin{generic}[#1]{red}{\redpicture}{cccccoltria}
{top = #2}
#3
\end{generic}}
\newcommand{\mred}[2][]{
\begin{generic}[#1]{red}{\redpicture}{cccccoltria}
{middle}
#2
\end{generic}}
\newcommand{\bred}[2][]{
\begin{generic}[#1]{red}{\redpicture}{cccccoltria}
{bottom}
#2
\end{generic}}
\newcommand{\bllue}[3][]{
\begin{generic}[#1]{bllue}{\blluepicture}{coltria}
{normal = #2}
#3
\end{generic}}
\newcommand{\tbllue}[3][]{
\begin{generic}[#1]{bllue}{\blluepicture}{coltria}
{top = #2}
#3
\end{generic}}
\newcommand{\mbllue}[2][]{
\begin{generic}[#1]{bllue}{\blluepicture}{coltria}
{middle}
#2
\end{generic}}
\newcommand{\bbllue}[2][]{
\begin{generic}[#1]{bllue}{\blluepicture}{coltria}
{bottom}
#2
\end{generic}}
\newcommand{\tcblowerr}{\begin{tcblowerbox}%{middle}
\tcblower
\end{tcblowerbox}}
\begin{document}
%
\tbllack{1}{\lipsum[1-1]}
\mred{\lipsum[1-1]}
\bbllue{\lipsum[1-1]}
\tbllack{2}{\lipsum[1-1]}
\bred{\lipsum[1-1]}
\bllue{3}{\lipsum[1-1]}
\tred{4}{\lipsum[1-1]}
\mbllue{\lipsum[1-1]}
\bbllack{\lipsum[1-1]}
\bllack{6}{\lipsum[1-1]}
%
\tbllack{1}{\lipsum[1-1]}
\mred{\lipsum[1-1]}
\bbllue{\lipsum[1-1]}
\tbllack{2}{\lipsum[1-1]}
\bred{\lipsum[1-1]}
%\newpage
%\section{Title}
\bllue{3}{\lipsum[1-1]}
\tred{4}{\lipsum[1-1]}
\mbllue{\lipsum[1-1]}
\bbllack{\lipsum[1-1]}
\bllack{6}{\lipsum[1-1]}
%
\tbllue{7}{\lipsum[1-1]}
\mbllack{\lipsum[1-1]}
\bred{\lipsum[1-1]}
\red{{8}}{\lipsum[1-1]}
%
%\newpage
%\section{Title}
\bllue{3}{\lipsum[1-1]}
\tred{4}{\lipsum[1-1]}
\mbllue{\lipsum[1-1]}
\bbllack{\lipsum[1-1]}
\bllack{6}{\lipsum[1-1]}
%
\tbllue{7}{\lipsum[1-1]}
\mbllack{\lipsum[1-1]}
\bred{\lipsum[1-2]}
\red{{8}}{\lipsum[1-1]}
%
\tbllack{1}{\lipsum[1-1]}
\mred{\lipsum[1-1]}
\bbllue{\lipsum[1-1]}
\tbllack{2}{\lipsum[1-1]}
\bred{\lipsum[1-1]}
\bllue{3}{\lipsum[1-1]}
\tred{4}{\lipsum[1-1]}
\mbllue{\lipsum[1-1]}
\bbllack{\lipsum[1-1]}
\bllack{6}{\lipsum[1-1]}
%
\tbllack{1}{\lipsum[1-1]}
\mred{\lipsum[1-1]}
\bbllue{\lipsum[1-1]}
\tbllack{2}{\lipsum[1-1]}
\bred{\lipsum[1-1]}
%\newpage
%\section{Title}
\bllue{3}{\lipsum[1-1]}
\tred{4}{\lipsum[1-1]}
\mbllue{\lipsum[1-1]}
\bbllack{\lipsum[1-1]}
\bllack{6}{\lipsum[1-1]}
%
\tbllue{7}{\lipsum[1-1]}
\mbllack{\lipsum[1-1]}
\bred{\lipsum[1-1]}
\red{{8}}{\lipsum[1-1]}
%
%\newpage
%\section{Title}
\bllue{3}{\lipsum[1-1]}
\tred{4}{\lipsum[1-1]}
\mbllue{\lipsum[1-1]}
\bbllack{\lipsum[1-1]}
\bllack{6}{\lipsum[1-1]}
%
\tbllue{7}{\lipsum[1-1]}
\mbllack{\lipsum[1-1]}
\bred{\lipsum[1-2]}
\red{{8}}{\lipsum[1-1]}
\end{document}
- 第 19 页和第 21 页的框坏了,但为什么不分别放在第 18 页和第 20 页呢?
- 为什么第 22 页、第 8 页上的框不是正好位于彼此的正下方?
我的主要问题是
- 我怎样才能强制将第 19 页和第 21 页的框分别放置在第 18 页和第 20 页?
- 我怎样才能将各个盒子精确地放置在彼此之下?
答案1
我不想深入研究你的代码,但肯定有什么地方不对劲。我show bounding box
在你的一些框中添加了选项(\tred[show bounding box]{1}{\lipsum[1-1]}
),结果如下:
如您所见,所有框都完全对齐,bounding box
但其中一些框bounding box
不是external
框。现在轮到您找出错位的地方了。
关于代码的一些评论。
它包含许多示例未使用的包/库(mathtools、pgfplots 等)。最好在示例中避免使用它们。
你可以用 声明样式xxxxx/.style n args = {1}{
。如果样式只使用一个参数,你可以将其声明为非参数样式,并且仍然在此样式中xxxxx/.style = {
使用。声明默认接受一个参数。#1
.style
最后我认为rotate=\random
在generic
盒子里会在不同的盒子之间做出不完美的调整。
答案2
感谢@Ignasi 的建议,错位问题(我的第二个问题)已解决。选项是oversize
导致setskin
错位的原因。
但我的第一个疑问仍未解决。
现在的代码是:
% !TeX program = xelatex
\documentclass[fromlogo = true]{article}
\usepackage{varwidth,cancel}
\usepackage{eso-pic,mathtools}
\usepackage{tikz}
\usepackage[many]{tcolorbox}
\tcbuselibrary{skins,breakable,xparse}
\tikzset{coltria/.style = {fill=bllue}}
\tikzset{cccoltria/.style= {fill=bllack}}
\tikzset{cccccoltria/.style = {fill=red}}
\usepackage{refcount}
\usetikzlibrary{backgrounds,calc}
\usepackage{tikzpagenodes}
\usepackage{lipsum}
\usepackage{fontspec}
\usepackage[first=-90, last = 90]{lcg}
\newcommand{\random}{0.2*rand}
\newcommand{\rulewidth}{5 mm}
\definecolor{grey}{RGB}{220,220,220}
\usepackage{varwidth}
\allowdisplaybreaks
\usepackage{polyglossia}
\usepackage{amsmath}
\usetikzlibrary{shapes.callouts,shapes.arrows,matrix,shapes.misc,shadows.blur,shapes,arrows, patterns, hobby,shapes.multipart}
\usepackage{pgfplots}
\pgfplotsset{compat=1.6}
\definecolor{bllue}{RGB}{0,0,255}
\definecolor{bllack}{RGB}{0,255,0}
\newcommand{\bllackpicture}{\textcolor{black}{Box}}
\newcommand{\redpicture}{
\textcolor{red}{Box}}
\newcommand{\blluepicture}{
\textcolor{bllue}{Box}}
\newcommand{\Rn}{purple}
\tcbset{setskinf/.style = {skin first is subskin of={emptyfirst}{
enhanced,
frame code = {\path[tcb fill frame,rounded corners] (frame.south west)--(frame.north west) -- (frame.north east)--(frame.south east)--cycle;
\path[#1] ([xshift = 2.5mm, yshift = 1mm]frame.south west) -- +(120:2mm) -- +(60:2mm)-- cycle;},
interior code={\path[tcb fill interior,rounded corners] (interior.south west|-frame.south)--(interior.north west)--([xshift=-4.8mm]interior.north east)--([yshift=-4.8mm]interior.north east)--(interior.south east|-frame.south)--cycle;}
,}}}
\tcbset{setskinm/.style = {
skin middle is subskin of={emptymiddle}{
enhanced,
frame code = {\path[tcb fill frame,rounded corners] (frame.south west)--(frame.north west) -- (frame.north east)--(frame.south east)--cycle;
\path[#1] ([xshift = 2.5mm, yshift = -1mm]frame.north west) -- +(240:2mm) -- +(300:2mm)-- cycle;
\path[#1] ([xshift = 2.5mm, yshift = 1mm]frame.south west) -- +(120:2mm) -- +(60:2mm)-- cycle;},
interior code={\path[tcb fill interior,rounded corners] (interior.south west|-frame.south)--(interior.north west)--([xshift=-4.8mm]interior.north east)--([yshift=-4.8mm]interior.north east)--(interior.south east|-frame.south)--cycle;}
,}}}
\tcbset{setskinl/.style = {
skin last is subskin of={emptylast}{
enhanced,
frame code = {\path[tcb fill frame,rounded corners] (frame.south west)--(frame.north west) -- (frame.north east)--(frame.south east)--cycle;
\path[#1] ([xshift = 2.5mm, yshift = -1mm]frame.north west) -- +(240:2mm) -- +(300:2mm)-- cycle;},
interior code={\path[tcb fill interior,rounded corners] (interior.south west|-frame.south)--(interior.north west)--([xshift=-4.8mm]interior.north east)--([yshift=-4.8mm]interior.north east)--(interior.south east|-frame.south)--cycle;}
,}}}
\tcbset{boxedtitle/.style = {attach boxed title to top left = {xshift = 1cm, yshift*=1mm-\tcboxedtitleheight}, varwidth boxed title*=-3cm,
boxed title style={frame code = {
\path[fill=tcbcol@back!30!black]
([yshift = -1mm,xshift = -1mm] frame.north west)
arc[start angle=0,end angle=180,radius=1mm]
([yshift = -1mm,xshift = 1mm] frame.north east)
arc[start angle = 180, end angle = 0, radius = 1mm];
\path[left color = tcbcol@back!60!black, right color = tcbcol@back!60!black, middle color = tcbcol@back!80!black]
([xshift=-2mm]frame.north west)--([xshift=2mm]frame.north east) [rounded corners=1mm]--([xshift=1mm,yshift=-1mm]frame.north east) --(frame.south east)--(frame.south west)
--([xshift=-1mm,yshift=-1mm]frame.north west)
[sharp corners]-- cycle;
},interior engine=empty,
},
fonttitle=\bfseries}}
\tcbset{normal/.style n args = {1}{enlarge top initially by = 1cm,enlarge bottom finally by = 7mm,enlarge left by = 5mm,
enlarge right by = 5mm,
width = \linewidth+2cm,
overlay unbroken = {\draw[\Rn!70!black, line width = .8mm, rounded corners]
([xshift = -5mm, yshift = -5mm]frame.south west)|-([yshift = 9mm]frame.north)-|
([xshift = 5mm, yshift = -5mm]frame.south east) -- cycle;
\coordinate (outernw) at ([shift = {(-5mm,1cm)}]frame.north west);
\node[fill=\Rn!70!black, minimum height = 5mm,
anchor = north west, text = white, rounded corners] at ([xshift = 1cm]outernw) (outertitle) {Title #1};
\path[fill = \Rn!30!black]
([yshift = -1mm, xshift = -1mm]outertitle.north west)
arc[start angle = 0, end angle = 180, radius = 1mm]
([yshift = -1mm, xshift = 1mm]outertitle.north east)
arc[start angle = 180, end angle = 0, radius = 1mm];
\path[left color = \Rn!60!black, right color = \Rn!60!black, middle color = \Rn!80!black]
([xshift = -2mm]outertitle.north west) -- ([xshift = 2mm]outertitle.north east)[rounded corners = 1mm]
-- ([xshift = 1mm, yshift = -1mm]outertitle.north east) -- (outertitle.south east) -- (outertitle.south west)
-- ([xshift = -1mm, yshift = -1mm]outertitle.north west)
[sharp corners] -- cycle;
\node[text = white] at (outertitle) {Title #1};
},
overlay first = {\draw[\Rn!70!black, line width = .8mm, rounded corners]
([xshift = -5mm]frame.south west)|-([yshift = 9mm]frame.north)-|
([xshift = 5mm]frame.south east);
\coordinate (outernw) at ([shift = {(-5mm,1cm)}]frame.north west);
\node[fill=\Rn!70!black, minimum height = 5mm,
anchor = north west, text = white, rounded corners] at ([xshift = 1cm]outernw) (outertitle) {Question #1};
\path[fill = \Rn!30!black]
([yshift = -1mm, xshift = -1mm]outertitle.north west)
arc[start angle = 0, end angle = 180, radius = 1mm]
([yshift = -1mm, xshift = 1mm]outertitle.north east)
arc[start angle = 180, end angle = 0, radius = 1mm];
\path[left color = \Rn!60!black, right color = \Rn!60!black, middle color = \Rn!80!black]
([xshift = -2mm]outertitle.north west) -- ([xshift = 2mm]outertitle.north east)[rounded corners = 1mm]
-- ([xshift = 1mm, yshift = -1mm]outertitle.north east) -- (outertitle.south east) -- (outertitle.south west)
-- ([xshift = -1mm, yshift = -1mm]outertitle.north west)
[sharp corners] -- cycle;
\node[text = white] at (outertitle) {Question #1};
},
overlay middle = {
\draw[\Rn!70!black, line width = .8mm]
([xshift = -5mm]frame.north west)--([xshift = -5mm]frame.south west)
([xshift = 5mm]frame.north east)--([xshift = 5mm]frame.south east);
},
overlay last = {\draw[\Rn!70!black, line width = .8mm, rounded corners]
([xshift = -5mm]frame.north west)|-([yshift = -5mm]frame.south)-|
([xshift = 5mm]frame.north east);
}
}}
\tcbset{top/.style n args = {1}{enlarge top initially by = 1cm, enlarge bottom finally by = 1mm,
enlarge left by = 5mm,
enlarge right by = 5mm,
width = \linewidth+2cm,
overlay unbroken and first = {
\draw[\Rn!70!black, line width = .8mm, rounded corners]
([xshift = -5mm, yshift = -2mm]frame.south west)|-([yshift = 9mm]frame.north)-|
([xshift = 5mm, yshift = -2mm]frame.south east);
\coordinate (outernw) at ([shift = {(-5mm,1cm)}]frame.north west);
\node[fill=\Rn!70!black, minimum height = 5mm,
anchor = north west, text = white, rounded corners] at ([xshift = 1cm]outernw) (outertitle) {Title #1};
\path[fill = \Rn!30!black]
([yshift = -1mm, xshift = -1mm]outertitle.north west)
arc[start angle = 0, end angle = 180, radius = 1mm]
([yshift = -1mm, xshift = 1mm]outertitle.north east)
arc[start angle = 180, end angle = 0, radius = 1mm];
\path[left color = \Rn!60!black, right color = \Rn!60!black, middle color = \Rn!80!black]
([xshift = -2mm]outertitle.north west) -- ([xshift = 2mm]outertitle.north east)[rounded corners = 1mm]
-- ([xshift = 1mm, yshift = -1mm]outertitle.north east) -- (outertitle.south east) -- (outertitle.south west)
-- ([xshift = -1mm, yshift = -1mm]outertitle.north west)
[sharp corners] -- cycle;
\node[text = white] at (outertitle) {Title #1};
},
overlay middle and last = {
\draw[\Rn!70!black, line width = .8mm]
([xshift = -5mm]frame.north west)--([xshift = -5mm]frame.south west)
([xshift = 5mm]frame.north east)--([xshift = 5mm]frame.south east);
}}}
\tcbset{middle/.style n args = {1}{enlarge top initially by = 1mm, enlarge bottom finally by = 1mm,
enlarge left by = 5mm,
enlarge right by = 5mm,
width = \linewidth+2cm,
overlay unbroken = {
\draw[\Rn!70!black,line width = .8mm]
([shift = {(-5mm,3mm)}]frame.north west)--([shift = {(-5mm,-3mm)}]frame.south west)
([shift = {(5mm,3mm)}]frame.north east)--([shift = {(5mm,-3mm)}]frame.south east);
},
overlay first = {
\draw[\Rn!70!black,line width = .8mm]
([shift = {(-5mm,5mm)}]frame.north west)--([xshift = -5mm]frame.south west)
([shift = {(5mm,5mm)}]frame.north east)--([xshift = 5mm]frame.south east);
},
overlay middle = {
\draw[\Rn!70!black,line width = .8mm]
([xshift = -5mm]frame.north west)--([xshift = -5mm]frame.south west)
([xshift = 5mm]frame.north east)--([xshift = 5mm]frame.south east);
},
overlay last = {
\draw[\Rn!70!black,line width = .8mm]
([xshift = -5mm]frame.north west)--([shift = {(-5mm,-5mm)}]frame.south west)
([xshift = 5mm]frame.north east)--([shift = {(5mm,-5mm)}]frame.south east);
},
}}
\tcbset{bottom/.style = {enlarge bottom finally by = 7mm, enlarge top initially by = 1mm,
enlarge left by = 5mm,
enlarge right by = 5mm,
width = \linewidth+2cm,
overlay unbroken and last = {
\draw[\Rn!70!black, line width = .8mm, rounded corners]
([xshift = -5mm, yshift = 2mm]frame.north west)|-([yshift = -5mm]frame.south)-|
([xshift = 5mm, yshift = 2mm]frame.north east);
},
overlay first and middle = {
\draw[\Rn!70!black, line width = .8mm]
([xshift = -5mm]frame.north west)--([xshift = -5mm]frame.south west)
([xshift = 5mm]frame.north east)--([xshift = 5mm]frame.south east);
}}}
\newtcolorbox{generic}[5][]{empty,leftrule=\rulewidth,oversize, enhanced,
frame style = {left color = #2!20, right color = white},interior style = {left color = #2!5, right color = white}, left = 0pt, right = 0pt, %top = 4pt, bottom = 4pt,
before skip = 0pt, after skip = 0pt,% boxrule = 0.1pt,
title = #3, underlay={\begin{tcbclipinterior}
\shade[inner color = #2!10, outer color = white] (interior.north west) circle (2cm);
\draw[help lines, step = 5mm, #2!5,shift={(interior.north west)}] (interior.south west) grid (interior.north east);
\end{tcbclipinterior}
}, drop small lifted shadow,
breakable,rotate = \random
,
frame code = {\path[tcb fill frame,rounded corners] (frame.south west)--(frame.north west) -- (frame.north east)--(frame.south east)--cycle;
},
interior code={\path[tcb fill interior,rounded corners] (interior.south west|-frame.south)--(interior.north west)--([xshift=-4.8mm]interior.north east)--([yshift=-4.8mm]interior.north east)--(interior.south east|-frame.south)--cycle;},
% test
setskinf = {#4},setskinm = {#4},setskinl = {#4},#5, #1}
\newcommand{\bllack}[3][]{\begin{generic}[#1]{bllack}{\bllackpicture}{cccoltria}
{normal = #2}
#3
\end{generic}}
\newcommand{\tbllack}[3][]{\begin{generic}[#1]{bllack}{\bllackpicture}{cccoltria}
{top = #2}
#3
\end{generic}}
\newcommand{\mbllack}[2][]{\begin{generic}[#1]{bllack}{\bllackpicture}{cccoltria}
{middle}
#2
\end{generic}}
\newcommand{\bbllack}[2][]{\begin{generic}[#1]{bllack}{\bllackpicture}{cccoltria}
{bottom}
#2
\end{generic}}
\newcommand{\red}[3][]{
\begin{generic}[#1]{red}{\redpicture}{cccccoltria}
{normal = #2}
#3
\end{generic}}
\newcommand{\tred}[3][]{
\begin{generic}[#1]{red}{\redpicture}{cccccoltria}
{top = #2}
#3
\end{generic}}
\newcommand{\mred}[2][]{
\begin{generic}[#1]{red}{\redpicture}{cccccoltria}
{middle}
#2
\end{generic}}
\newcommand{\bred}[2][]{
\begin{generic}[#1]{red}{\redpicture}{cccccoltria}
{bottom}
#2
\end{generic}}
\newcommand{\bllue}[3][]{
\begin{generic}[#1]{bllue}{\blluepicture}{coltria}
{normal = #2}
#3
\end{generic}}
\newcommand{\tbllue}[3][]{
\begin{generic}[#1]{bllue}{\blluepicture}{coltria}
{top = #2}
#3
\end{generic}}
\newcommand{\mbllue}[2][]{
\begin{generic}[#1]{bllue}{\blluepicture}{coltria}
{middle}
#2
\end{generic}}
\newcommand{\bbllue}[2][]{
\begin{generic}[#1]{bllue}{\blluepicture}{coltria}
{bottom}
#2
\end{generic}}
\newcommand{\tcblowerr}{\begin{tcblowerbox}%{middle}
\tcblower
\end{tcblowerbox}}
\begin{document}
%
\tbllack{1}{\lipsum[1-1]}
\mred{\lipsum[1-1]}
\bbllue{\lipsum[1-1]}
\tbllack{2}{\lipsum[1-1]}
\bred{\lipsum[1-1]}
\bllue{3}{\lipsum[1-1]}
\tred{4}{\lipsum[1-1]}
\mbllue{\lipsum[1-1]}
\bbllack{\lipsum[1-1]}
\bllack{6}{\lipsum[1-1]}
%
\tbllack{1}{\lipsum[1-1]}
\mred{\lipsum[1-1]}
\bbllue{\lipsum[1-1]}
\tbllack{2}{\lipsum[1-1]}
\bred{\lipsum[1-1]}
%\newpage
%\section{Title}
\bllue{3}{\lipsum[1-1]}
\tred{4}{\lipsum[1-1]}
\mbllue{\lipsum[1-1]}
\bbllack{\lipsum[1-1]}
\bllack{6}{\lipsum[1-1]}
%
\tbllue{7}{\lipsum[1-1]}
\mbllack{\lipsum[1-1]}
\bred{\lipsum[1-1]}
\red{{8}}{\lipsum[1-1]}
%
%\newpage
%\section{Title}
\bllue{3}{\lipsum[1-1]}
\tred{4}{\lipsum[1-1]}
\mbllue{\lipsum[1-1]}
\bbllack{\lipsum[1-1]}
\bllack{6}{\lipsum[1-1]}
%
\tbllue{7}{\lipsum[1-1]}
\mbllack{\lipsum[1-1]}
\bred{\lipsum[1-2]}
\red{{8}}{\lipsum[1-1]}
%
\tbllack{1}{\lipsum[1-1]}
\mred{\lipsum[1-1]}
\bbllue{\lipsum[1-1]}
\tbllack{2}{\lipsum[1-1]}
\bred{\lipsum[1-1]}
\bllue{3}{\lipsum[1-1]}
\tred{4}{\lipsum[1-1]}
\mbllue{\lipsum[1-1]}
\bbllack{\lipsum[1-1]}
\bllack{6}{\lipsum[1-1]}
%
\tbllack{1}{\lipsum[1-1]}
\mred{\lipsum[1-1]}
\bbllue{\lipsum[1-1]}
\tbllack{2}{\lipsum[1-1]}
\bred{\lipsum[1-1]}
%\newpage
%\section{Title}
\bllue{3}{\lipsum[1-1]}
\tred{4}{\lipsum[1-1]}
\mbllue{\lipsum[1-1]}
\bbllack{\lipsum[1-1]}
\bllack{6}{\lipsum[1-1]}
%
\tbllue{7}{\lipsum[1-1]}
\mbllack{\lipsum[1-1]}
\bred{\lipsum[1-1]}
\red{{8}}{\lipsum[1-1]}
%
%\newpage
%\section{Title}
\bllue{3}{\lipsum[1-1]}
\tred{4}{\lipsum[1-1]}
\mbllue{\lipsum[1-1]}
\bbllack{\lipsum[1-1]}
\bllack{6}{\lipsum[1-1]}
%
\tbllue{7}{\lipsum[1-1]}
\mbllack{\lipsum[1-1]}
\bred{\lipsum[1-2]}
\red{{8}}{\lipsum[1-1]}
\end{document}