How to use the command `tlmgr search` (with examples)
The tlmgr search
command is a useful tool for managing and navigating through TeX Live installations. TeX Live is a comprehensive distribution of the TeX typesetting system, which includes several packages that can be used for various typesetting tasks. The tlmgr
command-line utility is part of TeX Live Manager and facilitates searching for packages and files among installed TeX packages or the broader TeX Live database using regular expressions. This enables users to efficiently find specific packages or files, aiding in the optimization and organization of their TeX environment.
Use case 1: Search for a package name and descriptions of all locally installed packages from a specific regular expression
Code:
tlmgr search "geometry"
Motivation: Searching for a package by its name or description allows users to quickly locate relevant packages already installed on their local system. For instance, if a user needs to modify or utilize the “geometry” package, which adjusts page layout, this search will reveal whether the package is present without having to manually browse through all installed packages.
Explanation:
tlmgr
denotes the TeX Live Manager command.search
specifies that the command is conducting a search."geometry"
is the regular expression being used. It matches package names and descriptions containing the term “geometry.”
Example Output:
geometry:
texlive-local: Revision 22012
LaTeX package providing flexible page geometry.
Use case 2: Search for all file names of all locally installed packages from a regular expression
Code:
tlmgr search --file "geometry.sty"
Motivation:
This usage scenario is particularly beneficial for users looking to identify the specific files related to a package. Suppose a user is troubleshooting or verifying the existence of a file like geometry.sty
. By conducting this search, the user can quickly locate the file without wading through directory structures manually.
Explanation:
--file
restricts the search to file names within the packages."geometry.sty"
is the regular expression, indicating the user is searching for a particular file with this name.
Example Output:
geometry.sty: /usr/local/texlive/2023/texmf-dist/tex/latex/geometry/geometry.sty
Use case 3: Search for all file names, package names, and descriptions of all locally installed packages from a regular expression
Code:
tlmgr search --all "geometry"
Motivation: When users want a comprehensive search covering package names, descriptions, and file names, this use case becomes highly beneficial. It simplifies the process of understanding the full scope of what is locally available related to a keyword like “geometry,” assisting in either package management or problem-solving tasks.
Explanation:
--all
means the search will encompass all aspects: package names, descriptions, and file names."geometry"
is the regular expression for the search term.
Example Output:
geometry:
texlive-local: Revision 22012
LaTeX package providing flexible page geometry.
geometry.sty: /usr/local/texlive/2023/texmf-dist/tex/latex/geometry/geometry.sty
Use case 4: Search the TeX Live database, instead of the local installation
Code:
tlmgr search --global "geometry"
Motivation: Users not finding a particular package locally might need to see if it exists in the broader TeX Live database to consider installing it. Searching the global database helps to identify uninstalled but available packages or newer versions with desired features identified by the regular expression.
Explanation:
--global
flags the search to refer to the comprehensive TeX Live database instead of local data."geometry"
signifies the regular expression for the query.
Example Output:
geometry [contained in texlive]:
LaTeX package providing flexible page geometry.
Use case 5: Restrict the matches for package names and descriptions (but not for file names) to whole words
Code:
tlmgr search --all --word "geometry"
Motivation: When users want precision in their searches by avoiding partial matches, such as not wanting to match packages with words that just contain “geometry” as a substring (e.g., “biogeometry”), this restriction helps. It ensures only exact whole-word matches appear in results for tidy and relevant output.
Explanation:
--word
limits the matches to whole words only, ensuring precision in search results.--all
allows searching within package names, descriptions, and file names, though the whole-word restriction applies only to names and descriptions."geometry"
is the search term utilized.
Example Output:
geometry:
texlive-local: Revision 22012
LaTeX package providing flexible page geometry.
Conclusion:
The tlmgr search
command is a versatile tool, essential for effortlessly navigating the TeX Live environment. By employing various flags and regular expressions, users can tailor their search queries, ensuring they get precise and comprehensive information. Whether managing installed packages or checking online TeX Live databases, these examples demonstrate how tlmgr search
can be pivotal for efficient TeX system handling.