This is a (slightly) improved version of labelpin script by Nathan Dunfield for labelling figures in LaTeX with pinlabel package.
A beautiful publication in LaTeX uses the same font for its text and for the labels in its figures. At some prehistoric ages it was done with PSfrag Unfortunately, this wonderful package is not compatible with modern LaTeX versions: pdfTeX, XeTeX, and LuaTex. A good and light-weight alternative is to use pinlabel package. The only drawback of the package is tiresome procedure of getting right coordinates for the labels. Nathan Dunfield wrote this easy to use interface for the package, and I have added a couple of lines to make it compatible with Python 3 and to get correct coordinates for pdf files with crop box.
- Python with Tkinter.
- GhostScript.
The instructions are at the top of file. For instance, on Windows you should
- make a hardlink to your GhostScript executable, so you can call it as "gs" from command line (equivalent to as it's done on Mac and Linux)
mklink /j gs.exe "C:\Program Files\gs\gs9.20\bin\gswin64c.exe"
-
Place the link in some directory in the path, e.g. in
C:\Windows
-
Run in command line
python lablepinX.py file.ext
where X
is your Python version and ext
is either pdf
or eps
- Copy the output to your tex file.
See also the attached example.
Version 1.2 of 2017/8/25
- Added bounding box calculation for PDF files (e.g. version 1.1 gives wrong coordinates for file
simplex.pdf
in the example folder) - Versions for Python 2 and Python 3
- uploaded to BitBucket
Feel free to improve it any way.
-
Nathan Dunfield - Initial work - Nathan Dunfield
-
Oleg Soloviev - Version 1.2 - Oleg Soloviev
Public domain.