# [TxMt] Re: LATEX 2 Bundle

Alex Ross j at lasersox.net
Tue Nov 17 06:50:56 UTC 2009

On Nov 14, 2009, at 11:27 AM, Alain Matthes wrote:

> Hi,
>
> Some questions :
>
> 1) How to compile with --shell-escape and lATEX 2?

Set TM_LATEX_FLAGS=--shell-escape.

You can do this in the Shell Variables preference pane of TextMate's preferences, or on a per-project basis.

> 2) in the script, I don't understand      ~ /.*-preamble.tex/
> here :
>
> if File.exists?(pdf) and not ENV["TM_FILEPATH"] =~ /.*-preamble.tex/

This is some old cruft that will be removed. Basically, I wanted to treat “preamble files” specially, but I needed a way to recognize them. Now, you can just use the extension “ltx” to indicate that you are working on a preamble file.

By “preamble file” I mean the tex source of a “fmt file”.  A fmt file is essentially a memory dump from the tex processor.  You can do something like this:

Create a file my-format.ltx with contents:

> \documentclass{article}
> \usepackage{myfavoritepackage}

When you build this file with ⌘R, LaTeX2 will produce a “my-format.fmt” file. What do you do with a fmt file?

Create my-document.tex with these contents:

> %&my-format
>
> \begin{document}
>
> HI
>
> \end{document}

This will build just fine! The fmt file is just a binary dump of tex's memory contents after loading the article class and myfavoritepackage. fmt files can really speed up compiling for documents that do a lot of usepackaging and command-defining in the preamble.

—Alex