Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am new to Latex, trying to using it to prepare a first laboratory test report. I have found a way to mimic the layout of front page of the existing document using a series of stacked tables as shown below. However I could not find a way to automatically adjust the height of the last (bottom) table to the text contained in it. (ie filling the table with empty lines, in such a way that the bottom of the frame would be always at the same place, regardless of the amount of text in the conclusion. Any idea? or another approach to make the layout ?Thanks.

\documentclass[draft, a4paper, 11pt, english]{report} % Mode draft
\usepackage[utf8]{inputenc} % UTF-8 encoding for code editing
\usepackage[T1]{fontenc}
\usepackage{tgheros}% Fonts
\usepackage{fancyhdr}% Handling headers and footers 
\usepackage[top=3cm, bottom=3cm, left=2cm, right=2 cm]{geometry} %
\usepackage{array}
\usepackage{tabularx}
\usepackage{colortbl,hhline}
\usepackage{xcolor}
\usepackage{ifthen} % Use of tests
\usepackage{lastpage} % Handling last page numbering 
\usepackage{lipsum} %only for tests 

% [DEFINITION OF GLOBAL CONFIGURATION AND VARIABLES  ]-------------------------------------
\def\MaxTableWidth{0.8\textwidth}
\definecolor{Color_logo}{RGB}{0, 115, 174} %setting color for logo
\renewcommand{\familydefault}{\sfdefault}%selecting default font (clone of helvetica)   %-------------------------------------------------------------------------
\begin{document}
\thispagestyle{fancy} % enabling special header and footer capability
\fancyhf{} %[cancelling default headers, not suitable for front page]
\renewcommand{\footskip}{1cm} % [distance of footer to bottom]
\setlength{\headheight}{0 pt} %% setting heigth of document header

%--[BEGIN ARGUMENTS FOR FRONT PAGE]---------------
\def\PVnumber {XXXXX} % Setting variable name for document number
\def\CustomerName {Best Customer} 
\def\Restricted{Y} %Y
\def\ProductFileNumber {XXXXX} 
\def\Date{\today}
\def\Products{Machinery} 
\def\PartNumbers{ABCDEF-2, XYZ-2}
\def\TestRequestor{The Requester}
\def\TestPerformer{Test Engineer}
\def\Specification{127-11487 rev 07}
\def\Approver{}
\def\Conclusions{\lipsum[2]}%
%--[END ARGUMENTS FOR FRONT PAGE]---------------
%--------------------------------------------------------------------
%HEADER AND FOOTER FOR PAGE 1 -------------------
\renewcommand{\headrulewidth}{0 pt} %   %  [thickness header line]
\renewcommand{\headwidth}{\linewidth}%  [horizontal length header line]
\renewcommand{\headsep}{0cm}  %  [distance header-main text] 
\renewcommand{\footrulewidth}{1 pt} %  [thickness footer line]
\renewcommand{\footskip}{2.5cm}
\lfoot{\footnotesize\textsl{\copyright \ 2011 by MyCompany INC.  All rights reserved. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and recording, or by any information storage or retrieval system, without permission in writing from MyCompany INC.}}
%  [END OF HEADER AND FOOTER FOR PAGE 1] -------
%-----------------------------------------------------------------   -----
%% [PAGE 1 (MADE OF SEVERAL SMALL TABLES)]  -------
\large\noindent\flushleft
\begin{tabularx}{\textwidth}{|m{11.5cm}|X|}
\hline\smallskip 
\large\centering\textit{\textbf{\textcolor{Color_logo}{BEST TEST LABORATORY}}}&\cellcolor{lightgray}\Large\textbf\ {TEST REPORT}\\
\centering\textbf{NEW YORK}&\cellcolor{lightgray}\ifthenelse{\equal{Y}{\Restricted}}{Restricted to:\\ &\cellcolor{lightgray}\CustomerName}{}\\
\end {tabularx}
\noindent        
 \begin{tabularx}{\textwidth}{|p{8cm}|p{4.5cm}|X|}
 \hline 
 \textbf{Customer:} \CustomerName&Product file: \ProductFileNumber& \textbf {PV\ \PVnumber}\\ &&Page\ \thepage / \pageref{LastPage}\\   
\hline
\end{tabularx}
\begin{tabularx}{\textwidth}{|p{9.5cm}|X|}
\textbf{Product :} \Products&Date: \Date\\
\textbf{Part numbers:} \PartNumbers&Requested by:  \TestRequestor\\
&Tests made by: \TestPerformer\\
\textbf{Specification:} \Specification &Visa: \Approver\\
\hline
\end{tabularx}
\begin{tabularx}{\textwidth}{|X|}
\textbf {Scope:} Qualification per specification127-11487\\
\\\\\hline
\textbf {Conclusion:}\\
\Conclusions\\
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\hline 
\end{tabularx}
\end{document}
share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

The solution is to put the contents of the front page in a minipage as high as desired and box it (in the inner tabular environments the left and right rules are thus omitted, as well as the top and bottom one):

\documentclass[draft, a4paper, 11pt, english]{report} % Mode draft
\usepackage[utf8]{inputenc} % UTF-8 encoding for code editing
\usepackage[T1]{fontenc}
\usepackage{tgheros}% Fonts
\usepackage{fancyhdr}% Handling headers and footers 
\usepackage[top=3cm, bottom=3cm, left=2cm, right=2 cm]{geometry} %
\usepackage{array}
\usepackage{tabularx}
\usepackage{colortbl,hhline}
\usepackage{xcolor}
\usepackage{ifthen} % Use of tests
\usepackage{lastpage} % Handling last page numbering 
\usepackage{lipsum} %only for tests 


% [DEFINITION OF GLOBAL CONFIGURATION AND VARIABLES  ]-------------------------------------
\def\MaxTableWidth{0.8\textwidth}

\definecolor{Color_logo}{RGB}{0, 115, 174} %setting color for logo
\renewcommand{\familydefault}{\sfdefault}%selecting default font (clone of helvetica)   %-------------------------------------------------------------------------

\begin{document}

\thispagestyle{fancy} % enabling special header and footer capability
\fancyhf{} %[cancelling default headers, not suitable for front page]
\renewcommand{\footskip}{1cm} % [distance of footer to bottom]
\setlength{\headheight}{0 pt} %% setting heigth of document header

%--[BEGIN ARGUMENTS FOR FRONT PAGE]---------------
\def\PVnumber {XXXXX} % Setting variable name for document number
\def\CustomerName {Best Customer} 
\def\Restricted{Y} %Y
\def\ProductFileNumber {XXXXX} 
\def\Date{\today}
\def\Products{Machinery} 
\def\PartNumbers{ABCDEF-2, XYZ-2}
\def\TestRequestor{The Requester}
\def\TestPerformer{Test Engineer}
\def\Specification{127-11487 rev 07}
\def\Approver{}
\def\Conclusions{\lipsum[2]}%
%--[END ARGUMENTS FOR FRONT PAGE]---------------
%--------------------------------------------------------------------
%HEADER AND FOOTER FOR PAGE 1 -------------------
\renewcommand{\headrulewidth}{0 pt} %   %  [thickness header line]
\renewcommand{\headwidth}{\linewidth}%  [horizontal length header line]
\renewcommand{\headsep}{0cm}  %  [distance header-main text] 
\renewcommand{\footrulewidth}{1 pt} %  [thickness footer line]
\renewcommand{\footskip}{2.5cm}
\lfoot{\footnotesize\textsl{\copyright \ 2011 by MyCompany INC.  All rights reserved. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and recording, or by any information storage or retrieval system, without permission in writing from MyCompany INC.}}
%  [END OF HEADER AND FOOTER FOR PAGE 1] -------
%-----------------------------------------------------------------   -----
%% [PAGE 1 (MADE OF SEVERAL SMALL TABLES)]  -------
\newsavebox{\frontpagebox}
\begin{lrbox}{\frontpagebox}
\begin{minipage}{\textwidth}
\large\flushleft
\begin{tabularx}{\textwidth}{m{11.5cm}|m{\dimexpr\textwidth-11.5cm-4\tabcolsep\relax}}
\smallskip\large\centering\textit{\textbf{\textcolor{Color_logo}{BEST TEST LABORATORY}}}&
  \cellcolor{lightgray}\smallskip\Large\textbf\ {TEST REPORT}\\
\centering\textbf{NEW YORK}&
  \cellcolor{lightgray}\ifthenelse{\equal{Y}{\Restricted}}{Restricted to:\\ &
  \cellcolor{lightgray}\CustomerName}{}\\
\end{tabularx}

\kern-1pt

\begin{tabularx}{\textwidth}{p{8cm}|p{4.5cm}|X}
\hline 
\textbf{Customer:} \CustomerName&
  Product file: \ProductFileNumber&
  \textbf {PV\ \PVnumber}\\ &&
  Page\ \thepage / \pageref{LastPage}\\   
\hline
\end{tabularx}
\begin{tabularx}{\textwidth}{p{9.5cm}|X}
\textbf{Product :} \Products&Date: \Date\\
\textbf{Part numbers:} \PartNumbers&Requested by:  \TestRequestor\\
&Tests made by: \TestPerformer\\
\textbf{Specification:} \Specification &Visa: \Approver\\
\hline
\end{tabularx}
\begin{tabularx}{\textwidth}{X}
\textbf {Scope:} Qualification per specification127-11487\\
\\\\\hline
\textbf {Conclusion:}\\
\Conclusions
\end{tabularx}
\end{minipage}
\end{lrbox}
\noindent{\fboxsep=-\fboxrule\fbox{\parbox[t][0.99\textheight]{\textwidth}{\usebox{\frontpagebox}}}}
\end{document}
share|improve this answer
    
Expanding on this a bit, for Scope you could also do \textbf {Scope:}\\\vbox to 0.3 in {\Scope}\\\hline. –  rdhs Jan 31 '12 at 21:49
    
This works beautifully. Thanks. –  Yves Feb 1 '12 at 19:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.