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
\doc refers to the folder
c:\texmf\doc or c:\Program
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
If you are using MiKTeX, it
may be c:\localtexmf or
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=TEXMFHOMEto display the location of <TEXMF-HOME> or
kpsewhich -var-value=TEXMFLOCALto display the location of <TEXMF-LOCAL>. (Remember to press the enter key at the end of the line.)
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.styIn 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.
To install sample-package.tds.zip (assuming you're in the same directory as that file):
unzip -d ~/texmf sample-package.tds.zip
- ... 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).
Last modified: 2017-02-06.
The free resources on this site are funded by book sales, not by adverts. If you would like to help keep this site free of annoying third-party ads, please consider buying a book.