Sunday, February 26, 2012

Weddings with Awk, Latex and Google Docs

Hey guys, I'm getting married! Pretty sweet, right?

Like any good software developer, I am always trying to save myself boring work with scripts and tools. Sure it may end up taking more time, but it's more fun.

Anyway, I thought I'd share a little bit of our wedding workflow, since I think it has been pretty effective. It all starts off with a few Google docs. These documents are all shared, so both my fiance and I can update them at any point during the day. Those documents include a text file with ideas and tasks to be completed, along with a spreadsheet of the gifts we've received, who gave them and whether or not we'd sent them a thank-you. We don't want to forget anyone, nor forget what they gave!

But the most useful document has been a spreadsheet containing the guest list. In the row for each name we filled in their addresses as we received them along with a Y/N column indicating whether or not that person would have a 'plus one.' We were careful to put each piece of the address (street, city, state, ...) into its own column, which is helpful for the script I wrote later. We also had two Y/N columns indicating whether that person had been sent a save-the-date and an invitation.

Putting the addresses in a spreadsheet, as opposed to a Word document, is a great idea, because then it can be exported in CSV format, and I can write scripts over them. After exporting the guest list to CSV format, I wrote an Awk script that would go through the file and output a LaTeX file so that I could generate address labels. I used the "envlab" LaTeX package for generating the labels, and because I had saved each part of the address as its own column, it was easy to play around with alignments (e.g., "should the apartment number go on its own line or after the street?"). Also, I made the outputting of an address label conditional on the Y/N value in the column recording whether or not that person had already received an invitation. This was really useful, since we wanted to send out save-the-dates as soon as possible, even before we had addresses for everyone. So we could effectively run the script any time we wanted without having to worry about generating the same label twice. Finally, we printed the labels onto those standard Avery 5160 inkjet labels (or at least a compatible label). I happen to think that the clear labels look really good, and professional.

So that's it. Nothing particularly clever, but I kind of wanted to share my experiences. I think that overall we've saved a ton of time generating the labels this way. Certainly vs. writing them by hand, but even vs. using Word to create the labels.

3 comments:

  1. Congratulations!!! I hope you spend lots of years full of joy and happy memories together!


    I really like the idea. I wish we could think of something like this when we are getting married :(

    By the way, would you like to share your script? :) Maybe I could use it for a different occasion :)

    Thanks in advance!

    ReplyDelete
  2. Thanks!

    Yes, I'll reprint the script below. You may not find it that enlightening because there are a bunch of references to columns in my wedding guest list (those are the things lik $18, $20, etc.).

    Hope this is useful!



    BEGIN { FS = ",";
    print "\\documentclass{letter}";
    print "\\usepackage[avery5160label,noprintbarcodes,nocapaddress]{envlab}";
    # print "\\SetLabel{2.75in}{1in}{0.5in}{0.19in}{0.35in}{3}{10}"
    print "\\makelabels";
    print "\\FirstLabel{1}{1}";
    print "\\begin{document}";
    print "\\startlabels";
    }

    $3 ~ /.+/ && $10 ~ /.+/ && $18 !~ /Y/ {
    printf "\\mlabel{}{\\rmfamily\\normalsize ";
    printf "%s",$10;
    if ( $3 ~ /Y/ ) {
    printf " and Guest";
    }
    printf "\\\\"
    printf "%s",$11;
    if ( $12 ~ /.+/ ) {
    printf "\\\\%s",$12; # Apt
    }
    printf "\\\\";
    printf "%s, %s %s", $13,$14,$15;
    if ( $16 ~ /.+/ ) {
    printf "\\\\%s",$16;
    }
    printf "}\n";
    }
    END {
    print "\\end{document}";
    }

    ReplyDelete
  3. A lot of toss pads that was given as a blessing will in every case please the provider each time the person visits the home of the beneficiary and sees the toss pads being used. bamse af roser

    ReplyDelete