# Frame with two columns and one title

I need to produce a frame with two boxes and only one title as shown in this figure:

My current code is the following:

\documentclass{article}
\usepackage{array}
\usepackage[top=1cm, left=2cm,right=2cm {geometry}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}
\node[text width=7.7cm,draw,minimum size=5cm,align=center] (esq) {\vspace*{.7cm}\rule{1cm}{.2pt}/\rule{1cm}{.2pt}/\rule{1.5cm}{.2pt}\\\rule{5cm}{.25pt}\\Signature\\Person 1};
\node[text width=7.7cm, right=.7cm of esq,draw,align=center, minimum size=5cm] (dir) {\vspace*{.7cm}\rule{1cm}{.2pt}/\rule{1cm}{.2pt}/\rule{1.5cm}{.2pt}\\\rule{5cm}{.25pt}\\Signature\\Person 2};
\node[inner sep=1.5ex,text width=10.25cm,right=1.5cm of esq.north west,xshift=1.35cm, draw=white,line width=5pt,fill=black!10,align=center,font=\bfseries\sffamily] (topo) {\Large \bf \textsc{Agreement}};
\draw (topo.south west) rectangle (topo.north east);
\end{tikzpicture}
\end{document}


My problem is related to the positioning of the title box "Agreement". If, for example, the page width changes I need to find a new position. I've failed to position it to the center among the two boxes.

How can I set title box position relatively the boxes? I have also tried to do this with tcolorbox without success. Is it possible?

You can use the calc library and locate the title

at ( $(esq.north)!0.5!(dir.north)$)


The complete code:

\documentclass{article}
\usepackage{tikz}
\usepackage{array}
\usepackage[top=1cm, left=2cm,right=2cm]{geometry}
\usetikzlibrary{positioning,calc}

\begin{document}
\begin{tikzpicture}
\node[text width=7.7cm,draw,minimum size=5cm,align=center]
(esq)
{\vspace*{.7cm}\rule{1cm}{.2pt}/\rule{1cm}{.2pt}/\rule{1.5cm}{.2pt}\\\rule{5cm}{.25pt}\\Signature\\Person 1};

\node[text width=7.7cm, right=.7cm of esq,draw,align=center, minimum size=5cm]
(dir)
{\vspace*{.7cm}\rule{1cm}{.2pt}/\rule{1cm}{.2pt}/\rule{1.5cm}{.2pt}\\\rule{5cm}{.25pt}\\Signature\\Person 2};

\node[inner sep=1.5ex,text width=10.25cm,draw=white,line width=5pt,fill=black!10,align=center,font=\bfseries\sffamily]
(topo)
at ( $(esq.north)!0.5!(dir.north)$)
{\Large\bfseries\textsc{Agreement}};
\draw (topo.south west) rectangle (topo.north east);
\end{tikzpicture}

\end{document}


And using tcolorbox and its raster library, you can do something like this (adjust the settings):

\documentclass{article}
\usepackage[many]{tcolorbox}
\usepackage{array}
\usepackage[top=1cm, left=2cm,right=2cm]{geometry}
\usetikzlibrary{positioning,calc}

\begin{document}

\begin{tcbraster}[
raster columns=2,
raster equal height,
enhanced,
colframe=black,
colback=white,
arc=0pt,
outer arc=0pt,
halign=center
]
\begin{tcolorbox}[remember as=left]
\vspace*{.7cm}
\rule{1cm}{.2pt}/\rule{1cm}{.2pt}/\rule{1.5cm}{.2pt}\\
\rule{5cm}{.25pt}\\
Signature\\
Person 1
\end{tcolorbox}
\begin{tcolorbox}[remember as=right]
\vspace*{.7cm}
\rule{1cm}{.2pt}/\rule{1cm}{.2pt}/\rule{1.5cm}{.2pt}\\
\rule{5cm}{.25pt}\\
Signature\\
Person 2
\end{tcolorbox}
\end{tcbraster}
\begin{tikzpicture}[overlay,remember picture,overlay]
\node[inner sep=1.5ex,text width=10.25cm,draw=white,line width=5pt,fill=black!10,align=center,font=\bfseries\sffamily]
(topo)
at ( $(left.north)!0.5!(right.north)$)
{\Large\bfseries\textsc{Agreement}};
\draw (topo.south west) rectangle (topo.north east);
\end{tikzpicture}
\end{document}


• This is nice. Any specific advantage of using this second approach? Oct 11, 2015 at 3:33
• @MarcKees No; in this case, I like the first approach better (the code is shorter, no need to compile twice for elements to reach their final locations). I just presented a tcolorbox option since you mentioned in your question. Oct 11, 2015 at 3:35