Hints for searching

This page will help you search CTAN. It provides a primer and some hints on using regular expressions.

Examples

Sometimes the easiest way to figure something out is to see a few examples. We will illustrate with the filename search, but other regular expression searches work the same way.

  • ulem This string matches any filename with those four characters in a row somwwhere in the full path. For instance, you will be shown all of the places where ulem.sty is found.

  • pdf.*exe This string matches any filename containing the three letters pdf followed by any number of things (this is what the .* does), followed by the three letters exe. For instance, this search will find pdftex.exe and pdflatex.exe. You'll get lots of other hits also, including tex-archive/support/pdftexenc/cmr.enc because it has in it pdf, followed by a t, followed by exe.

  • jtex|javatex This string will match any filename containing the four letters jtex, and will also match any filename containing the seven letters javatex. The vertical bar | means `or'. By the way, the same results could have been gotten from the query string (j|java)tex.

Some common errors

  • Asking for a .sty when CTAN has a .dtx If you are looking for a LaTeX style file that should be here, but the search for a file does not find it, then probably it is distributed in another form. For instance, if you want etruscan.sty and searching for that entire string doesn't work, the next step is to search for etruscan alone. You will find etruscan.dtx (some LaTeX styles are distributed as .dtx, a format that combines TeX code and documentation). Download and turn it into etruscan.sty by following the directions on the FAQ's installation advice page.

  • Misunderstanding the * You may be used to using s*.sty to searche through a directory for all filenames beginning with s, containing any number of characters, and ending in .sty. However, that string does not do the same thing here. Here, s*.sty searches for all filenames whose full path name contains a string with any number of s's, followed by any character (that's what the . does), followed by sty. Instead, you probably meant something like s.*sty, which matches an s, followed by any number of characters, followed by an sty (there are better, more sophisticated, search strings, but this is a start).

Overview

In a regular expression search box you can enter strings composed of: any lower-case letter (a-z), any upper-case letter (A-Z), any digit (0-9), a slash (/), a period (.), a star (*), a question mark (?), and a backslash (\).

However, the period, star, and question mark have a special meaning.

  • Period This matches any single character. Thus, pdf..tex match any string including somewhere in it a pdf, followed by any two characters, followed by tex.

  • Question mark This matches if there are either zero or one of the prior character. Thus pdfe?tex matches both pdfetex and also pdftex.

  • Star This matches any number of the prior character. Thus s.*thm matches shadethm.sty because part of that string contains an s followed by some number of characters, followed by a thm. (Warning! "any number of " includes 0-many of, so shadethm.sty is also matched by s.*hadethm.sty.)

This table might prompt you on regular expressions.

Regular expression Description
. Matches any character except newline
[a-z0-9] Matches any single character of the set
\d Matches a digit, i.e., [0-9]
\w Matches an alphanumeric character, i.e., [a-zA-Z0-9_]
\W Matches a non-word character, i.e., [^a-zA-Z0-9_]
\metachar Matches the character itself, i.e., |, *, +
x? Matches 0- or 1-many x's, where x is any of the above
x* Matches 0 or more x's
x+ Matches 1 or more x's
x{m,n} Matches at least m-many x's but no more than n-many
foo|bar Matches one of foo or bar
(x) Grouping
\b Matches a word boundary