A similar question is asked here. What I'm asking is somewhat different: to have a command which makes two tcolorboxes vertically adjacent. My attempt is:

\begin{tcolorbox}
\end{tcolorbox}

\vspace{-1.025cm}

\begin{tcolorbox}
\end{tcolorbox}


(A complete minimal example is given below.) The end result will look like a table, with horizontal lines separating the "cells" (the interiors of the tcolorboxes). However, I don't want to actually make it a table. Sometimes the tcolorboxes will not be adjacent (there will be text in between them), so it would be good to have the option of making them overlap, without this always being the case.

Here is the full example:

\documentclass{report}
\usepackage{tcolorbox}

\newlength{\normalparindent}
\AtBeginDocument{\setlength{\normalparindent}{\parindent}}
\tcbset{before upper={\setlength{\parindent}{\normalparindent}}}

\tcbuselibrary{skins}
\tcbset{
enhanced,
frame hidden,interior hidden,
sharp corners,
boxrule=0pt,
left=-0.1cm,right=-0.1cm,top=0.25cm,bottom=0.25cm,
toptitle=0.25cm+1pt,
bottomtitle=0.0cm+1pt,
colframe=white,colback=white,coltitle=black,
title style=white,
bottomrule=1pt,
borderline north={1pt}{0pt}{lightgray},
borderline south={1pt}{0pt}{lightgray},
fonttitle=\bfseries,fontupper=\normalsize,
before skip=0.375cm+2pt,after skip=0.475cm+2pt
}

\begin{document}

\begin{tcolorbox}[title=1.1\hspace{1.0em}Definitions]
\noindent Content.
\end{tcolorbox}
\vspace{-1.025cm}
\begin{tcolorbox}[title=1.2\hspace{1.0em}Theorem]
\noindent Content.
\end{tcolorbox}

\end{document}


I am not satisfied with this solution, because the overlapping borderlines are printed darker than the non-overlapping ones. Does anyone know of a nice way to do this?

• Thanks for linking to one of my questions ;-) Perhaps the raster library of tcolorbox is what you want? – user31729 Jun 15 '15 at 3:54
• How is your printing when colors like red and green are used for border lines? Do they mix? pdf result shows only the last one. – Ignasi Jun 15 '15 at 10:52
• With my previewers on Windows, all three lines look the same. The middle line is painted twice and, maybe, your previewer adds something there. The answer by Ignasi should help, because the middle line is painted only once. I will add a raster answer as complement. – Thomas F. Sturm Jun 15 '15 at 14:34

Here, I use the raster library of tcolorbox to create an environment mycells. Outside of this environment, your boxes are as you definded them. Inside the environment, the overlapping lines are removed automatically and the vertical distance is adapted:

\documentclass{report}
\usepackage{tcolorbox}

\newlength{\normalparindent}
\AtBeginDocument{\setlength{\normalparindent}{\parindent}}
\tcbset{before upper={\setlength{\parindent}{\normalparindent}}}

\tcbuselibrary{skins,raster}
\tcbset{
enhanced,
frame hidden,interior hidden,
sharp corners,
boxrule=0pt,
left=-0.1cm,right=-0.1cm,top=0.25cm,bottom=0.25cm,
toptitle=0.25cm+1pt,
bottomtitle=0.0cm+1pt,
colframe=white,colback=white,coltitle=black,
%title style=white,% would actually draw a white box
bottomrule=1pt,
borderline north={1pt}{0pt}{lightgray},
borderline south={1pt}{0pt}{lightgray!10!red},
fonttitle=\bfseries,fontupper=\normalsize,
before skip=0.375cm+2pt,after skip=0.475cm+2pt
}

\newenvironment{mycells}[1][]{%
\begin{tcbraster}[
raster columns=1,
raster before skip=0.375cm+2pt,
raster after skip=0.475cm+2pt,
no borderline,
borderline south={1pt}{0pt}{lightgray},
raster row 1/.style={borderline north={1pt}{0pt}{lightgray}},
raster row skip=-1pt,
#1
]}{\end{tcbraster}}

\begin{document}

\begin{mycells}
\begin{tcolorbox}[title=1.1\hspace{1.0em}Definitions]
\noindent Content.
\end{tcolorbox}
\begin{tcolorbox}[title=1.2\hspace{1.0em}Theorem ]
\noindent Content.
\end{tcolorbox}
\end{mycells}

\end{document}


I don't know how this code is converted to pdf and finally printed, but if both lines are printed, you can always define overlapping tcolorbox with only borderline north and add borderline south to the last one.

\documentclass{report}
\usepackage{tcolorbox}

\newlength{\normalparindent}
\AtBeginDocument{\setlength{\normalparindent}{\parindent}}
\tcbset{before upper={\setlength{\parindent}{\normalparindent}}}

\tcbuselibrary{skins}
\tcbset{
enhanced,
frame hidden,interior hidden,
sharp corners,
boxrule=0pt,
left=-0.1cm,right=-0.1cm,top=0.25cm,bottom=0.25cm,
toptitle=0.25cm+1pt,
bottomtitle=0.0cm+1pt,
colframe=white,colback=white,coltitle=black,
title style=white,
bottomrule=1pt,
borderline north={1pt}{0pt}{lightgray},
%    borderline south={1pt}{0pt}{lightgray},
fonttitle=\bfseries,fontupper=\normalsize,
before skip=0.375cm+2pt,after skip=0.475cm+2pt
}

\begin{document}

\begin{tcolorbox}[title=1.1\hspace{1.0em}Definitions]
\noindent Content.
\end{tcolorbox}
\vspace{-1.025cm}
\begin{tcolorbox}[title=1.2\hspace{1.0em}Theorem,borderline south={1pt}{0pt}{lightgray} ]
\noindent Content.
\end{tcolorbox}

\end{document}