在第二个框中,我尝试模仿第一个框的布局,但标题向下。显然,结果不正确。事实上,我预见的结果是在第三个框中;但我不知道如何使用这些tcolorbox
功能来实现它。
\documentclass{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\tcbuselibrary{skins}
\usetikzlibrary{patterns}
\usetikzlibrary{decorations.shapes}
\usetikzlibrary{decorations.pathmorphing}
\tcbset{%
myboxmainstyle/.style={%
enhanced,
segmentation style={solid,line width=1pt,decorate,decoration={zigzag}},
center title,
halign=flush center,
boxrule=1pt,
arc is angular, arc=3pt,
}
}
\newtcolorbox{mybox}[2][]{%
adjusted title={#2},
myboxmainstyle,
#1,
}
\usepackage{environ}
\newcommand\myrotateboxgrap[1]{\reflectbox{\rotatebox[origin=c]{180}{#1}}}
\newcommand\myrotateboxtikz[1]{\tikz[baseline=(box.north)]\node[yscale=-1,inner sep=0,outer sep=0](box){#1};}
\NewEnviron{myboxflipped}[2][]{%
%\myrotateboxgrap{\begin{mybox}[#1]{\myrotateboxgrap{#2}}\myrotateboxgrap{\BODY}\end{mybox}}
\myrotateboxtikz{\begin{mybox}[#1]{\myrotateboxtikz{#2}}\myrotateboxtikz{\BODY}\end{mybox}}
}
\begin{document}
\begin{frame}
\begin{mybox}[]{Test}
bla bla
\end{mybox}
\begin{mybox}[attach boxed title to bottom center={yshift=0.25mm+\tcboxedtitleheight/2,yshifttext=-2mm+\tcboxedtitleheight/2}]{Test}
bla bla
\end{mybox}
\begin{myboxflipped}[colback=pink]{Test}
bla bla
\end{myboxflipped}
\end{frame}
\end{document}
答案1
手册tcolorbox
中有一个例子flipbox
,精确地实现了框和标题的翻转(参见 4.15 版的第 161 页)。
关键点在于minipage boxed title*
扩大盒装标题外部的宽度tcolorbox
。
\documentclass{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\tcbuselibrary{skins}
\usetikzlibrary{patterns}
\usetikzlibrary{decorations.shapes}
\usetikzlibrary{decorations.pathmorphing}
\tcbset{%
myboxmainstyle/.style={%
enhanced,
segmentation style={solid,line width=1pt,decorate,decoration={zigzag}},
center title,
halign=flush center,
boxrule=1pt,
arc is angular, arc=3pt,
}
}
\newtcolorbox{mybox}[2][]{
enhanced,
sharp corners=south,
myboxmainstyle,
attach boxed title to bottom center={yshift=0.5mm},
minipage boxed title*,
boxed title style={enhanced,
size=normal,
top=0pt,
bottom=0pt,
%interior hidden,
sharp corners=north,
boxrule=1pt,
colback=red,
arc is angular, arc=3pt},
title={#2},#1
}
\begin{document}
\begin{frame}
\begin{mybox}[]{Test}
bla bla
\end{mybox}
\begin{mybox}[colback={yellow},coltitle=black,colbacktitle=red]{Another Test}
bla bla
\end{mybox}
\end{frame}
\end{document}
编辑
\documentclass{beamer}
\usepackage{lmodern}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\tcbuselibrary{skins}
\usetikzlibrary{patterns}
\usetikzlibrary{decorations.shapes}
\usetikzlibrary{decorations.pathmorphing}
\tcbset{%
myboxmainstyle/.style={%
enhanced,
segmentation style={solid,line width=1pt,decorate,decoration={zigzag}},
center title,
halign=flush center,
boxrule=1pt,
arc is angular, arc=3pt,
}
}
\newtcolorbox{mybox}[2][]{
enhanced,
sharp corners=south,
myboxmainstyle,
attach boxed title to bottom center={yshift=0.5mm},
minipage boxed title*,
boxed title style={enhanced,
size=normal,
top=0pt,
bottom=0pt,
center title,
sharp corners=north,
boxrule=1pt,
arc is angular, arc=3pt},
title={{\centering #2}},#1
}
\begin{document}
\begin{frame}
\begin{mybox}[]{Test}
bla bla
\end{mybox}
\begin{mybox}[colback={yellow},coltitle=black,colbacktitle=red]{Another Test}
bla bla
\end{mybox}
\end{frame}
\end{document}