Introduction

The traditional way of writing recipes, and protocols for preparing many chemical reagents, is to list the ingredients needed in the first section (Ingedients or Recipes), and then present a numbered list of steps (Method). This is unfortunate as it separates verbs from the nouns on which they act: after reading what to do with an ingredient, one must refer back to a previous section in order to see how much of it is to be used. Of course, the quantity of ingredient used could be given in parentheses after each mention of its name, but this would introduce redundancy. It would also do nothing to relieve the confusion that can arise when multiple sub-mixtures are prepared, and then recombined.

One solution is the tabular arrangement used by Michael Chu on his website Cooking For Engineers, in which the names of ingredients within the instructions serve also as a unified ingredients list. However, the resulting design is a little inelegant---it uses more lines than necessary---and laborious to produce.

I have created a tool (recipeconverter.pl) that converts a lightly-formatted text file into a LaTeX snippet that can then be directly converted to a pdf by pdflatex, a freely available program. I think that the results are visually cleaner: horizontal lines are gone, replaced by indentation, and vertical lines are replaced by curly braces.

For comparison, here's Chu's chocolate cake recipe: first, as he drew it, and then as drawn by recipeconverter.pl (from this file): The same chocolate cake recipe, written in two ways: Michael Chu's and James Scott-Brown's

Usage

If you'd like to use it, you can download the script, or a more heavily-annotated version of the source. Then just change the extension to .pl, and run it at the command line, passing the path the file you want to convert as the only argument. It will print a blob of LaTeX code on STDOUT. This can be copied into a LateX document, or left as a fragment and converted to an image with a program like LaTeXIt (on the mac).

The syntax used in the input file is quite simple:

Please feel free to send me any comments or suggestions.

Back to my blog

James Scott-Brown, 5 June 2009