About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Account
Latest news 2024-09-23: new blog post "Tales for Our Times: Raising Funds and Awareness for St Martins Housing Trust".


A. Downloading and Installing Packages

New LaTeX packages are being created all the time[Installing things on a (La)TeX system], so you may find that there are some packages that you don't have on your installation. In this case, if you don't have the package you want, you can download it[Installation using MiKTeX package manager] from CTAN. Before discussing installing new packages, it is a good idea for you to understand the TeX Directory Structure (TDS)[What is the TDS?].

All the files that make up the TeX distribution are stored in a standard hierarchical structure. The root directory of the main distribution is usually called texmf or texmf-dist. Its location depends on your system. For example, if you are using TeX Live 2012 on UNIX/Linux, it will probably be located in /usr/local/texlive/2012/texmf-dist or if you are using MiKTeX it may be located in c:\texmf or c:\Program Files\texmf. Whichever system you are using, I shall refer to this directory as <TEXMF>. So, if you are using TeX Live 2012, <TEXMF>/doc refers to the directory /usr/local/texlive/2012/texmf-dist/doc, or if you are using MiKTeX, <TEXMF>\doc refers to the folder c:\texmf\doc or c:\Program Files\texmf\doc. In general, you should not make any modifications to the <TEXMF> directory tree as it will get overridden whenever you update your TeX distribution.

You should also have a local texmf tree. Again, the location of the local texmf tree depends on your system. If you are using TeX Live, it may be /usr/local/texlive/texmf-local. If you are using MiKTeX, it may be c:\localtexmf or c:\Program Files\localtexmf. Whichever system you are using, I shall refer to this directory as <TEXMF-LOCAL>. There is also the <TEXMF-HOME> directory. On UNIX-like systems this is usually ~/texmf. On Windows it's usually in your user folder. This is the one where you typically install any new classes or packages.

These directories must all have the same structure. The principle sub-directories relating to LaTeX are illustrated in Figure A.1. It may be that your <TEXMF-HOME> directory doesn't exist or doesn't contain some of these sub-directories, if so, you will need to create them.

You can use the kpsewhich application to find out the locations of <TEXMF-LOCAL> and <TEXMF-HOME>. Since kpsewhich is a command-line application, you will need a command prompt or terminal open. At the command prompt, type

kpsewhich -var-value=TEXMFHOME
to display the location of <TEXMF-HOME> or
kpsewhich -var-value=TEXMFLOCAL
to display the location of <TEXMF-LOCAL>. (Remember to press the enter return key symbol key at the end of the line.)

The documentation for LaTeX classes and packages can be found in the doc/latex sub-directories: <TEXMF>/doc/latex, <TEXMF-LOCAL>/doc/latex and <TEXMF-HOME>/doc/latex.

Figure A.1: The TeX Directory Structure (TDS) Showing the Main LaTeX-Related Sub-Directories.
 

Some packages are supplied in this format.A.1 For example, the package sample-package may be distributed in a compressed file sample-package.tds.zip, which contains the files

doc/latex/sample-package/sample-package.pdf
tex/latex/sample-package/sample-package.sty
tex/latex/sample-package/sample-foo.sty
tex/latex/sample-package/sample-bar.sty
In this case all you need to do is decompress the contents of the archive into the <TEXMF-LOCAL> or <TEXMF-HOME> directory.

On older TeX-distributions, you would then need to refresh the TeX database. With new distributions, you don't need to do this if you are installing a new package into your <TEXMF-HOME> directory.

Example (Unix-Like):

To install sample-package.tds.zip (assuming you're in the same directory as that file):

unzip -d ~/texmf sample-package.tds.zip



Footnotes

... format.A.1
Complete list at http://mirror.ctan.org/install/macros/latex/contrib/.

This book is also available as A4 PDF or 12.8cm x 9.6cm PDF or paperback (ISBN 978-1-909440-00-5).

© 2012 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs