Ubuntu is great, but making it play nice with latex is a bit of a pain. There are three parts to this:
- Ubuntu comes with APT, a really nice package management system that lets you easily install, update, and remove software that has been helpfully packaged by both Canonical and the wider Debian community.
- Tex Live, the official release of latex, comes with tlmgr, an equally great package manager for managing the all of the latex packages on CTAN.
- Ubuntu’s distribution of latex omits tlmgr and forces developers to repackage the latex packages to fit into the APT scheme. (source)
This seems to be why my previous post about fixing moderncv for Ubuntu was so popular. It is not obvious to most users that to fix the
LaTeX Error: File `marvosym.sty' not found.
error, the user has to both (1) find the Ubuntu package that provides marvosym.sty and then (2) install that Ubuntu package along with every other latex package that happens to be bundled with it.
All of that is fine if a kind-hearted developer had the foresight to bundle the latex package you want/need in a convient form for installation with APT. If not, you have two options:
- Keep Tex Live under the control of Ubuntu’s package management and manually install the Latex packages you need. An easy way to do this is described below.
- Break out Tex Live from Ubuntu’s package manager and use tlmgr for Latex package management. This gives you MikTex style latex package management for Ubuntu, but you are responsible for keeping Tex Live up to date. See the answers to this Stack Exchange question for details of how to do it.
For now I’m sticking with Option 1. Here is a worked example to install the Latex package outlines for Ubuntu:
- Look at the path Latex searches to find packages with ‘kpsepath tex’ which should give output similar to:
nathanvan@nathanvan-N61Jq:~$ kpsepath tex | sed -e 's/:/\n:/g' . :/home/nathanvan/.texmf-config/tex/kpsewhich// :/home/nathanvan/.texmf-var/tex/kpsewhich// :/home/nathanvan/texmf/tex/kpsewhich// :/etc/texmf/tex/kpsewhich// :!!/var/lib/texmf/tex/kpsewhich// :!!/usr/local/share/texmf/tex/kpsewhich// :!!/usr/share/texmf/tex/kpsewhich// :!!/usr/share/texmf-texlive/tex/kpsewhich// :/home/nathanvan/.texmf-config/tex/generic// :/home/nathanvan/.texmf-var/tex/generic// :/home/nathanvan/texmf/tex/generic// :/etc/texmf/tex/generic// :!!/var/lib/texmf/tex/generic// :!!/usr/local/share/texmf/tex/generic// :!!/usr/share/texmf/tex/generic// :!!/usr/share/texmf-texlive/tex/generic// :/home/nathanvan/.texmf-config/tex/// :/home/nathanvan/.texmf-var/tex/// :/home/nathanvan/texmf/tex/// :/etc/texmf/tex/// :!!/var/lib/texmf/tex/// :!!/usr/local/share/texmf/tex/// :!!/usr/share/texmf/tex/// :!!/usr/share/texmf-texlive/tex///
- Note that the entry on line 21 is ‘/home/nathanvan/texmf/tex//’, which tells latex to search every subdirectory under ‘/home/nathanvan/texmf/tex’ to find packages that haven’t been found yet. You’ll have something similar for your home directory.
- Make a ‘texmf/tex/latex’ directory under your home directory:
nathanvan@nathanvan-N61Jq:~$ mkdir -p ~/texmf/tex/latex
- Find the pacakge you want on CTAN, say outlines, because you read this blog post and want to try it out.
- Download the ‘the contents of this directory bundled as a zip file‘, as CTAN likes to say it, and save it to ‘~/texmf/tex/latex’
- Unzip it right there:
nathanvan@nathanvan-N61Jq:~$ cd texmf/tex/latex
nathanvan@nathanvan-N61Jq:~/texmf/tex/latex$ unzip outlines.zip
And then you are done installing the latex package. It works great without any big hassles.
Edit: Thanks to jon for pointing out the correct directory structure for ~/texmf in the first comment to this answer. For the curious, more details, including why the directory is called texmf, can be found here.