Installing LaTex packages on Ubuntu

One thing I find lacking for LaTex on Ubuntu is a package manager with automatic package installations. Every time a package is missing, I need to search for the package and install manually. The package must be placed in the right directory of the Tex distribution, which I often forget and don’t bother to remember. So I wrote this 2-line bashscript for myself. It only requires putting the .sty file in a pre-specified location (~/Downloads for me), and voila, the script will install the packakge automatically. So here goes


echo “Installing package ” $1

sudo mkdir -p /usr/share/texmf/tex/latex/$1
sudo cp ~/Downloads/$1.sty /usr/share/texmf/tex/latex/$1

sudo texhash

Save the above into a script e.g. “”.

Then when you need to install a package, just find its thepackage.sty file, place it in ~/Downloads (or modify the script to use your own location), run

./texinstall thepackage

then you’re good to go.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s