Adding more latex packages to your MikTeX installation

MiKTeX comes with a large number of additional packages, which make more LaTeX commands available for use. If you have other packages you would like to install, use the instructions below.

*******************

IMPORTANT:

Every time you install a new package, you need to rebuild the MikTeX inputs database (which it reads when it’s looking for a latex input). You do this by clicking Start > Programs > Miktex > MiKTeX Options and then click Refresh Now. Once you’ve done this, you can use your new package in a latex document.

*******************

From time to time you may find the need to add more LaTeX packages to your MikTeX installation. Packages can be found on CTAN, the Comprehensive TeX Archive Network, and can be downloaded from their web page at https://tug.ctan.org/

The following packages are installed on the lab machines, but not included in the MikTeX distribution:

  • pstricks (for creating postscript graphics in your tex document)
  • setspace (for doublespacing)
  • lastpage (needed if you want to number pages 1 of 10, 2 of 10, etc)
  • fullpage (sets smaller margins than article.cls, so more fits on a page)
  • fancyhdr (allows you to do nice things with headers and footers)

Most packages come with instructions for installing. You should read all documentation. General guidelines for installing are listed below.

If a package has a file with a .ins extension, then the first thing you need to do is “unpack” the package by opening a Command Prompt window, changing into the directory with the .ins file, and typing

latex filename.ins

where filename.ins is the name of the file with the .ins extension. This will create lots of files which then need to be put in the appropriate place. Typically there will be a message in the window indicating which files need to be moved, and where they should be moved to.

Most packages are somewhat vague about where files need to be moved to. Many have documentation telling you something like “put all files with extension *.xxx where tex looks for inputs”. In the case of MiKTeX, this means put those files in a subdirectory of texmftexlatex or localtexmftexlatex if you are using the localtexmf directory for local customizations. (Note that the exact location of the texmf and localtexmf directories will depend on your installation.) It’s a good idea to create a new subdirectory for each package.

Generally, any other files with the package are documentation files, often with the extension .dtx. Running latex on these, eg

latex filename.dtx

produces a .dvi file which you can view or print. These documentation files can go anywhere that makes sense to you. I usually put all documentation in a subdirectory of localtexmfdoclatex (I make a subdirectory for each package), but you can also use texmfdoclatex if you are not using a localtexmf directory.

Some packages also need to put a few files in other locations. For instance, PSTricks needs some dvips inputs, files with .pro extensions, in texmfdvipsbase or localtexmfdvipsbase. In all cases, be sure to read the documentation.

*******************

IMPORTANT:

Every time you install a new package, you need to rebuild the MikTeX inputs database (which it reads when it’s looking for a latex input). On Allegheny computers you do this by clicking Start > Programs > Courseware > Miktex > MiKTeX Options and then click Refresh Now. Once you’ve done this, you can use your new package in a latex document.

*******************