in reply to repetitive latex doc: in vim or perl?

Perl and LaTex go very well together.

Your particular problem really calls for for the use of a Templating system, such as Template Toolkit. I just finished an application which takes data out of a database, munges the data, creates some graphs and puts it all in a LaTeX file through the use of a template and then runs pdflatex a few times on it and out comes a beautiful report, complete with table of contents and fully indexed.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James