10

When a tcolorbox is inside the right side of a sidebyside tcolorbox, it is vertically centered. Using \vfill or align = top doesn't put the tcolorbox at the top of the right side. The space between the tcolorbox and the upper part of the right side is variable. Is there a way to put the tcolorbox at the right side top?

Tcolorboxes in the right side: centered.

\documentclass[]{article}

\usepackage[skins,listings,breakable,listingsutf8,theorems,hooks,fitting]{tcolorbox}%

\begin{document}

\begin{tcolorbox}[adjusted title= First Outer Box,sidebyside] Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ \tcblower Variable vertical space \begin{tcolorbox}[adjusted title=First Box Right Side] Inside 1st box First Outer Box \end{tcolorbox} \begin{tcolorbox}[adjusted title=Second Box Right Side] Inside 2nd box First Outer Box \end{tcolorbox}

\end{tcolorbox} % first outer box

\begin{tcolorbox}[adjusted title= Second Outer Box,sidebyside] Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ Left side of Outer Box\ \tcblower Variable vertical space. \begin{tcolorbox}[adjusted title=First Box Right Side] Inside 1st box Second Outer Box \end{tcolorbox} \begin{tcolorbox}[adjusted title=Second Box Right Side] Inside 2nd box Second Outer Box \end{tcolorbox} \end{tcolorbox} % first outer box \end{document}

enter image description here

Tonechas
  • 976
SDrolet
  • 4,908

1 Answers1

10

You can use the sidebyside align key (possible values are top, bottom and, the default, center):

\documentclass[]{article}

\usepackage[skins,listings,breakable,listingsutf8,theorems,hooks,fitting]{tcolorbox}%

\begin{document}

\begin{tcolorbox}[adjusted title= First Outer Box,sidebyside,sidebyside align=top]
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
\tcblower
Variable vertical space
\begin{tcolorbox}[adjusted title=First Box Right Side]
Inside 1st box
First Outer Box
\end{tcolorbox}
\begin{tcolorbox}[adjusted title=Second Box Right Side]
Inside 2nd box
First Outer Box
\end{tcolorbox} 

\end{tcolorbox} % first outer box

\begin{tcolorbox}[adjusted title= Second Outer Box,sidebyside,sidebyside align=top]
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
Left side of Outer Box\\
\tcblower
Variable vertical space.
\begin{tcolorbox}[adjusted title=First Box Right Side]
Inside 1st box
Second Outer Box
\end{tcolorbox}
\begin{tcolorbox}[adjusted title=Second Box Right Side]
Inside 2nd box
Second Outer Box
\end{tcolorbox} 
\end{tcolorbox} % first outer box
\end{document}

enter image description here

Gonzalo Medina
  • 505,128
  • 2
    Therefore, "sidebyside align=top" doesn't work alone has to be paired with "sidebyside". Thanks ! – SDrolet May 12 '14 at 19:37
  • Can we increase the left column width and decrease the right column width? – Say OL Oct 16 '16 at 01:11
  • 1
    @SayOL: the outer box may specify the parameters lefthand width and righthand width which control the column width. – FK82 Jan 19 '17 at 10:35
  • @FK82 Thank for your suggestion! Actually, I posted a question a few weeks ago and an acceptable solution was already given :) – Say OL Jan 19 '17 at 10:39
  • @SayOL Great! Just wanted to add this since your question was left unanswered and I came across the same problem. – FK82 Jan 19 '17 at 10:41
  • just in case someone tries to get this working with an \includegraphics[]{} on one of the sides... don't forget the \vspace{0ex} (see here: https://tex.stackexchange.com/a/500284/172810) – raphael Aug 10 '20 at 16:32