盒子设计 tikz

盒子设计 tikz

我找到了这个盒子,但不知道它的设计。你能告诉我用了哪些库或包来设计它吗?谢谢在此处输入图片描述

答案1

\documentclass[tikz, border=1cm]{standalone}
\usepackage{lipsum}
\tikzset{framed/.style={path picture={
\fill[blue!50!violet!50, even odd rule, rounded corners]
(path picture bounding box.south west) rectangle (path picture bounding box.north east) 
([shift={( 2pt, 4pt)}] path picture bounding box.south west) -- 
([shift={( 2pt,-2pt)}] path picture bounding box.north west) -- 
([shift={(-2pt,-4pt)}] path picture bounding box.north east) -- 
([shift={(-6pt, 6pt)}] path picture bounding box.south east) -- cycle;
}}} 
\begin{document}
\begin{tikzpicture}
\node[framed, text width=10cm, inner sep=15pt] {\lipsum[][1-10]};
\end{tikzpicture}
\end{document}

带紫色框架的文本框

编辑:带标签

\documentclass[tikz, border=1cm]{standalone}
\usepackage{lipsum}
\tikzset{exercise/.style={path picture={
\fill[blue!50!violet!50, even odd rule, rounded corners]
(path picture bounding box.south west) rectangle (path picture bounding box.north east) 
([shift={( 2pt, 4pt)}] path picture bounding box.south west) -- 
([shift={( 2pt,-2pt)}] path picture bounding box.north west) -- 
([shift={(-2pt,-4pt)}] path picture bounding box.north east) -- 
([shift={(-6pt, 6pt)}] path picture bounding box.south east) -- cycle;
},
label={[anchor=west, xshift=1em, yshift=-1pt, rotate=6, fill=blue!50!violet!50]north west:Exercise #1:},
}} 
\begin{document}
\begin{tikzpicture}
\node[exercise=1, text width=10cm, inner sep=15pt] {\lipsum[][1-10]};
\end{tikzpicture}
\end{document}

带有“练习 1:”标签的带框文本

相关内容