Here I'd like to share another example where I solved the original problem with excessive spacing. It looks like this:

- Demonstration of tabu and TikZ frame spacing control
- MultiframesWithTikZandTabu.jpeg (21.22 KiB) Viewed 4163 times
And the code is as follows:
Code: Select all
\documentclass{article}
\usepackage{calc}
\usepackage[papersize={7cm, 7cm}]{geometry}
\usepackage{fontspec}
\usepackage{xcolor}
\usepackage{tabu}
\usepackage{tikz}
\geometry{
showframe,
inner=4mm,
outer=4mm,
top=4mm,
bottom=4mm
}
\usetikzlibrary{
backgrounds,
calc
}
\definecolor{myblue}{rgb}{0, 0.4, 0.7}
\definecolor{mygreen}{rgb}{0, 1, 0}
\definecolor{myred}{rgb}{1, 0, 0}
\definecolor{myorange}{rgb}{1, 0.7, 0}
\definecolor{mypink}{rgb}{1, 0, 1}
\newlength{%
\thicknessLine}
\setlength{\thicknessLine}{3pt}
\newlength{%
\testSpaceInterlines}
\setlength{\testSpaceInterlines}{1pt}
\newlength{%
\frameEscapeHalf}
\setlength{\frameEscapeHalf}{\testSpaceInterlines + \thicknessLine/2}
\tabulinesep=\testSpaceInterlines
\tabcolsep=\testSpaceInterlines
\tabulinestyle{\thicknessLine}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont{Times New Roman}
\newcommand{\textmode} {%
\color{myblue}%
\fontsize{24}{0}%
\bfseries%
%\itshape
}
\newlength{\auxWidth}
\newlength{\auxHeight}
\newlength{\auxDepth}
\newcommand{\bAnalyze}[1]{%
\settowidth{\auxWidth} {\usebox{#1}}%
\settoheight{\auxHeight} {\usebox{#1}}%
\settodepth{\auxDepth} {\usebox{#1}}%
\color{mypink}%
\usebox{#1}%
\llap{%
\rule[-\thicknessLine]{\auxWidth}{\thicknessLine}%
}%
\color{mygreen}%
\vrule width \thicknessLine height \auxHeight depth 0pt \relax%
\color{myred}%
\llap{%
\vrule width \thicknessLine height 0pt depth \auxDepth \relax%
}%
}
\newsavebox{\tableBox}
\begin{document}
\thispagestyle{empty}
\savebox{\tableBox}{%
\taburulecolor{myblue}%
\begin{tabu} spread 0pt
{|X[-1, c, m]|}
\tabucline-
{%
\taburulecolor{myorange}
\begin{tabu} spread 0pt {|X[-1, c, m]|}
\tabucline-
\textmode%
CONTENTS \\
\tabucline-
\end{tabu}%
}
\\
\tabucline-
\end{tabu}%
}
\vspace*{\fill}
\begin{center}
\taburulecolor{mygreen}%
\begin{tabu} spread 0pt
{|X[-1, c, m]|}
\tabucline-
\begin{tikzpicture}[inner sep = 0pt, outer sep = 0pt]
\node (tbl) {%
\bAnalyze{\tableBox}%
};
\begin{pgfonlayer}{background}
\draw[line width=\thicknessLine,draw=mypink]
($(tbl.north east) + (\frameEscapeHalf, \frameEscapeHalf)$)
rectangle ($(tbl.south west) - (\frameEscapeHalf, \frameEscapeHalf)$);
\end{pgfonlayer}
\end{tikzpicture}
\\
\tabucline-
\end{tabu}
\end{center}
\vspace*{\fill}
\end{document}