LaTeX cleveref package

18 October 2018 The Cleveref package (also available from CTAN) does clever things with cross-references:

  • automatic formatting of cross-references based on the type of object referred to (chapter, section, equation, theorem, etc.);
  • full control and customisation of the reference format;
  • cross-references and page references to multiple items;
  • automatic (optional) sorting and compression of multiple cross-references or page references;
  • optional output of a sed script that can strip out Cleveref commands and replace them with standard LaTeX, allowing Cleveref to be used e.g. in articles sent to journals or collaborators that don't (yet!) support Cleveref.

A number of other LaTeX packages provide similar features. Some are venerable enough to be documented in The LaTeX Companion, or even included in the standard LaTeX distribution itself. But all those that I've come across provide only a subset of the Cleveref features. (See the Introduction to the package documentation for some comparisons.)

Documentation

Full documentation is available in a variety of formats, for download and viewing online. (Since the package is in DocTeX format, the source for the documentation is the same as the package itself.)

Download and Installation

The latest release of the Cleveref package is version 0.21.5 (released March 2018).

For convenience, the most recent "stable" CTAN release is also available below, along with some older versions.

To install the package, follow the usual DocTeX installation procedure: extract the files, run the cleveref.ins file through LaTeX, copy the resulting cleveref.sty file to a directory in your TeX path, and run texhash (or equivalent) to update your TeX database.

To build the documentation, run the cleveref.dtx file through LaTeX, run makeindex -s gind.ist cleveref.idx to build the index, then makeindex -s gglo.ist -t cleveref.glg -o cleveref.gls cleveref.glo to build the change history, and finally run cleveref.dtx through LaTeX one last time.

Bugs and Feature Requests

Bugs, feature requests, and any other feedback should be addressed to toby+cleveref@dr-qubit.org.

A list of known bugs, work-arounds, and possible future improvements is included at the end of the package documentation.

Comments

Werner Lemberg

18 January 2018 Toby,

your package is amazing! However, I ask for a small improvement, posing a second condition in the names of references: please disallow leading spaces. If you do that, you could enable code like

\cref{foo, bar}

(note the space after the comma) to handle references `foo' and `bar'. Right now (tested with v0.19 and v0.21) you get a warning like

LaTeX Warning: Reference ` foo' on page 1 undefined

instead… I can imagine that ignoring leading spaces would improve user friendliness.

Leave a comment

All comments are moderated. Clicking submit will open your email client and let you send your comment by email. By submitting your comment you agree to license the content under a Creative Commons Attribution-ShareAlike 4.0 International License.




Creative Commons License