![tcolorbox 中具有不同风格的平行框](https://linux22.com/image/383053/tcolorbox%20%E4%B8%AD%E5%85%B7%E6%9C%89%E4%B8%8D%E5%90%8C%E9%A3%8E%E6%A0%BC%E7%9A%84%E5%B9%B3%E8%A1%8C%E6%A1%86.png)
在论坛的许多帮助下,我创建了一个里面有盒子的盒子。我想从链接嵌入 3 个盒子到我的盒子:baposter 中标题框颜色变化
我的盒子是附件。谢谢
\documentclass[a4paper,10pt]{article}
\usepackage[a4paper,left=2cm,right=2cm,top=1cm,bottom=1cm]{geometry}
\usepackage{amsmath,amssymb,scalerel}
\usepackage{lmodern}
\usepackage[most]{tcolorbox}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage[english]{babel}
\usepackage{MnSymbol,wasysym}
\usepackage{tikzsymbols}
\usepackage[format=plain,
labelfont={bf,it},
textfont=it]{caption}
\usepackage{bbding}
\usepackage{pifont}
\input{insbox}
\usepackage{enumitem}
\usetikzlibrary{matrix}
\makeatletter
\tcbset{
myhbox/.style 2 args={%
enhanced,
boxsep = 0pt,
left = 0pt,
right = 4mm,
top=0pt,
breakable,
colback=white,
colframe=blue!30!black,
attach boxed title to top left={yshift*=-\tcboxedtitleheight},
title={#2},
boxed title size=title,
boxed title style={%
sharp corners,
rounded corners=northwest,
colback=tcbcol@frame,
boxrule=0pt,
%fontsize = 9pt,
},
underlay boxed title={%
\path[fill=tcbcol@frame] (title.south west)--(title.south east)
to[out=0, in=180] ([xshift=5mm]title.east)--
(title.center-|frame.east)
[rounded corners=\kvtcb@arc] |-
(frame.north) -| cycle;
},
#1
},
}
\makeatother
\newtcolorbox{myvbox}[2][]{%
myvbox={#1}{#2}
}
\begin{document}
\thispagestyle{empty}
\noindent
\begin{tcbposter}[
poster = {columns=2, rows=7, width=0.5\textwidth, height=0.5\textheight,spacing=0.1mm}]
\posterbox[width=12cm,height=5.8cm, myhbox={colframe=green!80!black}{AAA}]{column=1, row=6, rowspan=0.5,yshift=0.0cm,xshift=0cm}
{{
%\hspace*{0.2cm}
\vspace*{0.2cm}
\begin{tcbitemize}[raster columns=2,raster rows = 1, raster force size=false,raster column skip=3mm]
\tcbitem [myhbox={leftmargin=0.4cm,colback=yellow!70!black, colframe=magenta!80!black,height=1.5cm,width=4cm}{\sum\$BBB}]
\tcbitem
\end{tcbitemize}
}
{
\begin{enumerate}
%\vspace*{0.2cm}
\item ...................................
\item ...................................
\end{enumerate}
}}
\end{tcbposter}
\end{document}
答案1
请注意,反对票不是我投的。但是,我可以理解为什么有人可能想反对你的问题。你似乎正在加载你遇到的任何包或库。另一方面,这个网站旨在为所有人提供信息,而不仅仅是那些提问的人。也就是说,其他有类似问题或疑问的人可能想从我们的信件中学习。如果有许多涉及不必要的包,更何况这些包可能彼此不兼容。
说到这里,我的答案来了。不过请注意,由于您加载了如此多的软件包,我不得不做出一个临时选择。我选择使用(功能极其强大的)软件包来做所有事情tcolorbox
。完全可以想象,还有其他方法可以实现这一点,例如baposter
基于回答你的链接。
\documentclass[a4paper,10pt]{article}
\usepackage[a4paper,left=2cm,right=2cm,top=1cm,bottom=1cm]{geometry}
\usepackage[most]{tcolorbox}
\makeatletter
\tcbset{
myhbox/.style 2 args={%
enhanced,
boxsep = 0pt,
left = 0pt,
right = 4mm,
top=0pt,
breakable,
colback=white,
colframe=blue!30!black,
attach boxed title to top left={yshift*=-\tcboxedtitleheight},
title={#2},
boxed title size=title,
boxed title style={%
sharp corners,
rounded corners=northwest,
colback=tcbcol@frame,
boxrule=0pt,
%fontsize = 9pt,
},
underlay boxed title={%
\path[fill=tcbcol@frame] (title.south west)--(title.south east)
to[out=0, in=180] ([xshift=5mm]title.east)--
(title.center-|frame.east)
[rounded corners=\kvtcb@arc] |-
(frame.north) -| cycle;
},
#1
},
plain/.style={colback=white,
colframe=white}
}
\makeatother
\newtcolorbox{myvbox}[2][]{%
myvbox={#1}{#2}
}
\begin{document}
\begin{tcbposter}
[poster = {columns=1, rows=2,spacing=0.1mm}]
\posterbox[width=\textwidth,height=5.8cm,top=0.2cm,left=4mm, myhbox={colframe=green!80!black}{AAA}]{}
{
\begin{tcbraster}[raster left skip=4mm,raster columns=2,raster rows = 2, raster force size=false,raster column skip=3mm]
\begin{tcolorbox}[myhbox={colback=yellow!70!black,
colframe=magenta!80!black,height=1.5cm,width=4cm}{$\sum\$BBB$}]
\end{tcolorbox}
%
\begin{tcolorbox}[plain,width=12cm]
\begin{tcbitemize}[raster columns=3,raster equal
height,fonttitle=\bfseries\sffamily]
\tcbitem[title={First title},colframe=orange,colback=blue!10] First box
\tcbitem[title={Second title},colframe=yellow,colback=red!10,sharp
corners=northeast] Second box
\tcbitem[title={Third title},colframe=red!20!gray,colback=yellow!20,sharp
corners=northwest]
Third box
\end{tcbitemize}
\end{tcolorbox}
\end{tcbraster}
{
\begin{enumerate}
\item \dotfill
\item \dotfill
\end{enumerate}
}}
\end{tcbposter}
\end{document}
未来,我希望你们
- 删除所有不必要的包,
- 确保问题中发布的代码可以编译,
- 并告诉我们您在哪个步骤遇到了问题(而不是仅仅画一个草图来表明您想要什么)。
当然,这样的草图非常有用,但它们应该与您所面临的问题的描述结合起来,以便其他人可以从我们的帖子中学习。