# $Id$ use Text::Wrap; use vars qw(%DISPATCH $ME $TODAY); %DISPATCH = ( b => sub { "{\\bfseries $_[2]} " }, i => sub { "{\\itshape $_[2]} " }, strong => sub { "{\\bfseries $_[2]} " }, em => sub { "{\\itshape $_[2]} " }, br => sub { "\\\\\n" }, a => \&a, resume => \&resume, author => \&author, address => \&address, education => \&education, school => \&school, experience => \&experience, employer => \&employer, skills => \&skills, skill => \&skill, references => \&references, ); sub cleantext($) { my $text = shift || die 'usage: cleantext($text)'; $text =~ s/\\/\textbackslash/gsm; $text =~ s/~/\\textasciitilde/gsm; $text =~ s/\Q^/\\textasciicircum/gsm; foreach my $char ('&', '%', '$', '#', '_', '{', '}') { $text =~ s/\Q$char\E/\\$char/gsm; } $text; } sub header($) { my $header = shift || return ''; qq(\\seriesheader{$header}\n\n); } sub link($$) { my $text = shift || return ''; my $href = shift || ''; $text = cleantext $text; $text =~ s|://|:/\\hspace{-2pt}/|; # prettier cmss double-slashes $href ? qq(\\href{$href}{\\small\\sffamily $text}) : $text; } sub hiddenlink($$) { my $text = shift || return ''; my $href = shift || ''; my $cleantext = cleantext $text; $href ? qq(\\href{$href}{$cleantext}) : $cleantext; } sub a($$) { my($tag, $attribute, $text) = @_; &link($text, $attribute->{href}); } sub resume { my(undef, undef, $text, %meta) = @_; my $author = $meta{author} || ''; my $email = $meta{email} || ''; my $credit; if($author && $email) { $credit = "$author ($email)"; } elsif($author) { $credit = $author; } elsif($email) { $author = $email; $credit = $email; } else { $author = 'unknown author'; $credit = 'Unknown Author'; } my $keywords = ''; $keywords = "\n pdfkeywords={$meta{keywords}}," if exists $meta{keywords}; return << " EndLaTeX"; % ======================================================================== % resume.tex - Resume for $author % $credit % % LaTeX2e document using the hyperref package for hyperlinks under PDF % generation. This file is dynamically generated from an XML source. % This source has been tested with teTeX 2.0.2 and hyperref 6.71; % I recommend the high-quality Type 1 fonts distributed by the AMS. % % Generated by $ME on $TODAY % ======================================================================== \\documentclass[dvips]{article} \\paperheight 11in \\paperwidth 8.5in % Paper height, width \\textheight 10in \\textwidth 6.5in % Body height, width \\headsep 0in \\pagestyle{empty} % No headers or numbers \\topmargin -0.75in \\oddsidemargin 0.0in % Top, side margins \\parindent 0.0in \\parskip 6pt % Paragraph defaults \\renewcommand{\\baselinestretch}{1.0} % Single space % Use ragged right for paragraphs (the "descriptionblock" enviornment). \\usepackage{ragged2e} % Include the hyperref package for hyperlinks. Set defaults for print, % e.g., do not format links differently from body text. \\usepackage[dvips, pdftitle={$author Resume}, pdfauthor={$credit}, pdfsubject={Resume for $author},$keywords colorlinks=true,linkcolor=link,filecolor=link,citecolor=link,urlcolor=link, pdfpagemode=UseNone,bookmarks=false,bookmarksopen=false] {hyperref} % Do not color links differently from body text. \\usepackage{color} \\definecolor{link}{rgb}{0,0,0} % ------------------------------------------------------------------------ % Define some new commands for section headers and default styles % for typesetting names and such. \\newcommand{\\seriesheader}[1]% {\\vspace{9pt}\\par{\\large {{\\bfseries #1}}}\\vspace{3pt}\\par} \\newcommand{\\school}[1]{{\\bfseries #1}} \\newcommand{\\employer}[1]{{\\bfseries #1}} \\newcommand{\\position}[1]{{\\itshape #1}} % Might want underlines \\newcommand{\\locationdate}[2]{#1\\hfill#2} % Left/right justified % ------------------------------------------------------------------------ % The descriptionblock environment typesets a flush-right indented % box, taking as an argument a position. \\newenvironment{descriptionblock}[1]% {\\begin{flushright}% \\vspace{-9pt}% \\begin{minipage}[r]{6.25in}% \\position{#1}% \\RaggedRight }% {\\end{minipage}% \\vspace{-3pt}% \\end{flushright}% } % The bulletlist environment typesets a standard bulleted list. \\newenvironment{bulletlist}% {\\renewcommand{\\labelitemi}{\$\\bullet\$}% \\begin{itemize}{}% \\setlength{\\rightmargin}{2in}% \\setlength{\\topsep}{0pt}% \\setlength{\\itemsep}{1.5pt}% \\setlength{\\partopsep}{0pt}% \\setlength{\\parskip}{0pt}% }% {\\end{itemize}% } % ------------------------------------------------------------------------ \\begin{document} $text\\end{document} % ------------------------------------------------------------------------ EndLaTeX } sub author { my($tag, $attribute, $text) = @_; $text = hiddenlink($text, $attribute->{href}); return << " EndLaTeX"; \\begin{center} {\\Large {\\bfseries $text}}\\\\\\vspace{2pt}% EndLaTeX } sub address { my($tag, $attribute, $text) = @_; return << " EndLaTeX"; $text \\end{center}\n EndLaTeX } sub education { header("Education") . $_[2] } sub experience { header("Work Experience") . $_[2] } sub skills { '\seriesheader{Applicable Job Skills}\vspace{-6pt}' . "\n\n \\begin{bulletlist}%\n$_[2] \\end{bulletlist}\n\n" } sub school { my($tag, $attribute, $text) = @_; my($name, $location, $href) = map {$attribute->{$_}} qw(name location href); $name = hiddenlink($name, $href); $name = wrap(' \school{', ' ', $name . "} ($location)"); $text = wrap(' ', ' ', $text); return << " EndLaTeX"; $name \\begin{descriptionblock}{} $text \\end{descriptionblock}\n EndLaTeX } sub employer { my($tag, $attribute, $text) = @_; my($name, $location, $dates, $position, $href) = map {$attribute->{$_}} qw(name location dates position href); $name = hiddenlink($name, $href); $name = wrap(' \employer{', ' ', $name . '}\\\\'); $dates =~ s/\-+/\-\-/g; my $locationdate = wrap(' \locationdate{', ' ', $location . '}{' . $dates . '}'); my $returnvalue = << " EndLaTeX"; $name $locationdate \\begin{descriptionblock}{$position\. } EndLaTeX $text = cleantext $text; $returnvalue . wrap(' ', ' ', $text) . "\n \\end{descriptionblock}\n\n"; } sub skill { my($tag, $attribute, $text) = @_; $text = cleantext $text; wrap(' {\item ', ' ', $text . '}') . "\n"; } sub references { my($tag, $attribute, $text) = @_; $text = cleantext $text; return << " EndLaTeX"; \\begin{center} {\\itshape $text} \\end{center} EndLaTeX } 1;