我有三個tcolorbox
es,我希望佈局與此類似:
我可以使用以下命令使第一個和第二個框的標題對齊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}