[Tex/LaTex] n EASY step by step guide to installing packages


Im trying to install a package, the one called "mathtools".
I am using MikTeX and Texmaker, and the Package Manager does not work, so i need to do it manually.

I have downloaded a folder from CTAN and that gave me a folder filled with some files.
empheq.dtx, empheq.pdf, mathtools.dtx, mathtools.pdf, mhsetup.dtx, mhsetup.pdf and README.

In the README file it says to "run TeX on each dtx file" but i have no idea what this means. Please write a rookiefriendly guide like, open program X, use the button X etc.
I won't understand if you just say "well just use TeX on it." I am really bad at this.

Hope you can help me, all i want is to use latex but it won't let me.

Best Answer

The comments above suggest that there may be a way to solve your problem without learning how to manually install LaTeX packages. But, it's not a bad idea to know how for troubleshooting, and quick fixes.


  1. create a TDS directory structure (once)
  2. place mathtools directory inside (most packages should go in latex/)
  3. run tex on .dtx files (creating .sty files)
    1. (I think I've more often seen latex <some package>.ins)
  4. (Optional) further cleanup towards TDS conventions

You'll want to create a texmf directory. Determining where to put it, that is, the default location, in Windows, is discussed here: packages - Where is texmf on a Windows install - TeX - LaTeX Stack Exchange.

So in your explorer, you'll want to head to your home directory, and create directories until you have the following chain:

c:\Users\<your user name>\texmf\tex\latex\

You would put the mathtools directory there, so that you have for instance

c:\Users\<your user name>\texmf\tex\latex\mathtools\mathtools.dtx

Now, open up a command prompt, and cd (change directory) to this location, that is,

cd c:\Users\<your user name>\texmf\tex\latex\mathtools\

From there, run tex on the appropriate files, that is, type

tex mathtools.dtx

You may also need

tex empheq.dtx

This will create the style files, mathtools.sty and empheq.sty.

This is enough. Latex may now know where to find the style files because of TDS (TeX directory structure). If it does not, you many have to run texhash or similar.

You could follow convention further, cleaning up, putting the documentation (pdfs) into texmf\doc\mathtools\, and put the .dtx (and sometimes .ins) files into some source directory for easy access if you want to recover them later (without internet?).