Exporting Variables From Org-mode to LaTeX

Franco Pasut has posted on exporting variables from Org to LaTeX. The TL;DR is that you can define LaTeX macros defining a variable value in #+LATEX_HEADER: entries at the top of the Org file and then interpolate the variables in the text by including \variable_name{} in the body of the document. That’s nice because it makes it easy to change the value of those variables, if needed, in one place and have the results reflected in the whole document.

The problem with this method is that it’s not portable. It’s great if you’re only exporting to PDF but if you want to also export to HTML, say, it won’t work. The proper way of handling the general case is to define the variables at the Org level as described by Mike Hamrick in his excellent video Consistent Technical Documents Using Emacs and Org Mode that I wrote about wrote about previously.

In either case, the idea of defining variables in one place and using their values throughout the document makes a lot sense precisely because it makes it easy to change those values when needed without scanning the entire document. Take a look Hamrick’s video to see how powerful the method can be.

This entry was posted in General and tagged , . Bookmark the permalink.