Tx · LaTeX & TikZ

How to Install a LaTeX Package for Use in Texmaker

Published By the 9to5Science editorial team

At a glance

  1. 1. Identify your distribution

    Check whether your system uses MiKTeX, TeX Live, or another TeX distribution; Texmaker itself does not install packages.

  2. 2. Install the package

    Use the package manager for your TeX distribution, or install manually only if the package is unavailable there.

  3. 3. Compile a test

    Add the package’s documented usepackage command and compile with the same TeX installation you updated.

  4. 4. Check errors

    If LaTeX cannot find the package, verify the package name, installation location, and compiler selected in Texmaker.

Texmaker does not install LaTeX packages itself. It edits your source and runs a TeX engine, such as pdfLaTeX or LuaLaTeX. Packages are installed into the TeX distribution that provides that engine—commonly MiKTeX or TeX Live.

The key is to install the package into the same TeX setup that Texmaker uses. Installing it in a second TeX distribution, or only downloading its files, may leave the compiler unable to find it.

1. Identify your TeX distribution

Look at the TeX installation configured in Texmaker under Options → Configure Texmaker → Commands. The displayed command may name an engine such as pdflatex; its location can help identify which installation is being used. You can also check your system’s installed applications for MiKTeX, TeX Live, or MacTeX. MacTeX includes TeX Live.

If no TeX distribution is installed, install one first. Texmaker needs a TeX engine to compile documents; the editor alone is not enough.

2. Install using the distribution’s package manager

Choose the method that matches your TeX distribution:

  • MiKTeX: Open MiKTeX Console, search for the package by name, and install it. Depending on your setup, run the console in user or administrator mode to match the scope of your TeX installation. MiKTeX can also be configured to install missing packages on demand, but an explicit installation makes it clear which package is present.
  • TeX Live: Use TeX Live’s package manager, tlmgr. For example, in a terminal, run tlmgr install packagename, replacing packagename with the package’s TeX Live package name. Some operating-system installations manage TeX Live through their own package manager instead; follow that installation’s guidance rather than mixing management methods.
  • MacTeX: Since MacTeX is based on TeX Live, use TeX Live’s package tools, such as TeX Live Utility or tlmgr.
  • Linux distributions: If TeX Live was installed from your distribution’s repositories, the package may be available through the system package manager. Package names often include a TeX Live collection prefix, so search the repository for the package rather than guessing its operating-system package name.

The name used by LaTeX and the name used by a distribution’s package manager are often similar, but they are not guaranteed to be identical. Search the package manager or the distribution’s package list if the name is not found.

3. Load the package and test it

After installing, add the package’s documented command to the preamble—the part of your file before \begin{document}. For example, if you installed booktabs, a minimal test is:

\documentclass{article}
\usepackage{booktabs}

\begin{document}
\begin{tabular}{ll}
\toprule
Item & Value \\
\midrule
A & 1 \\
\bottomrule
\end{tabular}
\end{document}

Save the file and compile it in Texmaker. If it compiles without a “file not found” error, the package is available to the engine Texmaker invoked. Use the package’s documentation for its actual command and features; not every package is loaded in exactly the same way.

4. If the package is still not found

Read the compilation log, which Texmaker displays after a build. An error such as LaTeX Error: File 'example.sty' not found means the engine cannot locate the package file. Check these points:

  1. You installed the right package. Search by the package’s LaTeX name and confirm that it contains the .sty, .cls, or other file your document requests.
  2. You used the same TeX installation. A computer can have more than one distribution or version. Installing with one package manager will not necessarily update another installation.
  3. The installation completed successfully. Reopen the package manager and check that the package is listed as installed. If it requires administrator privileges, install it at the appropriate user or system level.
  4. Texmaker is running the expected compiler. Check the command under Options → Configure Texmaker → Commands. If you changed the TeX installation, close and reopen Texmaker and verify the command again.
  5. The package name in the document is correct. The argument to \usepackage{...} is normally the package name, not the full filename or a path.

You generally do not need to change Texmaker’s settings just because you installed a package. It finds packages through the TeX engine’s search paths.

Installing files manually

Manual installation is usually a fallback for packages not provided by your distribution’s package manager. Download the package’s source and instructions from a reliable source, such as CTAN, and follow its README or installation guide. Put the files in a TeX tree that the relevant distribution searches; for a personal installation, this is often a local or user texmf tree. Follow the tree’s required directory structure, and refresh the distribution’s file-name database or package index if its documentation requires it. The exact directory and refresh command depend on the operating system and distribution.

Do not put package files in Texmaker’s program folder: Texmaker is not where LaTeX looks for packages. For guidance on a downloaded package or custom search paths, see the related installation articles.

References

  1. MiKTeX: Installing packages
  2. TeX Live: tlmgr documentation
  3. CTAN: The Comprehensive TeX Archive Network

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.