Create a table with three columns above two columns
You can use two tabular-like environments; in the first example below I kept the vertical rules; in the second one I removed them and used the features provided by the booktabs
package:
\documentclass[a4paper,10pt]{article}
\usepackage{booktabs}
\usepackage{tabularx}
\begin{document}
\noindent\begin{tabularx}{\textwidth}{|X|X|X|} \hline
Date: 16/12/11 & Ref: Title & Rev: No.\\
\end{tabularx}\offinterlineskip
\noindent\begin{tabularx}{\textwidth}{|X|X|} \hline
Author: Author Name & Client: Company Name\\ \hline
\end{tabularx}
\vspace{1cm}
\noindent\begin{tabularx}{\textwidth}{@{}XXX@{}} \toprule
Date: 16/12/11 & Ref: Title & Rev: No.\\
\end{tabularx}\offinterlineskip
\noindent\begin{tabularx}{\textwidth}{@{}XX@{}} \midrule
Author: Author Name & Client: Company Name\\ \bottomrule
\end{tabularx}
\end{document}
\documentclass[a4paper,10pt]{article}
\usepackage{tabularx}
\def\MC#1{\multicolumn{3}{@{}c@{}}{%
\tabular{|p{\dimexpr 0.5\textwidth-2\tabcolsep} |
p{\dimexpr 0.5\textwidth-2\tabcolsep} |}
#1\endtabular}}
\begin{document}
\begin{center}
\begin{tabularx}{\textwidth}{|X|X|X|} \hline
Date: 16/12/11 & Ref: Title & Rev: No.\\ \hline
\MC{Author: Author Name & Client: Company Name}\\ \hline
\end{tabularx}
\end{center}
\end{document}
You note
but the extra padding is being added on the left of the cell contents, I would like it on the right.
I interpret this requirement as stating that the contents of the cells should be left-aligned. Here's an MWE that satisfies this requirement. Note that I've eliminated the vertical lines because I think the information looks less "boxy" without them. For the sake of the example, I've also place the date, ref, etc information in italics mode, but how exactly you want to typeset that is clearly up to you.
The MWE also uses the commands \toprule
, \midrule
, and \bottomrule
of the booktabs
package to get (IMHO) better vertical spacing than is possible with the \hline
command. Note that the middle horizontal line, produced with the command \midrule
, is slightly lighter than the top and bottom lines. If you want all three lines to have the same (heavy) weight, you can simply replace \midrule
with \midrule[\heavyrulewidth]
.
\documentclass[a4paper,10pt]{article}
\usepackage{tabularx,booktabs}
\newcommand{\headerlines}{%
\begin{tabularx}{\textwidth}{@{}XXX@{}}
\toprule
Date: \emph{12/16/2011} &Ref: \emph{Title}& Rev.~No. \emph{1234}\\ \midrule
\end{tabularx}
\begin{tabularx}{\textwidth}{@{}XX@{}}
Author: \emph{Author Name} & Client: \emph{Company Name}\\ \bottomrule
\end{tabularx}}
\begin{document}
\noindent\headerlines
\end{document}