LaTeX command frequencies

In the previous post I present a bash one-liner to search directories for LaTeX files and count the commands used.

College files I first tried this out on a directory that included some old files from grad school.

I chose this directory because I knew it had a lot of LaTeX files, but I was surprised at the results.

Here were the top 10 results: Omega partial f in mu
eal int item alpha end I was very surprised that the top command was Omega.

I expected maybe the integral command int would come out on top.

The notes contain a lot of integrals, but these integrals were often over a domain Ω.

The set inclusion command in also appears frequently, probably in the context of saying x ∈ Ω.

The partial came up frequently because I used it in two contexts.

First, I was studying partial differential equations, so I used the symbol for partial derivative a lot.

Second, I used ∂ to denote the boundary of a domain, as in ∂Ω.

You might notice that end made the list above but egin didn’t.

Sounds like an error if LaTeX files have more end statements than egin statements.

The reason is that I used to have an include file that had lots of macros and ended with egin{document}.

That saved a few keystrokes, but now I think such asymmetry is bad form.

In the search described below, there are exactly the same number of egin and end statements.

Client files When I looked at the command frequencies in a directory containing some client work, I got very different frequencies.

Here were the top commands in that directory.

hline item end egin frac xi phi lambda exttt partial I suppose hline is at the top because the files contained a lot of tables.

It makes sense that item, egin, end and frac were near the top because those are common LaTeX commands.

I don’t remember what I was working on that used the symbol ξ so much.

When I first thought about this post I thought I could get a feel for what commands are used frequently in LaTeX in general.

I started with my own files because they’re at hand, but the results say more about my usage of LaTeX than about LaTeX in general.

Other collections I imagine if you were to look at the frequency statistics for a large corpus, such as the articles submitted to a given math journal, the results would still depend somewhat on the journal: you’re going to see int for integral more in an analysis journal, otimes for tensor product more in an algebra journal, etc.

If you run the code from the previous post on some collection of LaTeX files and get some interesting results, leave a comment describing what you found.

More LaTeX posts Putting a brace under something in LaTeX Unicode / LaTeX conversion Contrasting Microsoft Word and LaTeX.

Leave a Reply