LinuxCommandLibrary

texdoc

View documentation for LaTeX packages and programs

TLDR

Open the first search result in the default PDF viewer

$ texdoc [search]
copy

List the best search results
$ texdoc [[-l|--list]] [search]
copy

Open full documentation of texdoc
$ texdoc [texdoc]
copy

SYNOPSIS

texdoc [OPTION...] NAME...
texdoc [OPTION...] SUBCOMMAND [ARGUMENTS...]

PARAMETERS

-l or --list
    Lists all documentation files matching the given NAME without opening any, useful for exploring available options.

-s or --show-path
    Displays the full file path to the document that would be opened, but does not launch a viewer.

-f or --force
    Forces the opening of a document, even if multiple matches are found, typically opening the first or most relevant one based on internal logic.

-w or --web
    Instructs texdoc to attempt opening HTML documentation using a web browser instead of a local document viewer.

-m or --most-recent
    When multiple versions of documentation are found, this option attempts to open the most recently updated or versioned document available.

-V or --version
    Shows the texdoc program's version information and exits.

-h or --help
    Displays a help message with usage information and exits.

DESCRIPTION

texdoc is an indispensable utility within the TeX Live distribution, designed to simplify the process of locating and viewing documentation for TeX, LaTeX, and related packages. Instead of manually searching complex file systems or online repositories, users can simply provide the name of a package or topic. texdoc then intelligently finds the relevant documentation file—which could be in formats like PDF, DVI, PostScript, HTML, or plain text—and automatically opens it using the appropriate viewer configured on the user's system.

It leverages the kpsewhich program to efficiently search the extensive TeX directory tree for documentation files, making it highly effective for accessing the vast array of manuals and guides distributed with TeX. This command significantly enhances the user experience for TeX users, providing quick, seamless access to essential package information directly from the command line by abstracting away the complexities of file locations and viewer selection.

CAVEATS

texdoc relies on a properly installed and configured TeX distribution, such as TeX Live. Its functionality is dependent on the kpsewhich utility for locating files, which can occasionally be slow or misconfigured. Users might also need to explicitly set up their preferred document viewers as texdoc defers to system defaults or environment variables (e.g., TEXDOCVIEWER), which may not always be optimal.

CONFIGURATION OF VIEWERS

texdoc determines which application opens the documentation by consulting system-wide configurations and environment variables (e.g., TEXDOCVIEWER). For optimal experience, users may need to explicitly configure these settings to align with their preferred PDF, DVI, or HTML viewer applications.

SEARCH LOGIC

The command employs a sophisticated search algorithm that often prioritizes exact matches for package names. If an exact match is not found or the query is ambiguous, texdoc is capable of listing multiple potential documents, aiding users in navigating and locating less common or similarly named packages.

HISTORY

texdoc emerged as an essential component of the TeX Live distribution, driven by the need for a standardized and user-friendly method to access the vast documentation accompanying TeX packages. Prior to its widespread adoption, users often had to manually navigate complex directory structures or consult package-specific instructions to find relevant documentation. Over time, it has evolved to support various document formats and integrate seamlessly with different viewers, becoming a cornerstone utility that significantly streamlines the documentation lookup process for the global TeX community.

SEE ALSO

man(1), info(1), kpsewhich(1), latex(1), pdflatex(1)

Copied to clipboard