LaTeX Content From Command Line

So I have found myself in the market for a new job recently. This isn’t the best feeling in the world, but I’m not letting an opportunity go to waste. Today, let’s talk about how to create a simple script that injects some content into a LaTex document, in the context of creating a script that emits different résumés with command-line-specified objectives.

An example of an objective in a résumé

Let’s stop retyping this


For convenience and to track the history of my applications, I keep my résumé in a git repository and use LaTeX to generate it. The one part of this process that’s irritating to me is having to update the Objective section for every different job I’m applying for. Wouldn’t it be convenient, I said to myself, if I could parameterize that and supply the objective on the command line?

Using the \include macro

As far as I can tell, LaTeX doesn’t have an obvious way to read from stdin or set macros on the command line, but it does have the \include macro, which lets you pull in the contents of another file and inject it directly into the flow of a LaTeX document. So we take advantage of that to reference the objective as sourced from elsewhere.

My résumé is in a tex_resume.tex file, so I edit that file to add a macro for generating the objective, which pulls


Now, I just need to create an objective.tex file to hold the objective.

Updating the objective from the command line

With those pieces in place, updating the objective is straightforward. Here is the content of my script.

# Emits a new resume with an objective specified
# Usage: update-with-objective "Objective string"


echo "${OBJECTIVE}" > objective.tex
pdflatex tex_resume.tex

And we’re all set. I can update my résumé’s objective with ./ "Keep being awesome". If I have twenty companies to apply to, I could wrap this script in another script to inject the twenty objectives and rename the output file after each one.

And anyway, (EDIT: No longer looking for work. Yay!) feel free to reach out to me at or via LinkedIn. Looking forward to seeing what’s out there!