[texhax] Documents with multi-line headers, and mostly a multi-page table contents

Gordon Haverland ghaverla at materialisations.com
Sun Apr 10 03:54:07 CEST 2011


Hello.

I've played with TeX and LaTeX a long time (1985?), never had a 
need to ask a question.  Hopefully someone can help.

I'm trying to generate "reports" out of a database, and nominally 
I will have a Perl program read the database and write LaTeX 
source, which will get processed by pdflatex to produce PDFs.

The original reports consist of a header on each page, and the 
body of the document almost entirely consists of a multipage 
table.  The document ends with a Notes section (which is either a 
list or a table).

The header varies from report to report, the one I am playing with 
has a header that is 14 lines long.  Which is not quite what 
fancyhdr seems to be comfortable with.

The header looks like a bunch of stacked rectangles.  The upper-
left rectangle will eventually contain a SVG letterhead.  Running 
pdflatex multiple times produces the body table being about the 
width of the header, but not exactly.

Problems:
 1) The upper-right rectangle should have the text near the right 
border.  I can force this by inserting a hspace, but I think I 
don't need to.  I don't understand why 'r' justification doesn't 
place the text at the right.
 1a) When I first started playing with this, the LastPage 
reference worked.  Now it doesn't work (I just get ?? for 
LastPage).
 2) The 3rd line contains 3 rectangular areas.  The right most 
rectangle has the same problem as the first line.
 3) The middle rectangle is supposed to be centered.
 4) The left rectangle has always started some distance below the 
line that defines the box for the table.  I've never had tables do 
this before, but I would like the content to start at the top of 
the space, and not 1 or 2 lines down.
 5) Running pdflatex multiple times, the hyperref link from a note 
in the header (which will be on every page) doesn't resolve.
 6) Quirk: it would be nice to have the same border width for the 
double lines around the header box.

A couple of "minimal" files are below.

Thanks for any suggestions.
Gord


==========pg.tex=============
\documentclass[11pt,letter,oneside]{report}

\usepackage{tabularx}
\usepackage{textcomp}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{ltxtable}
\usepackage{hyperref}


\setlength{\textwidth}{7.5in}
\setlength{\evensidemargin}{-0.75in}
\setlength{\oddsidemargin}{-0.75in}

\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}

\setlength{\tabcolsep}{2pt}

\setlength{\fboxsep}{2pt}
\newlength{\msinnerbox}
\setlength{\msinnerbox}{\textwidth}
\addtolength{\msinnerbox}{-0.5\fboxsep}

\newsavebox{\edochdr}
\sbox{\edochdr}{
\fbox{
  \begin{minipage}{1.0\textwidth}
    \begin{tabularx}{\msinnerbox}{|X|r|}
      \hline
      EngineeringLetterhead & {
            \begin{tabularx}{0.2\msinnerbox}{r}
              {\large{\bf A}} \\
              Rev. 3 \\
              \hfill January, 2009 \\
              \thepage~of~\pageref{LastPage} \\
            \end{tabularx}
          } \\
      \hline
    \end{tabularx}

    \begin{tabularx}{\msinnerbox}{|X|} \hline
      \begin{center}
        {\large{\bf Piping Material Specification}}
      \end{center}
    \end{tabularx}

    \begin{tabularx}{\msinnerbox}{|X|r|r|} \hline
      {\bf Some title\newline}
      Some really long content that just goes on forever.  But
      what is it really?  I don't know. \vfill
          & {
            \begin{tabularx}{0.30\msinnerbox}{rrcrr}
              \multicolumn{5}{c}{\bf Pressure Limits} \\
              1965       & kPa      & @ &       -29 & 
\textdegree{C} \\
              {\sl 280} & {\sl psi} & @ & {\sl -20} & {\sl 
\textdegree{F}} \\
              1172       & kPa      & @ &       260 & 
\textdegree{C} \\
              {\sl 170} & {\sl psi} & @ & {\sl 500} & {\sl 
\textdegree{F}} \\
            \end{tabularx}
          } & {
                \begin{tabularx}{0.20\msinnerbox}{c}
                  {\bf B31.3 Piping} \\
                  Class \\
                  {\bf 150} \\
                  ASME
                \end{tabularx}
          } \\
      Note: 1\ref{n:1} & & \\
      \hline
    \end{tabularx}

    \begin{tabularx}{\msinnerbox}{|X|X|X|} \hline
      CA: 1.6mm ({\sl 0.0625in\/}) &
        PWHT: Code &
          Tubing Class: CLC \\
      Radiography: 10\% &
        Material Group: 1.1 &
          Branch Table: 1 \\
      \hline
    \end{tabularx}

  \end{minipage}
}
}

\setlength{\textheight}{10.0in}
\setlength{\topmargin}{-0.5in}
\newlength{\msheadheight}
\settoheight{\msheadheight}{\usebox{\edochdr}}
\setlength{\headheight}{\msheadheight}
\addtolength{\headheight}{1.25in}
\addtolength{\headheight}{18pt}


\chead{
  \usebox{\edochdr}
}

\renewcommand{\headrulewidth}{0pt}


\begin{document}

\LTXtable{\textwidth}{table.tex}

\begin{tabularx}{\msinnerbox}{X} \hline
 {\label{n:1}1: This is note 1.} \\
 {\label{n:2}2: This is note 2.} \\
\end{tabularx}
\end{document}
================table.tex=============
\setlength{\tabcolsep}{6pt}

\begin{longtable}{llllXll}
  \caption*{Valves: ASME B16.5, B16.10} \\
  \hline % \toprule
  Type & NPS (in) & Rating & Joint & Material & Tag & Notes \\
  \hline % \midrule
  \endhead
  % \cmidrule{7-7}
  \hline
  \multicolumn{7}{c}{\textit{continued}}

  \endfoot
  \hline % \bottomrule
  \endlastfoot

  {\bf Gate Valve} \\
  API 602 & 0.5 to 1.5 & 150 Class & RF & A105-N, TR 8, bolted 
bonnet, OS\&Y, solid wedge & GABCD0 & 2\ref{n:2} \\
          & 2 to 12    & 150 Class & RF & A216-WCB, TR 8, welded 
bonnet, OS\&Y, flexible wedge & FEDK3 & \\
          & 14 to 24   & 150 Class & SW & A216-WCB, TR 8, welded 
bonnet, OS\&Y, flexible wedge, gear oper. & ABCD5 & \\
  \hline
\end{longtable}



More information about the texhax mailing list