Step-By-Step Guide To Manually Installing Latex Packages In Miktex
Getting Started with Manually Installing LaTeX Packages
Manually installing LaTeX packages in MiKTeX gives you precise control over customizing your TeX distribution. While the MiKTeX Package Manager handles most installations, you may need to manually install niche or specialized packages. This guide will walk you through the entire process step-by-step.
Determining Which Packages You Need
First, you need to identify the LaTeX packages you require that are not already installed in your MiKTeX distribution. Make a list of functionality, features, templates, mathematical symbols, fonts, bibliographic styles, or other items you need. Search online to find packages that offer those items.
Keep an organized list of packages to install. For each one, note the name, a brief description, the most current CTAN version, and any special installation requirements. This will streamline finding the correct package files later.
Downloading Package Files
With your list in hand, visit the Comprehensive TeX Archive Network (CTAN) to download the .zip or .tar.gz package files. You can browse CTAN’s directory or search for individual packages.
On a package’s page, find the link for the current stable release to download. Save all the packages to one dedicated folder on your computer to keep them organized. This will also make adding them to MiKTeX easier.
Locating Your LaTeX Package Directory
You will need to navigate to the folder where LaTeX packages are stored on your system to manually install them. The location varies by MiKTeX edition and Windows version.
Common folders to check include C:\Program Files\MiKTeX\{version}\tex\latex
or C:\Users\{user name}\AppData\Roaming\MiKTeX\{version}\tex\latex
.
You can verify in MiKTeX’s settings under the Roots tab. System-wide packages show under “Common Install Root” while user-only packages display under “User Install Root.”
Unpacking the Package Files
Copy all the downloaded package files you want to install into the LaTeX packages folder you located. Extract or unzip each one you copied over so the .sty files, docs, etc. contained inside are accessible.
Be sure to delete the original .zip or .tar.gz files afterward so the folder stays clean. You do not need to create any subfolders unless specified in a package’s install instructions.
Refreshing the Filename Database
To make MiKTeX aware of the new package files, its filename database needs refreshed. This is easy to do through MiKTeX’s settings.
Go to the General tab and click “Refresh FNDB.” This takes a few seconds and you’ll see a confirmation message that the file name database rebuilt successfully.
Testing the Installed Packages
Test that MiKTeX recognizes and can properly use the newly installed packages. The easiest way is trying to compile a short sample document that imports each one.
For example, to test the TOTCount
package you just added:
\documentclass{article}
\usepackage{totcount}
\begin{document}
This is a test.
\end{document}
If the packages are successfully found by MiKTeX and there are no errors, the documentation should compile normally.
Troubleshooting Issues with Package Installation
Debugging can be needed if MiKTeX fails to recognize a new package you installed or compilation issues occur.
Start by double checking you added the files into the main TeX packages folder on your system. Refresh the filename database again too in case something did not register correctly the first go around.
Examine compilation logs and error messages to pinpoint the problematic package. Remove its files from the packages folder temporarily if conflicts occur with other existing or newly added packages.
Research online forums discussing that specific package’s installation procedures for MiKTeX if all else fails. There may be missing components like fonts or dependent packages that still need installed properly.
Updating Outdated Packages
Over time, some of your manually installed LaTeX packages can become outdated as newer versions get released.
Revisit the Comprehensive TeX Archive Network periodically to lookup packages on your list and check if the current stable version is newer than when you originally downloaded it.
Follow the same installation steps to replace an outdated package. Delete the older version’s folder and files first before unzipping the updated version’s package to replace it.
Be aware some package updates come with changes that can break existing document compilation. Thoroughly test updates before widely using them.
Recommended Extra Packages for Math and Science
Here are some additional handy LaTeX packages worth manually installing if you routinely write advanced mathematical or scientific papers, reports, articles, theses, or textbooks:
Mathematics
amsmath
- Essential math typesetting extensionsamsthm
- Extra theorem environment stylesamssymb
- Mathematical symbolsamsbsy
- Blackboard math bold symbol fontsmathtools
- Mathematical tools extensions
Engineering & Physical Sciences
chemfig
- Compound chemical structure diagramscircuitikz
- Electrical circuit diagramssiunitx
- Typeset SI units convenientlytikz-3dplot
- 3D coordinate picture graphics
Computer Science & Information Technology
algorithm2e
- Write algorithms pseudocodelistings
- Typeset source code snippetslstaddons
- Extended Listings package
With practice installing packages manually, you will become efficient determining needed packages, downloading the files, placing them properly into MiKTeX’s folders, and confirming they function correctly by testing sample documents.
Having full control to customize your TeX distribution this way helps ensure you have all the necessary typesetting tools at your fingertips no matter how specialized your usage becomes over time.