Archive for March, 2006

rtex PDF mojo on Windows

Bruce Williams has release a nice plugin to access pdftex using Rails Views to generate PDFs:

http://codefluency.com/pages/rtex

pdftex is probably already installed if you are on a *nix system, but if on Windows you’ll need to install it. I’m in that category (for the moment) and found it pretty easy to get going.

There are many LaTeX distributions and most of them now include pdftex. I used one called proTeXt that promised to be comprehensive and easy to install. It seems to be both so far:

http://www.tug.org/protext/

It’s a substantial download of about 415 MB. I don’t know if there are others that are lighter – probably so. This one includes 2 different editors along with a number of other extras. I was interested in LaTeX itself as I’ve heard about it over the years and just never had a good reason to dive in and check it out. So I grabbed proTeXt as it seems it will allow me to dig in a bit. I used to work in the graphic design world and had a particular liking for working with text, so I want the full tour.

After you download, extract the archive to a temp directory. Then open up the directory structure to protext/install and open the PDF for your language. The rest of proTeXt is actually installed by use of this PDF. It’s a pretty nice system really – you get a couple paragraphs on why you are about to do what you are about to do, then a link is presented that starts the next install. It’s very clear about what can be skipped (like those two editors) and what is essential. Pretty cool, really.

Install the plugin to a Rails app and fire it up. Bruce has a sample controller method – just be sure to add ‘renderwithoutlayout’:

  def mypdf    @time = Time.now    renderwithoutlayout  end

The ‘rtex’ view (mypdf.rtex) is:

  documentclass[11pt]{article}  begin{document}

    The time is <%= @time %>.

  end{document}

This is kind of a throwback to me. In the early 90s I worked to convert a publishing system at a newspaper from using a linotype typesetting machine to using Macs and QuarkXPress (version 3 was just about to come out – woo!). This looks kind of like the markup that our typesetter understood. It should work well for generating documents, but I’m not sure I’m ready to start inserting LaTeX into my writing. But for generating documents it looks to work well, and it seems you have about as much typographic control as those old typesetters did, which was really a pleasure to see, if not to mark-up.

Next step is to try creating a table. I’ll post a sample when I have one.