I have a short Template::Toolkit script meant to handle a mail merge between a csv file and a template.tex file.

The perl side of this is working fine for me (from almost the first moment I drafted it), but getting the LaTeX part of this right has been a hair pulling experience. perldoc makes sense to me in ways that spending the day reading LaTeX artciles has not.

I have two, perhaps three issues at this point:

(1) Making my letterhead render with the logo in the top left corner (even inside the generous margins LaTeX offers by default), with the copy from the letterhead centered in a box to its right, all above the horizontal line offered by the letterhead.tex template;

(2) sorting out where the \begin and \end{document} commands ought to go given that I have one .tex file seeking to include another .tex file; and

(3) figuring out how to make that indentation work for all the lines related to the pollwatcher which are pulled from the data.

My letterhead.tex file:

\documentclass{article} \usepackage{fancyhdr} \usepackage[letterpaper]{geometry} \usepackage[pdftex]{graphicx} \pagestyle{fancy} \addtolength{\headheight}{0.25in} \begin{document} \fancyheadoffset[L]{10pt} \fancyhead[L]{\includegraphics{ggp_logo_100px}}% \begin{minipage}[t]{5in} \setlength\oddsidemargin{2in} \begin{center} \Large\textbf{The Georgia Green Party} \\ \normalsize {P.O. Box 450012; Atlanta GA 31145 \\ 404-574-3471 * ggp@greens.org \\ \underline{http://www.greens.org/georgia/}} \bigskip \small\emph{Ecological Wisdom * Grassroots Democracy * Social Justice +* Peace and Nonviolence \\ Decentralisation * Community-Based Economics * Feminism * Respect for +Diversity \\ Personal and Global Responsibility * Future Focus on Sustainability } \end{center} \end{minipage} \end{document}
and my pollwatcher_408b1.tmpl file:

\documentclass{article} % \include{letterhead} \begin{document} {The Superintendent of Elections \\ for [% County_Name %] County Georgia \\ [% County_Addr1 %] \\ [% County_Addr2 %] \\ [% County_city_st_zip %] \\ [% date %] \\ The undersigned, Chairperson(s) and Secretary of the Georgia Green Par +ty, pursuant to our authority under the Georgia Election Code, [% co +de_authority %], designate the below individual as a poll watcher for + the [% Election_Date_and_Type %] and assign them to observe operatio +ns at [% Precinct_Name %]; [%Precinct_Address %]. \\ \setlength\parindent{4em} [% Poll_Watcher %] \\ \setlength\parindent{4em} Birthday: [% Poll_Watcher_Birthdate %] \\ \setlength\parindent{4em} [% Poll_Watcher_Addr1 %]; [% Poll_Watcher_city_st_zip %] \\ \setlength\parindent{0em} We are yours for a just and sustainable future, \\ Thano Paris, Co-Chair \\ Harry Rezzemini, Secretary \\ \end{document}
And the trivial test script that is supposed to put it altogether (merging data from database awaits a working test of what is shown above), called: create_pollwatcher_letter.pl

#!/usr/bin/perl -w use strict; use warnings; use Template; use Template::Plugin::Latex; my $cfg = { INCLUDE_PATH => '/home/hesco/GP/GGP/PollWatchers/Templates' }; my $template = Template->new($cfg); my $vars = { County_Name => 'Camden County', County_Addr1 => '208 East 4th Street', County_Addr2 => 'P.O. Box 608', County_city_st_zip => 'Woodbine GA 31569-0608', date => 'Monday, October 27th, 2008', code_authority => '21-2-408(b)(1)', Election_Date_and_Type => 'November 4th, 2008 General Election', Precinct_Name => 'Woodbine City Hall 03 Precinct', Precinct_Address => '310 Bedell Avenue; Woodbine GA 31569' +, County => 'Camden', Poll_Watcher => 'Jane Citizen', Poll_Watcher_Birthdate => 'January 31, 1956', Poll_Watcher_Addr1 => '197 Some Drive', Poll_Watcher_city_st_zip => 'Brunswick GA 31525', }; my $input = 'pollwatcher_408b1.tmpl'; my $output = 'test'; $template->process($input,$vars,"$output.tex", binmode => 1) || die $t +emplate->error(); # my $result = `latex "$output.tex"`; # $result = `dvips "$output.dvi"`; # $result = `ps2pdf "$output.ps"`; 1;
Any and all advise is appreciated. Thanks,

-- Hugh

if( $lal && $lol ) { $life++; }

In reply to OFF-TOPIC: Seeking LaTeX advice, please by hesco

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.