# Automatic report generation

I am trying to automatically create a curriculum vitae (or any other document if one would prefer) from a datafile that holds all values/entries.

Here are my individual files that go into this project:

CV.tex reads in CV_data.tex and uses CV_formats.tex to create a curriculum vitae in this case. All three files must be in the same directory and one must run CV.tex to invoke the other two and build the final document.

The resume class I am using can be found here

CV.tex

\input{CV_formats}

\begin{document}
\input{CV_data}
\end{document}
%% eof


CV_formats.tex

\documentclass{res}
%
% \usepackage[paper=letterpaper,left=1.0in,right=1.0in,top=1.0in,bottom=1.0in,]{geometry}
% \usepackage{res}
%
\usepackage{ifthen}              %% if-then-else arguments
\usepackage{paralist,array}      %% enhancements to array environment
\usepackage{float,multirow,longtable}  %% multipage tables, multirow cells
\usepackage{lscape,rotating}     %% allows for landscape tables and figures
\usepackage{color,url}           %% allows for colors and easy formatting of URL's
\usepackage{amsmath,amssymb}     %% AMS math macros; esp. \text{} in math environment
%%%%%%%%
\usepackage{fancyhdr}
\pagestyle{fancy}

\usepackage[T1]{fontenc}
%\usepackage{newcent}   % uses new century schoolbook postscript font
\newsectionwidth{0pt}  % So the text is not indented under section headings
\usepackage{fancyhdr}  % use this package to get a 2 line header
\renewcommand{\headrulewidth}{0pt} % suppress line drawn by default by fancyhdr
\pagestyle{fancy}     % set pagestyle for document
% \usepackage{hyperref}
\rhead{ {\it My.Name.GoesHere}\\{\it p. \thepage} } % put text in header (right side)
\cfoot{}                                     % the foot is empty
\topmargin=-0.5in % start text higher on the page

%% =============================================================================
\def\output#1{\def\outp@t{#1}}   %% output format specifier
%% --- SET OUTPUT FORMAT -----
\output{CV}
%% =============================================================================
%
%% =========================================
%% definition of data names
\def\name#1{\def\n@me{#1}}
\def\educationa#1{\def\educ@tiona{#1}}
\def\educationb#1{\def\educ@tionb{#1}}
\def\educationc#1{\def\educ@tionc{#1}}

\def\institutea#1{\def\in@titutea{#1}}
\def\instituteb#1{\def\in@tituteb{#1}}
\def\institutec#1{\def\in@titutec{#1}}
%
% \def\gpa1#1{\def\gp@1{#1}}
% \def\gpa2#1{\def\gp@2{#1}}
% \def\gpa3#1{\def\gp@3{#1}}

\def\dissertationa#1{\def\dissert@tiona{#1}}
\def\dissertationb#1{\def\dissert@tionb{#1}}
\def\dissertationc#1{\def\dissert@tionc{#1}}

\def\skillsa#1{\def\skill@a{#1}}
\def\skillsb#1{\def\skill@b{#1}}
\def\skillsc#1{\def\skill@c{#1}}

% \def\status#1{\def\st@tus{#1}}
% \def\investigator#1{\def\investig@tor{#1}}
% \def\CoI#1{\def\Co@I{#1}}
% \def\location#1{\def\loc@tion{#1}}
% \def\note#1{\def\n@te{#1}}
%%% initialize data names
\name{}
\educationa{}
\educationb{}
\educationc{}
\institutea{}
\instituteb{}
\institutec{}
%   \gpa1{}
%   \gpa2{}
%   \gpa3{}
\dissertationa{}
\dissertationb{}
\dissertationc{}
\skillsa{}
\skillsb{}
\skillsc{}
%% ------------------------------------------

%%%
\newcommand{\ms}{\rule[-0.5ex]{0pt}{3.5ex}}
\newcommand{\ws}{\rule[-1.5ex]{0pt}{5ex}}
%% ==========================================
%% CV format for table descriptions
%\newcommand{\FormFperiod}{Performance Period: }
%% -------------------------------------
\begin{resume}
\newcommand{\CVentry}{

\name{\n@me\\ [12pt]  }% the \\[12pt] adds a blank line after name

\vspace{0.2in}
\section{\centerline{EDUCATION}}
\vspace{8pt}

{\sl \textbf{\educ@tiona, \in@titutea}}\\
\textbf{\dissert@tiona} \\
{Skills:} \skill@a

{\sl \textbf{\educ@tionb}}\\
\textbf{\dissert@tionb} \\
{Skills:} \skill@b

{\sl \textbf{\educ@tionc}}\\
\textbf{\dissert@tionc} \\
{Skills:} \skill@c

%% reset variables
\name{}
\educationa{}
\educationb{}
\educationc{}
\institutea{}
\instituteb{}
\institutec{}
%   \gpa1{}
%   \gpa2{}
%   \gpa3{}
\dissertationa{}
\dissertationb{}
\dissertationc{}
\skillsa{}
\skillsb{}
\skillsc{}

}
\end{resume}

\ifthenelse{\equal{\outp@t}{CV}}{% true condition
\def\entry{\CVentry}
}{}% leave false condition blank

%% eof


CV_data.tex

%% ==========================================
\name{My.Name}
\educationa{PhD}
\educationb{MS}
\educationc{BE}
\institutea{MTU}
\instituteb{MTU}
\institutec{VTU}
%   \gpa1{}
%   \gpa2{}
%   \gpa3{}
\dissertationa{P1}
\dissertationb{P2}
\dissertationc{P3}
\skillsa{s1}
\skillsb{s2}
\skillsc{s3}
%   \entry

%% end data
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


When I run CV.tex it doesn't seem to generate my full document and skips all the "address", "education", "institute", "dissertation" details.

What am I missing in the implementation? This was built on a previous colleague's implementation and he is unavailable to ask! :(

• Side comment: you might be interested in Peter Flynn's ideas about using LaTeX in conjunction with XML. – jub0bs Jun 2 '13 at 14:56
• Your datafile isn't doing anything, it only stores informations. Try what happens if you uncomment the line with \entry. – Ulrike Fischer Jun 2 '13 at 17:07
• With \entry it didn't make any difference! Will try a few more things. I wonder if it is because of the res class wreaking havoc? – dearN Jun 2 '13 at 17:39

There are 3 main errors in your files:

1. In CV_formats.tex, remove the \begin{resume} and \end{resume}. You can't use an environment (which on top you haven't defined) before \begin{document},

2. Resumes are typeset by the \CVentry command. Add that command after \input{CV_data} in CV.tex, and

3. As you are using the @ character as part of command names in CV_formats.tex, you need to write \makeatletter before the first line using @ (i.e., \def\output#1{\def\outp@t{#1}}) and add \makeatother at the end of the file.

Result:

• Thanks for your reply. I don't understand what 2) that you suggest means. "Add that command after \input{CV_data} in CV.tex, and"... What is that command? – dearN Jun 2 '13 at 18:31
• @drN \CVentry, the command mentioned in the previous sentence – Xavier Jun 2 '13 at 19:38
• would you mind sharing what you did? – dearN Jun 3 '13 at 19:29
• @drN I did exactly what I wrote in my answer. I've uploaded the files here for you. – Xavier Jun 4 '13 at 4:17