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 in the process of transitioning internal reports to latex from manually created PDF files. And, for the most part I can get the information on the page, but formatting is proving to be more difficult than I anticipated. I've been able to get the basic set up using the longtable package, and striping with colortbl. But I haven't figured out how to put the stroke above and below the page header, or format the region at the top of the page.

I have included an example of the report I am currently working with. Any advice would be appreciated, especially for formatting the region including "Midwest" and above.

http://dl.dropbox.com/u/299036/sample-report.pdf

Thanks.

share|improve this question
1  
The code used to generate the above example, and more specific hints on what exactly you want changing would be helpful. –  Seamus Aug 22 '11 at 13:15
    
Welcome to TeX.sx! Please don't ask "How do I achieve this layout", but rather a question about a specific feature that you're struggling with, one problem per question. This way other users who have a similar problem can benefit from your question and the solutions to it (No one's gonna ask for the same layout as you). It's no problem to ask several questions, if you've made some attempt yourself first. It's enormously helpful to see what you've tried so far to figure out what doesn't work. –  doncherry Aug 22 '11 at 22:52

1 Answer 1

up vote 2 down vote accepted

Here's some possible code producing the required layout. The code contains some explanatory comments.

The titlesec package was used to design the header and the footer.

The tabularx, booktabs, colortbl, and multirow packages were used to generate the tables. Instead of using the tabularx package, you could use (if necessary) the ltablex package to allow page breaks inside the tables.

\documentclass{article}
\usepackage[landscape,margin=1.5cm,includehead,includefoot]{geometry}
\usepackage[pagestyles]{titlesec}
\usepackage[table]{xcolor}
\usepackage{tabularx,booktabs,colortbl,multirow}
\usepackage{lipsum} % just to generate some text

% some space
\newcommand\TSpace{\hspace*{\tabcolsep}}

\setlength\parindent{0pt}

% definition of the page style with required header and footer
\newpagestyle{repstyle}{%
   \renewcommand{\makefootrule}{%
    \color{gray!70}\makebox[0pt][l]{\rule[.9\baselineskip]{\linewidth}{2pt}}}
   \renewcommand{\makeheadrule}{%
    \color{gray!70}\makebox[0pt][l]{\rule[\baselineskip]{\linewidth}{2pt}}%
      \rule[-.5\baselineskip]{\linewidth}{2pt}}
  \sethead
    {\footnotesize\bfseries\TSpace Balance Payments Report -- National}
    {}
    {\footnotesize\bfseries Generated by UserName \today\hspace{2cm}\thepage\TSpace}
  \setfoot{\footnotesize\bfseries\TSpace Reference Code:  SH1SP1SD1DS20110426DE20110426GB3OB1DN1234}{}{}
}

\pagestyle{repstyle}

\newcolumntype{A}{>{\footnotesize}X}
\newcolumntype{B}[1]{>{\footnotesize}p{#1}}
\newcolumntype{C}{>{\footnotesize}c}

% using sans serif font in the document
\renewcommand{\familydefault}{\sfdefault}

\newcommand\Heading[2]{%
\begin{tabularx}{\textwidth}{Xl@{}X}
  \multirow{2}{*}{\huge\bfseries Balance Payments} & #1--#2 
    & Grouped by Region, and ordered by Date / Time \\
  & Restricted to Historical, Pending &
\end{tabularx}\vspace{1ex}
}

% command for writting the first two lines of the payments (Midwest, and Date, Customer Name, etc.). The mandatory argument declares the region: "Midwest", or "East"
\newcommand\RegHeading[1]{%
  \hiderowcolors
  \toprule[1.5pt]\addlinespace[1.5ex]
  \large\bfseries #1 \\ \arrayrulecolor{gray!70}
  \midrule[0.8pt]
  \small\bfseries Date & \small\bfseries Customer Name 
    & \small\bfseries Number &   \small\bfseries Sales Rep Name 
    & \small\bfseries Balance & \small\bfseries Payment Method 
    & \small\bfseries Total \\
  \showrowcolors
}

% command for writting the four last rows (Totals for Midwest, Checking Account, Credit Card and Net Total). Arguments: region, check. acc. total, credit card total, net total.
\newcommand\RegTotal[4]{%
  \hiderowcolors
  \bottomrule[1.5pt]\addlinespace[.3ex]
  Totals for #1 \\
  \midrule
  \multicolumn{2}{l}{\hspace{10pt}\footnotesize Checking Account} &&&&& #2 \\
  \midrule
  \multicolumn{2}{l}{\hspace{10pt}\footnotesize Credit Card} &&&&& #3 \\
  \midrule
  Net Total &&&&&& #4 \\
}


\begin{document}

\Heading{04/26/2011}{04/26/2011}

\rowcolors{1}{blue!10}{}
\arrayrulecolor{black!70}

\begin{tabularx}{\textwidth}{AB{4cm}AB{7cm}AB{3cm}C}
\RegHeading{Midwest}
04/26/2011 & Jones, Mark & 100 & Smith, John & 48.50 & Credit Card & 0.50\\
04/26/2011 & Jones, Mark & 100 & Smith, John & 48.50 & Checking Account & 0.50\\
04/26/2011 & Jones, Mark & 100 & Smith, John & 48.50 & Credit Card & 0.50\\
04/26/2011 & Jones, Mark & 100 & Smith, John & 48.50 & Checking Account & 0.50\\
\RegTotal{Midwest}{1.00}{1.00}{2.00}
\end{tabularx}

\rowcolors{1}{blue!10}{}
\begin{tabularx}{\textwidth}{AB{4cm}AB{7cm}AB{3cm}C}
\RegHeading{East}
04/26/2011 & Jones, Mark & 100 & Smith, John & 48.50 & Credit Card & 0.50\\
04/26/2011 & Jones, Mark & 100 & Smith, John & 48.50 & Checking Account & 0.50\\
04/26/2011 & Jones, Mark & 100 & Smith, John & 48.50 & Credit Card & 0.50\\
04/26/2011 & Jones, Mark & 100 & Smith, John & 48.50 & Checking Account & 0.50\\
\RegTotal{East}{1.00}{1.00}{2.00}
\end{tabularx}

\begin{tabularx}{\textwidth}{AB{4cm}AB{7cm}AB{3cm}C}
\toprule[1.5pt]\addlinespace[1.5ex]
\large\bfseries Grand Totals \\\arrayrulecolor{gray!70}
\midrule[0.8pt]
\multicolumn{2}{l}{\hspace{10pt}\footnotesize Checking Account} &&&&& 1.00 \\
\midrule
\multicolumn{2}{l}{\hspace{10pt}\footnotesize Credit Card} &&&&& 1.00 \\
\midrule
Net Total &&&&&& 2.00 \\
\bottomrule
\multicolumn{2}{l}{\scriptsize 8 transactions accounted for.}
\end{tabularx}

\end{document}

enter image description here

Of course, the code can be improved and simplified, but it will give you a good starting point.

share|improve this answer
    
Wow, you really slam dunked this. I had managed to hack together something that worked, but your example provided some valuable insight on structuring the document. –  Jeffrey Fuller Aug 24 '11 at 17:11

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.