亲爱的社区成员们,
我想通过结合第一个框(有一个简单的矩形)和第二个框来绘制一个 3D 精美框。您有什么想法吗?
第一个代码(在 \begin{document} 环境之外编写):
\usepackage{tikz}
\usetikzlibrary{calc}
\xdefinecolor{mycolor}{HTML}{1475bb} % Neutral Blue
\colorlet{bancolor}{mycolor}
\def\bancolor{mycolor}
\newenvironment{mybox}[3][]{%
\begin{tikzpicture}[#1]%
\def\myboxname{#3}%
\node [draw, line width=0.5mm, inner sep=1.5ex,text width=#2]% good
options: minimum height, minimum width , fill={mycolor!30}
(BOXCONTENT) \bgroup\rule{0pt}{3ex}\ignorespaces
}{%
\egroup;
\node [right,inner xsep=1em,fill=bancolor!50,outer sep=0pt,text
height=2ex,text depth=.5ex, text =black, font=\bf] (BOXNAME)
at ([shift={(-1em,0pt)}]BOXCONTENT.north west) {\myboxname};
\fill[bancolor] (BOXNAME.north east) -- +(-1em,1em) -- +(-1em,0) -- cycle;
\fill[bancolor] (BOXNAME.south west) -- +(1em,-1em) -- +(1em,0) -- cycle;
\end{tikzpicture}
}
我在 \begin{document} 环境中调用它,如下所示:
\begin{mybox}{\textwidth}{Title}
\justifying
Hello World!
\end{mybox}
第二段代码(在 \begin{document} 环境中编写):
\smartdiagramset{
uniform color list=gray!60!black for 2 items,
back arrow disabled=true,
}
\smartdiagram[flow diagram:horizontal]{PGF}
问候。Widad
答案1
tcolorbox
以下是使用和的实现TikZ
。
\documentclass{article}
\usepackage{blindtext}
\usepackage[most]{tcolorbox}
\usetikzlibrary{calc}
\definecolor{bluebg}{rgb}{0.5,0.7,0.84}
\definecolor{trianglebg}{rgb}{0.09,0.41,0.69}
\makeatletter
\tcbset{%
decorationwidth/.store in=\kv@decoration@width,
decorationwidth=10pt,
boxedtitlecolor/.colorlet=tcbcol@boxedtitle,
decorationcolor/.colorlet =tcbcol@decorationcolor,
decorationcolor=trianglebg,
boxedtitlecolor=bluebg,
}
\newtcolorbox[auto counter]{myboxother}[2][]{%
enhanced, sharp corners,
drop shadow,
attach boxed title to top left={xshift=-\kv@decoration@width,yshift=-\tcboxedtitleheight/2,yshifttext=-\tcboxedtitleheight/2},
coltitle=black,
boxed title style={toprule=0pt,bottomrule=0pt,leftrule=0pt,frame hidden,enhanced,colback=tcbcol@boxedtitle,sharp corners},
underlay boxed title={
\coordinate (refpointsouth) at ($(title.south west)+(0pt,0mm)$);
\filldraw[line width=0pt,tcbcol@decorationcolor]
(refpointsouth) -- ($(refpointsouth) + (\kv@decoration@width,0)$) -- +(0pt, -\kv@decoration@width) -- cycle;
\coordinate (refpointnorth) at ($(title.north east)-(\kvtcb@[email protected],0pt)$);
\filldraw[line width=0pt,tcbcol@decorationcolor]
(refpointnorth) -- ($(refpointnorth) + (-\kv@decoration@width,0pt)$) -- ($(refpointnorth) +(0pt, \kv@decoration@width)$) -- cycle;
}
,
title={#2},#1,
}
\makeatother
\begin{document}
\begin{myboxother}[decorationwidth=15pt]{My title}
Hello World
\blindtext
\end{myboxother}
\begin{tcolorbox}[enhanced,interior style={top color=white,bottom color=white!60!black}, drop shadow]
Hello World
\blindtext
\end{tcolorbox}
or a small box
\tcbox[enhanced,interior style={top color=white,bottom color=white!60!black}, drop shadow south]{Hello World}
\end{document}