How to install the caption latex package on Fedora?

Installing the caption LaTeX package on Fedora

If you’re getting an error like Package subcaption Error: 'caption' package not loaded, you need to install the caption package from TeX Live.

Quick install

For Fedora 41 and later, install the package directly with DNF:

dnf install texlive-caption

If you’re using an older Fedora version that still has yum, substitute dnf with yum.

What gets installed

The texlive-caption package provides:

  • The caption package for customizing figure and table captions
  • The subcaption package for subfigures and subtables
  • Related caption formatting utilities

This is part of the standard TeX Live distribution and is the recommended way to resolve caption-related LaTeX errors.

Manual TeX Live installation (if needed)

If your system is running an extremely outdated version of TeX Live and you need newer LaTeX packages, you can install a newer TeX Live release:

# Download and install TeX Live
wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
tar -xzf install-tl-unx.tar.gz
cd install-tl-*
sudo ./install-tl

This installs TeX Live to /usr/local/texlive and is useful if your distribution’s TeX Live is significantly outdated. However, the DNF/yum approach is preferred on Fedora since it integrates with your package manager and receives security updates.

Verifying the installation

After installing the caption package, verify it’s working by checking if LaTeX can find it:

kpsewhich caption.sty

This should return the path to the caption package file. If it returns nothing, the package wasn’t installed correctly.

Common related packages

If you’re working with complex caption scenarios, you may also need:

dnf install texlive-graphics texlive-tools

These provide additional float and formatting utilities that work alongside the caption package.

Using caption in your LaTeX document

Once installed, use it in your preamble:

\documentclass{article}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}
\begin{figure}
  \centering
  \includegraphics{image.png}
  \caption[Short caption]{Detailed caption text}
\end{figure}
\end{document}

The subcaption package is now loaded automatically when you install texlive-caption, so you don’t need separate installation for that dependency.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *