我有三个tcolorbox
,我希望它们的布局与此类似:
我可以使用adjustbox
(如图所示这里),但我不确定如何让第三个框位于第二个框下方。
目前的最佳努力得出以下结论:
代码:
\documentclass{article}
\usepackage{tikz, adjustbox}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{centering}
\tcbset{colback=blue!5!white,colframe=blue!75!black,fonttitle=\bfseries, width = 6cm}
\begin{tcolorbox}[title = First box,before=\adjustbox{valign=t}\bgroup, after=\egroup]
\begin{itemize}
\item A
\item B
\item C
\item D
\item E
\end{itemize}
\end{tcolorbox}
\tcbset{colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries, width = 5cm}
\begin{tcolorbox}[title = Second box,before=\adjustbox{valign=t}\bgroup, after=\egroup]
\begin{itemize}
\item F
\end{itemize}
\end{tcolorbox}
\tcbset{colback=green!5!white,colframe=green!75!black,fonttitle=\bfseries, width = 5cm}
\begin{tcolorbox}[title = Third box]
\begin{itemize}
\item G
\item H
\item I
\item J
\end{itemize}
\end{tcolorbox}
\end{centering}
\end{document}
答案1
这是一次尝试rasters
。不是全自动的,因为您必须指定高度,并且第二和第三个框被包含在单独的中tcolobox
。还有改进的空间,但这应该作为一个起点。
\documentclass{article}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{tcbraster}[raster equal height,raster valign=top,raster columns=2, raster rows=1,
colframe=red!50!black,colback=red!10!white,colbacktitle=red!50!white,
]
\begin{tcolorbox}[title = First box,colback=blue!5!white,colframe=blue!75!black,fonttitle=\bfseries,height=8.05cm, width = 6cm]
\begin{itemize}
\item A
\item B
\item C
\item D
\item E
\end{itemize}
\end{tcolorbox}
\begin{tcolorbox}[boxsep=0pt,boxrule=0pt,colback=white,colframe=white,enhanced jigsaw,left=0mm,right=0mm,top=0mm,bottom=0mm]
\begin{tcolorbox}[title = Second box,colback=red!5!white,colframe=red!75!black,fonttitle=\bfseries,height=2cm, width = 5cm]
\begin{itemize}
\item F
\end{itemize}
\end{tcolorbox}
\begin{tcolorbox}[title = Third box,colback=green!5!white,colframe=green!75!black,fonttitle=\bfseries, height=6cm, width = 5cm,before=\par\vspace{-0.2\baselineskip}]
\begin{itemize}
\item G
\item H
\item I
\item J
\end{itemize}
\end{tcolorbox}
\end{tcolorbox}
\end{tcbraster}
\end{document}