March 11, 2021
I’m running BasicTeX on my Mac, and I wanted to install the tr2latex package to translate Groff/Troff files into LaTeX.
This package is listed on CTAN, but isn’t part of TeX Live, so tlmgr
didn’t give me any results.
Here’s how you can install such packages manually.
The main thing is, you need to put the files in the right place.
What’s the right place?
Ask tlmgr
by running tlmgr conf
.
That gives you a lot of output, but the key lines are those defining environment variables:
ENCFONTS=.:{{}/Users/alex/Library/texlive/2020basic/texmf-config,/Users/alex/Library/texlive/2020basic/texmf-var,/Users/alex/Library/texmf,!!/usr/local/texlive/2020basic/texmf-local,!!/usr/local/texlive/2020basic/texmf-config,!!/usr/local/texlive/2020basic/texmf-var,!!/usr/local/texlive/2020basic/texmf-dist}/fonts/enc//
SYSTEXMF=/usr/local/texlive/2020basic/texmf-var:/usr/local/texlive/2020basic/texmf-local:/usr/local/texlive/2020basic/texmf-dist
TEXCONFIG={{}/Users/alex/Library/texlive/2020basic/texmf-config,/Users/alex/Library/texlive/2020basic/texmf-var,/Users/alex/Library/texmf,!!/usr/local/texlive/2020basic/texmf-local,!!/usr/local/texlive/2020basic/texmf-config,!!/usr/local/texlive/2020basic/texmf-var,!!/usr/local/texlive/2020basic/texmf-dist}/dvips//
TEXFONTMAPS=.:{{}/Users/alex/Library/texlive/2020basic/texmf-config,/Users/alex/Library/texlive/2020basic/texmf-var,/Users/alex/Library/texmf,!!/usr/local/texlive/2020basic/texmf-local,!!/usr/local/texlive/2020basic/texmf-config,!!/usr/local/texlive/2020basic/texmf-var,!!/usr/local/texlive/2020basic/texmf-dist}/fonts/map/{kpsewhich,pdftex,dvips,}//
TEXMF={{}/Users/alex/Library/texlive/2020basic/texmf-config,/Users/alex/Library/texlive/2020basic/texmf-var,/Users/alex/Library/texmf,!!/usr/local/texlive/2020basic/texmf-local,!!/usr/local/texlive/2020basic/texmf-config,!!/usr/local/texlive/2020basic/texmf-var,!!/usr/local/texlive/2020basic/texmf-dist}
TEXMFCONFIG=/Users/alex/Library/texlive/2020basic/texmf-config
TEXMFDBS={!!/usr/local/texlive/2020basic/texmf-local,!!/usr/local/texlive/2020basic/texmf-config,!!/usr/local/texlive/2020basic/texmf-var,!!/usr/local/texlive/2020basic/texmf-dist}
TEXMFDIST=/usr/local/texlive/2020basic/texmf-dist
TEXMFHOME=/Users/alex/Library/texmf
TEXMFLOCAL=/usr/local/texlive/2020basic/texmf-local
TEXMFMAIN=/usr/local/texlive/2020basic/texmf-dist
TEXMFSYSCONFIG=/usr/local/texlive/2020basic/texmf-config
TEXMFSYSVAR=/usr/local/texlive/2020basic/texmf-var
TEXMFVAR=/Users/alex/Library/texlive/2020basic/texmf-var
TEXPSHEADERS=.:{{}/Users/alex/Library/texlive/2020basic/texmf-config,/Users/alex/Library/texlive/2020basic/texmf-var,/Users/alex/Library/texmf,!!/usr/local/texlive/2020basic/texmf-local,!!/usr/local/texlive/2020basic/texmf-config,!!/usr/local/texlive/2020basic/texmf-var,!!/usr/local/texlive/2020basic/texmf-dist}/{dvips,fonts/{enc,type1,type42,type3}}//
VARTEXFONTS=/Users/alex/Library/texlive/2020basic/texmf-var/fonts
WEB2C={{}/Users/alex/Library/texlive/2020basic/texmf-config,/Users/alex/Library/texlive/2020basic/texmf-var,/Users/alex/Library/texmf,!!/usr/local/texlive/2020basic/texmf-local,!!/usr/local/texlive/2020basic/texmf-config,!!/usr/local/texlive/2020basic/texmf-var,!!/usr/local/texlive/2020basic/texmf-dist}/web2c
You see here that TEXMFHOME
is set to ~/Library/texmf
.
This folder didn’t exist on my machine, so I created it.
Next, I looked at the Makefile for tr2latex:
# PREFIX sets your base directory
PREFIX = /usr/local
#PREFIX = /opt/tr2latex
# TEXDIR gives the path where the tex library resides (fonts, macros ...)
TEXDIR = $(PREFIX)/share/texmf-local
#TEXDIR = $(PREFIX)/texlive/texmf-local
# ...
install: tr2latex
install -m 755 -d $(PREFIX)/bin
install -m 755 -d $(PREFIX)/share/man/man1
install -m 755 -d $(TEXDIR)/macros
install -m 0755 tr2latex $(PREFIX)/bin/tr2latex
install -m 0444 tr2latex.man $(PREFIX)/share/man/man1/tr2latex.1
install -m 0444 troffman.sty troffms.sty $(TEXDIR)/macros
The main things we need to configure here where the executable files and manpages go, and where the .sty
files go.
I kept the prefix at /usr/local
, because that’s where I install my software on Mac (that’s also where Homebrew puts its software).
However, I changed every occurrence of $(TEXDIR)/macros
to something that BasicTeX would recognise: ~/Library/texmf/tex/latex/troffms
.
The last directory, troffms
, can be named whatever, but I named it after the .sty
files I’m installing.
This structure follows conventions for BasicTeX.
After running make install
, you can check that everything installed properly.
which tr2latex
give me the path to the binary, man tr2latex
shows the manpage.
And kpsewhich troffman.sty
and kpsewhich troffms.sty
give paths to the installed .sty
files.
Testing it on a file, latexmk
finds everything without issues.