How to use the command "tlmgr search" (with examples)
The “tlmgr search” command is used to search for TeX Live packages using Perl regular expressions. It allows users to search for package names, descriptions, and file names of both locally installed packages and packages in the TeX Live database.
Use case 1: Search for package names and descriptions of locally installed packages from a regular expression
Code:
tlmgr search "regular_expression"
Motivation: This use case is helpful when you want to find information about locally installed packages based on a specific regular expression. It allows you to search for specific packages or packages with certain keywords in their descriptions.
Explanation:
- “tlmgr search”: This is the command to search for TeX Live packages.
- “regular_expression”: This argument specifies the regular expression to match against the package names and descriptions.
Example output:
collection-latexextra - LaTeX additional packages
collection-mathextra - LaTeX additional packages for math
...
Use case 2: Search for file names of all locally installed packages from a regular expression
Code:
tlmgr search --file "regular_expression"
Motivation: This use case is useful when you want to find file names of locally installed packages that match a specific regular expression. It helps identify files related to a package or files with certain keywords in their names.
Explanation:
- “tlmgr search”: This is the command to search for TeX Live packages.
- “–file”: This flag specifies that we want to search for file names instead of package names or descriptions.
- “regular_expression”: This argument specifies the regular expression to match against the file names.
Example output:
path/to/package/file1.sty
path/to/package/file2.cls
...
Use case 3: Search for file names, package names, and descriptions of all locally installed packages from a regular expression
Code:
tlmgr search --all "regular_expression"
Motivation: This use case is valuable when you want to search for packages that match a regular expression in either their file names, package names, or descriptions. It provides comprehensive search results covering all types of package information.
Explanation:
- “tlmgr search”: This is the command to search for TeX Live packages.
- “–all”: This flag specifies that we want to search for file names, package names, and descriptions.
- “regular_expression”: This argument specifies the regular expression to match against the various package information.
Example output:
collection-latexextra - LaTeX additional packages
path/to/package/file1.sty
path/to/package/file2.cls
...
Use case 4: Search the TeX Live database instead of the local installation
Code:
tlmgr search --global "regular_expression"
Motivation: This use case is helpful when you want to search for packages that are not locally installed but are available in the TeX Live database. It allows you to find packages that you may want to install in the future.
Explanation:
- “tlmgr search”: This is the command to search for TeX Live packages.
- “–global”: This flag specifies that we want to search in the TeX Live database instead of the local installation.
- “regular_expression”: This argument specifies the regular expression to match against the package names and descriptions in the database.
Example output:
collection-latex - The LaTeX fundamental package collection
collection-latexextra - LaTeX additional packages
...
Use case 5: Restrict the matches for package names and descriptions to whole words
Code:
tlmgr search --all --word "regular_expression"
Motivation: This use case is useful when you want to search for package names and descriptions that match a specific word rather than partial matches. It ensures that the search results are limited to complete words.
Explanation:
- “tlmgr search”: This is the command to search for TeX Live packages.
- “–all”: This flag specifies that we want to search for file names, package names, and descriptions.
- “–word”: This flag restricts the matches for package names and descriptions to whole words.
- “regular_expression”: This argument specifies the regular expression to match against the package information.
Example output:
collection-latexextra - LaTeX additional packages
...
Conclusion:
The “tlmgr search” command is a versatile tool for searching TeX Live packages based on Perl regular expressions. It allows users to search for package names, descriptions, and file names as well as restrict matches to whole words or the TeX Live database. These use cases showcase the flexibility and power of the command in finding relevant packages and package information.