When working on a computer without internet access, installing additional LaTeX packages in MiKTeX can be challenging. However, with some preparation on a separate internet-connected machine and file transfers, it is possible to manually install packages offline. The key is to first locate the specific package files you need and download them onto a different computer that does have internet access. Typically these files use the .sty extension for LaTeX style files and .cls for class files. Sources include CTAN, package creator sites, or included on LaTeX distributions like TeX Live.
Determining which package files you need will depend on the type of document you are trying to compile LaTeX on the offline computer. Check the LaTeX errors when compiling or simply search CTAN or other sources for packages that provide necessary functionality.
Table of Contents ToggleMake sure to locate the exact files that provide the sty or cls implementations. For some packages, there may be multiple file options available, so download the relevant ones.
With internet access on a separate computer, download the determined LaTeX package files from online sources like CTAN or package creator sites. Usually these can be directly downloaded as individual files or entire package folders.
Keep track of each file's name and location saved on the computer. Some examples of places to download packages from include:
Make sure to only collect the files that will be directly needed so the transfer in the next step is simpler. Avoid excess documentation and file clutter.
With the required LaTeX packages downloaded as individual files or a collected folder, transfer them from the internet-connected computer to the target offline computer needing package installs.
File transfer can be done in a variety of ways depending on physical access between computers:
The key is to directly copy the full file structure with all sub folders if transferring an entire package folder, or just the individual files themselves. Keep the same file names and folder structure.
Have the files easily accessible for reference in the next package installation phase.
With the needed LaTeX package files now available on the offline MiKTeX computer, they can be manually installed and integrated so they are recognized and usable.
The two main methods for manual offline package installs are:
If opening the MiKTeX Package Manager (Admin mode), under the Packages tab there is an option to "Add" packages manually by pointing to the downloaded folder or files.
Use the file browser to select the entire package folder or individual files and add them. This will automatically move and install them into the MiKTeX file structure.
Properly installed packages will then show up under the "Installed" tab and are ready for document compilation.
Without using the Package Manager, LaTeX packages can be manually copied and integrated by moving the files into the proper texmf folder structure location.
This will mimic a normal CTAN package install to the correct places MiKTeX expects files to exist.
For example, on a Windows MiKTeX install, files would go under directories like:
The key folders are tex\latex for packages and tex\fonts for fonts.
The folder structure inside would also match original packages, for example:
TikZ/ # Package folder pgf/ # Subfolder fonts/ graphics/ modules/ system/ tikz.sty # Main package file pgflibrary.code.tex
Refresh the MiKTeX file name database after adding packages by running:
initexmf --update-fndb
This will allow MiKTeX to recognize the file structure.
To confirm LaTeX packages are properly manually installed on the offline MiKTeX computer, verify the system can recognize them.
Debug any issues where packages show unavailable or not found based on incorrect file copy locations or texmf integration.
Some common troubleshooting steps if having issues getting manually installed LaTeX packages to work properly:
Additional MiKTeX debugging can help identify folder or file issues accessing packages.
Overall manually installing LaTeX packages without internet requires carefully getting exact files, transferring without changes, placing in correct MiKTeX file structure, and testing compilation functional before use in documents.
Below shows examples of code snippets for manually installing and calling common LaTeX packages on an offline MiKTeX system:
> mpm --install-package=graphics/graphicx > copy graphics/*.sty c:\LocalTeXFiles\tex\latex\graphics > copy tikz/*.sty c:\LocalTeXFiles\tex\latex\tikz > copy fancyhdr/*.sty c:\LocalTeXFiles\tex\latex\fancyhdr > initexmf --update-fndb