over the last years, my collection of custom LaTeX packages grew. be it because i needed a newer version than the one available at ctan, to overwrite the behaviour of installed packages or because there simply wasn't a package available because i was too lazy to build one. yeah, it was the latter one in most cases.
and as i am really lazy i did not want to copy those packages into every new document/project folder. that meant i needed a way to somehow make different git repositories available to all LaTeX documents.
luckily LaTeX has support for a custom package directory, which should default
~/texmf. as i did not want to clutter up my home directory, i wanted to
change that directory to say
~/.texmf. now, there are two ways to do that:
either you modify the
TEXMFHOME variable in your
texmf.conf, which, if
you do use texlive, should be located in or around
/usr/share/texlive/texmf/web2c/texmf.cnf. i did not like that approach
because in some cases that specific file could be overwritten by an update of
the ctan distribution. you can however export the
pointing to the right directory.
of course the local texmf tree has to maintain the same directory structure as
your installed tree. that is the reason why you can't simply point the
TEXMFHOME variable to a bunch of git repositories. for LaTeX packages you
must put your packages under
$TEXMFHOME/tex/latex, if you want to install
fonts or other stuff, this works the same way, you just need to put them under
a different subdirectory. a nice thing is, that a local texmf tree does not
have to be texhashed. so, once you put your packages into that directory,
you're basically done. a final warning: be sure that the LaTeX packages do
contain files the LaTeX compiler can read, for example be sure that
files are available and not the
.ins files which are used to
generate a style file.
so, here comes tl;dr version of this:
mkdir ~/projects/tex cd ~/projects/tex git clone git://git.dgsiegel.net/latex-tangocolors.git [...] export TEXMFHOME=~/.texmf # put this in your .bashrc, .zshrc, ... mkdir -p ~/.texmf/tex ln -s ~/projects/tex ~/.texmf/tex/latex
Want more ideas like this in your inbox?
My letters are about long-lasting, sustainable change that fundamentally amplify our human capabilities and raise our collective intelligence through generations. Would love to have you on board.