# Creating double-framed table in document header

I am pretty new to TeX and right now I am facing a challenge in creating double-framed table in header of my document. Intended goal is in image:

Create Double line Border in table

with some googling I found this code:

\documentclass [a4paper, 12pt, twoside] {article}
\usepackage [czech] {babel}
\usepackage [utf8] {inputenc}
\usepackage [left=2.5cm, right=2cm, headheight=110pt, top = 6.5cm, bottom=3cm] {geometry}
\usepackage{fancyhdr}
\usepackage{array}
\usepackage{multicol}

\setlength{\tabcolsep}{12pt}
\renewcommand{\arraystretch}{2.0}

\begin {document}

\nonfrenchspacing

\pagestyle{fancy}
\begin{table}
\centering
\setlength{\fboxrule}{1pt}
\setlength{\fboxsep}{\doublerulesep}
\fbox{%
\setlength{\fboxsep}{0pt}%
\fbox{%
\begin{tabular}{m{2.5cm}|m{5cm}|m{2.5cm}|m{2.5cm}}
\centering TEXT & \centering \LARGE{Another text} & Version: 2 & Page: \hspace{0.5pt}\thepage \hspace{0.5pt} / \pageref{LastPage} \\
\hline
\multicolumn{4}{c}{Long text}\\
\end{tabular}%
}%
}
\end{table}
\end{tabular}
}
\end{document}


This works fine when used in document body, but I cant compile it in header and I cant find/figure out the reason. Any help or suggestion would be great!

• table is a floating environment. Remove it (and the extra \end{tabular} in your code) and you shall be happy. – campa Jun 13 '18 at 7:35
• @campa Thank you! Such simple solution was unexpected on my part! – Tomáš Kruliš Jun 13 '18 at 10:10

Although your problem is well solved in the campa's comment:

The source code:

\documentclass [a4paper, 12pt] {article}

% Code not relevant for tables, just to glamourize the examples :)
\parskip2em\parindent0pt  % warning: non LaTeX mode, good only for idlers
\usepackage[margin=2.25cm,showframe]{geometry}% show margins in green:
\makeatletter\def\Gm@hrule{}\def\Gm@hruled{}
\def\Gm@vrule{\color{green}\vrule width 1pt height\textheight depth\z@}%
\makeatother
\usepackage{array,lastpage,lipsum}
\renewcommand{\arraystretch}{2.0}
\def\longtext{So long text that will have linebreaks or not (that should not matter). Please, do not center if there are some line breaks.}
% Required for tables:

\usepackage{hhline}
\usepackage{tabularx}
\newcolumntype{C}{>{\hfil}X}
\newcolumntype{P}{>{\centering}%
p{\dimexpr\linewidth-2\tabcolsep-2\doublerulesep-4\arrayrulewidth}}
\usepackage[table]{xcolor}
\usepackage[most]{tcolorbox}
\usepackage{booktabs}

\begin {document}

Your corrected code could produce  ...

\setlength{\tabcolsep}{12pt} % right LateX mode of setting  lenghts
\setlength{\fboxrule}{1pt}
\setlength{\fboxsep}{\doublerulesep}
\fbox{%
\setlength{\fboxsep}{0pt}%
\fbox{%
\begin{tabular}{m{2.5cm}|m{5cm}|m{2.5cm}|m{2.5cm}}
\centering TEXT & \centering \LARGE{Another text} & Version: 2 & Page: \hspace{0.5pt}\thepage \hspace{0.5pt} / \pageref{LastPage} \\\hline
\multicolumn{4}{c}{Not so long text that fit only in one line, but see the right  margin ...}\\
\end{tabular}%
}}

... or ...

\setlength{\tabcolsep}{12pt} % right LateX mode of setting  lenghts
\setlength{\fboxrule}{1pt}
\setlength{\fboxsep}{\doublerulesep}
\fbox{%
\setlength{\fboxsep}{0pt}%
\fbox{%
\begin{tabular}{m{2.5cm}|m{5cm}|m{2.5cm}|m{2.5cm}}
\centering TEXT & \centering \LARGE{Another text} & Version: 2 & Page: \hspace{0.5pt}\thepage \hspace{0.5pt} / \pageref{LastPage} \\\hline
\multicolumn{4}{c}{\longtext)}\\
\end{tabular}%
}}

But with a simpler code using \verb|hhline| and \verb|tabularx| thera are not this problem:

\doublerulesep2pt
\arrayrulewidth1pt

\begin{tabularx}{\linewidth}{||C|c|C|C||}
\hhline{|t:====:t|}
TEXT & \LARGE{Another text} & Version: 2 & Page: \thepage/\pageref{LastPage}
\\\hhline{||----||}
\multicolumn{4}{||P||}{\longtext}
\\\hhline{|b:====:b|}
\end{tabularx}%

Off-topic: although indiscutibly is a matter of individual taste, only in case that you want to escape from that  look of prehistoric HTML table, I would suggest some alternatives:

\newcolumntype{Q}{>{}p{\dimexpr\linewidth-2\tabcolsep}}

\tcbox[enhanced,
left=0mm,right=0mm,top=0mm,bottom=0mm,boxsep=1mm,boxrule=1pt,
arc=7mm,colframe=orange!50!black,colback=orange!05!white,
borderline={1pt}{1mm}{orange},
borderline={1pt}{1mm}{orange!50!black,dotted}]{\sffamily
\arrayrulecolor{orange}\renewcommand{\arraystretch}{2}%
\begin{tabularx}{\dimexpr\linewidth-4pt-1mm}{C|c|C|C}
TEXT & \LARGE{Another text} & Version: 2 & Page: \thepage/\pageref{LastPage} \\\hline
\multicolumn{4}{Q}{\longtext}\\
\end{tabularx}}

\sffamily
\rowcolors{1}{blue!10}{gray!10}
\arrayrulecolor{blue!50!black}
\begin{tabularx}{\linewidth}{CcCC}\toprule
\cellcolor{blue!25}TEXT & \cellcolor{blue!20}\LARGE{Another text} & \cellcolor{blue!15} Version: 2 & Page: \thepage/\pageref{LastPage} \\
\multicolumn{4}{Q}{\longtext}
\\\bottomrule
\end{tabularx}

\setcounter{page}{35}
\end{document}

• Thank you for such an elaborate answer! Since campa's answer is written as a comment, allow me to put your reaction as formal answer. Actually, I bumped into situation 2, managed to get control of the text by using environment \mypage (which felt weird even to me as a beginner :D). Sadly I cannot go through the whole code to learn from it, right now I am at work and also was charged to focus on different project, but tested it in my document and works perfectly :) – Tomáš Kruliš Jun 14 '18 at 11:31
• On the formating note – this document is kind of specific, so I cannost use colors, for instance, but I definitely think about more interesting design of the table. With regards Tomáš – Tomáš Kruliš Jun 14 '18 at 11:32