How can I manually install a package on MiKTeX (Windows)
Firstly, check README files, available documentation of the package, perhaps the beginning of the .dtx
file to get installation information.
Installing a package available as dtx/ins bundle:
Download the content of the package directory.
dtx
is the extension of a documented source file,ins
is the extension of an installation file. Put this in a temporary directory.If there's nothing differently written in a README file run LaTeX (or TeX) on the
.ins
file. This is best done using the command prompt (latex packagename.ins
), but you may use your TeX editor in LaTeX/DVI-LaTeX mode or what it is called there. This would usually produce one or more files ending with.sty
, perhaps some additional files. As you now have cls or sty files or the like, the remaining steps are the same like in the next alternative way:
Installing sty or cls files:
Create a new directory with the package name in your local texmf directory structure, see also Create a local texmf tree in MiKTeX. Why not to choose the main MiKTeX texmf tree see in Purpose of local texmf trees.
Copy the package files (
*.sty
,*.cls
etc.) into this directory.Make the new package known to MiKTeX: refresh the MiKTeX filename database. To do this, click "Start/ Programs/ MiKTeX 2.x/ Maintenance/ Settings" (or similar) to get to the MiKTeX options, click the button "Refresh FNDB". The installation is complete.
If you did not download the documentation already, you could get it by running pdfLaTeX or LaTeX on the
.dtx
file. Compile twice to get correct references.
Obtaining and installing packaged universal archives:
Perhaps you could get a file with the extension .tds.zip
. Such files are archives fitting to your TeX directory structure. Open it, check the content structure. You could extract it to the right place. Also here, as after any installation, refresh the MiKTeX filename database.
Installing a font package
Installing a font package, especially for Type1 fonts, requires additonal steps. See Manual font installation.
Links with further information:
Integrating Local Additions on MiKTeX.org
What are documented LaTeX sources (.dtx files) in the UK TeX FAQ
Installing things on a (La)TeX system with detailed general instructions in the UK TeX FAQ
Downloading and Installing Packages by Nicola L. C. Talbot
The dtx format by Joseph Wright
A different and very effective way, using a local repository:
(works only for all in the MiKTeX package repository available packages)
Use the MiKTeX net installer to download the complete MiKTeX repository to a USB drive.
On a MiKTeX system, choose this directory as the local package repository in the package manager.
Use this local repository for installation and updates.
You may update that local repository later using the net installer: it loads the database from the server, compares and downloads new or updated packages.
You can set up a local packages repository on your computer.
You need an internet access to download the MikTex packages.
My problem is that I can't succeed in setting up the internet proxy setup of MikTex in my system, so I have tried today the following solution with MikTex 2.9 and it worked with no problems; the on-the-fly package installation worked well too.
- Create the folder, for example
c:\miktex_pkgs
Copy the following file to the folder
c:\miktex_pkgs
(If you do not copy the files you will probably get some errors from MikTex. See http://bruceyf.wordpress.com/2008/05/07/miktexs-secret-local-package-repository/ for the details):http://mirrors.ctan.org/systems/win32/miktex/tm/packages/README.TXT
http://mirrors.ctan.org/systems/win32/miktex/tm/packages/miktex-zzdb1-2.9.tar.lzma
http://mirrors.ctan.org/systems/win32/miktex/tm/packages/miktex-zzdb2-2.9.tar.lzma
You can copy any packages you may need from http://www.ctan.org/tex-archive/systems/win32/miktex/tm/packages to your local folder
c:\miktex_pkgs
At this point you have two options.
Update your MikTex system: from the Windows Start menu -> Programs -> Miktex 2.9 -> Maintenance (Admin) -> launch the program "Settings (Admin)"
Go to the tab "Package repository" and choose the folder
c:\miktex_pkgs
Install packages...
Open a command prompt and navigate to
c:\miktex_pkgs
Use
mpm.exe --install {name}
to install packages. The{name}
does not include any of the extensions (.cab
,.tar.lzma
,.tar.bz2
, etc.).
This is a simple and straightforward answer that worked for me.
As an example I'll take the listofitems package of CTAN and Miktex 2.9. We suppose the package is not available in the Miktex Package Manager, otherwise it can be directly installed with the manager.
- Create a local directory where you are gonna have all your manually installed packages. For example:
C:\myextrapackages\tex\latex
(thetex\latex
folder and subfolder must be there, if not Miktex won't accept the directory as S. Kottwitz said above, butmyextrapackage
can be any path you choose.) - Add the directory
C:\myextrapackages\
to Miktex. Procedure: go toMiktex Settings
-> select the tabRoots
-> and click on theAdd
Button (more details here)
Note: See that we have left out the\tex\latex
folders from the added path. If you try to add the full pathC:\myextrapackages\tex\latex
to Miktex you may get an error. - Download the .zip file with the package (in our case listofitems.zip available on the CTAN page)
- Unpack the contents of the .zip package file in a package folder with the same name (in our case
listofitems.zip
is unpacked in the folderlistofitems
). - Copy the package folder into your already new added directory. (in this example the final result is the directory
C:\myextrapackages\tex\latex\listofitems
with all the unpacked files inside)
In the future, if you download more packages, you skip steps 1. and 2. And follow steps 3 through 5 using your available local directory (in this case C:\myextrapackages\tex\latex
)