Greg Ashton
  • Home
  • Projects
  • Science
  • Notes

Some useful latex helper tools

In this post I will descrive, mostly so I can recall in future, how a script I wrote operates. The script, print-tex-elements can be found here and can be used to pull out useful information from a .tex file.

Firstly, put this file somewhere on your PYTHONPATH, I keep a Scripts directory for such single-use scripts. Now for some example usage:

Print all the labels

Calling {% highlight bash %} print-tex-elements -l

prints all of the latex labels.

Print a subset of the labels

If you use keys to distinguish the type of labels e.g.

{% highlight latex %} \label{eqn: equation number one}

then we can just print the equation labels by giving eqn as the argument. For example:

{% highlight bash %}

print-tex-elements -l fig Printing label elements in test.tex: 305 -> fig: template jumps 474 -> fig: narrow-band example 544 -> fig: conv 605 -> fig: sliding window 663 -> fig: mismatch Tobs 663 -> fig: mismatch Tobs

Note that the repeated label here would be underlined, I just can't work out how to show this. The numbers give the line number of the first occurance.

Print all the figures

We can print the figure names using

{% highlight bash %} print-tex-elements -f Printing includegraphics elements in test.tex: 329 -> template_jumps 489 -> narrow-band_examples 556 -> S5_conv_mismatch 619 -> sliding_window 669 -> Crab_mismatch_Tobs

Print all the citations

We can print the citation keys

{% highlight bash %} print-tex-elements -c

For citations, repeated citations are removed.

and


Published

Dec 18, 2015

Category

articles
  • Powered by Pelican. Theme: Elegant by Talha Mansoor