Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
66

You can certainly load both the varioref and the cleveref with hyperref provided that you load them in the following order \usepackage{varioref} \usepackage{hyperref} \usepackage{cleveref} They all play very nicely together. The varioref and cleveref weren't around when I did my thesis, but I'm working on a multi-chapter document at the moment in which I'...


40

I tried to look for other questions with the same problem and found none. So here's an answer: load cleveref last. From the documentation: The cleveref package is loaded in the usual way, by putting the line \usepackage{cleveref} in your document’s preamble. However, care must be taken when using cleveref in conjunction with other packages that ...


38

Load varioref first, then hyperref, then cleveref. See section 14.1 of the cleveref manual. \documentclass[ngerman]{scrartcl} \usepackage{babel} \usepackage{varioref} \usepackage{hyperref} \usepackage{cleveref} \begin{document} \section{Erster Abschnitt}\label{sec} \begin{figure} \rule{\textwidth}{1cm} \caption{bild}\label{bild} \end{figure} Siehe \...


35

If you define this new command \newcommand{\creflastconjunction}{, and\nobreakspace} you will get Oxford comma everywhere you use multiple references like those. MWE: \documentclass{article} \usepackage[standard]{ntheorem} \usepackage{cleveref} \newcommand{\creflastconjunction}{, and\nobreakspace} \begin{document} \begin{proposition}\label{thm:roses} ...


32

The package cleveref provides a mechanism for this. Introduce a new type appsec and set up the label name via \crefname; then in the appendices part use \crefalias to get the section type to point to the type appsec: \documentclass{scrartcl} \usepackage{lipsum} \usepackage{appendix} \usepackage{cleveref} \crefname{appsec}{Appendix}{Appendices} \begin{...


29

Pass the nameinlink option to the cleveref package \usepackage[nameinlink]{cleveref} A MWE follows, just for demonstration- see Section 6.2 of the documentation for details \documentclass{article} \usepackage{hyperref} \usepackage[nameinlink]{cleveref} \begin{document} \section{Here is a section}\label{sec:mysection} \begin{equation} f(x)=x^2+\sin(x)...


26

Yes, it is possible. You need to set \captionsetup[subfigure]{subrefformat=simple,labelformat=simple,listofformat=subsimple} \renewcommand\thesubfigure{(\alph{subfigure})} and to use \subref*. A complete example: \documentclass{article} \usepackage[demo]{graphicx} \usepackage[format=hang,singlelinecheck=0,font={sf,small},labelfont=bf]{subfig} \usepackage{...


25

There is a bug in thm-autoref.sty. Part of the set-up for cleverefs magic is left to the start of the document. So cleveref maintains a list of all the label types that it has been told about so that when it gets to the \begin{document} hook, it can iterate through them and finish the necessary configuration. Examining this list for your document (well, ...


22

svjour3 isn't in texlive but I got a copy from the springer site. It appears to have a bug and your document goes into an infinite loop \cl@chapter is defined to expand to itself. This fixes (or at least avoids) that immediate problem. \begin{filecontents*}{example.eps} gsave newpath 20 20 moveto 20 220 lineto 220 220 lineto 220 20 lineto closepath 2 ...


21

Solution 1 Add the following to your header: \crefname{lstlisting}{listing}{listings} \Crefname{lstlisting}{Listing}{Listings} Solution 2 Download the newest version from here (cleveref.dtx and cleveref.ins) and run latex cleveref.ins.


21

refcheck doesn't know about \cref and \Cref. We can add a macro that makes the package aware of other reference commands: \documentclass{article} \usepackage{amsmath} \usepackage{cleveref} \usepackage{refcheck} %%% Infrastructure \makeatletter \newcommand{\refcheckize}[1]{% \expandafter\let\csname @@\string#1\endcsname#1% \expandafter\...


20

There is a new pre-release version (v0.18) of cleveref which supports a noabbrev option which does this automatically. The new version is not yet on CTAN but can be downloaded on the package author's website: http://www.dr-qubit.org/latex.php#cleveref


18

Use \crefformat (notice that the same formatting can be achieved simply using \eqref from amsmath): \documentclass{article} \usepackage{amsmath} \usepackage{cleveref} \crefformat{equation}{(#2#1#3)} \begin{document} \ref{eq:test}\eqref{eq:test}\cref{eq:test} \begin{equation} \label{eq:test} a=b. \end{equation} \end{document} You might also want to use ...


17

How cleveref works Cleveref augments the \label command so that it writes some additional information into the .aux file. This part is not particularly invasive at all as it keeps the original implementation of \label intact and all standard functions that rely on it will still work (e.g. the normal \ref command). The second command that is augmented is \...


16

Is there a way of changing that without manually changing all the crefnames? There doesn’t seem to be an appropriate option. According to the manual: The default cross-reference names for some languages use common abbreviations for some of the names (e.g. in the default English format, \cref{eq1} will be typeset as eq.~(1)). Some authors may prefer to ...


16

The behaviour you describe comes from the standard LaTeX \newtheorem command; the problem can be solved by using the amsthm or ntheorem packages: \documentclass{article} \usepackage{amsthm} \usepackage{cleveref} \newtheorem{thm}{Theorem}[section] \newtheorem{lemma}[thm]{Lemma} \newtheorem{cor}[thm]{Corollary} \begin{document} \begin{thm}\label{thm:test} ...


16

The command \eqref is meant for printing references to equations in the same format as used for numbering the equations (and always in upright type). This is not always appropriate for other cross references. For example, items are usually numbered without parentheses and it could be difficult for the reader to interpret the cross reference "In (1, 2)". But ...


16

Something odd seems to be going on in your document, as cleveref doesn't normally engage in the type of behavior you say is occurring. How are the figures and subfigures constructed in your document? Please consider posting a full MWE (mininum working example) that generates the problem behavior you're looking to fix. At any rate, the following should work ...


16

You can do this without hacking any cleveref internals. The beauty of the \cref<x>format commands is that you're really defining the body of a LaTeX macro, not merely a pattern with placeholders to be filled in. This lets you do arbitrarily complex things to the label text before it gets typeset. To produce equation range references of the form (1a-e) ...


15

Use the tablefootnote package and \tablefootnote{...} inside the table: \documentclass{article} \usepackage{hyperref} \usepackage{tablefootnote} \begin{document} \begin{table} \centering \begin{tabular}{ c c } Test1\tablefootnote{Footnote 1} & Test2\tablefootnote{Footnote 2} \\ \end{tabular} \caption{This is a table.\label{FirstTable}} \end{table} A ...


15

Omit the space after the comma. \documentclass[11pt]{article} \usepackage{amssymb,amsmath,amsfonts} \usepackage{amsthm} \usepackage{cleveref} \newtheorem{lemma}{Lemma} \crefname{lemma}{lemma}{lemmas} \begin{document} \begin{lemma} \label{lem:fast} a \end{lemma} \begin{lemma} \label{lem:slow} b \end{lemma} \Cref{lem:fast} \\ \Cref{lem:slow} \\ \Cref{...


15

In addition to (a) instructing LaTeX to prepend the proposition number to the level-one item number when creating cross-references, say, via an instruction such as \begin{enumerate}[label=\alph*), ref=\theproposition~(\alph*)] when starting the enumerated list, you also need to (b) use the \crefalias command to inform cleveref that entities of type enumi (...


14

Section 2.3 of the documentation details that you can use \labelformat{equation}{(#1)} so that \vref works as you would want it to for equations. In fact, following egreg's comment, one should have the reference typeset upright, even if it is contained in environment that is (for example) italic. A complete MWE follows. \documentclass{article} \...


14

Use \crefname{listing}{Quelltext}{Quelltext} \Crefname{listing}{Quelltext}{Quelltext} There is an alias from lstlisting to listing, but apparently it doesn't work. \documentclass{scrbook} \usepackage{listings} \usepackage{varioref} \usepackage{hyperref} \usepackage{cleveref} \begin{document} \crefname{listing}{Quelltext}{Quelltext} \Crefname{listing}{...


14

Loading thmtools and nameref will give you this feature. You will have to use \nameref instead of \cref, but I think most of the time it is you who is the best to decide whether it is the theorem's name or number you want to reference. EDIT Code added with commands \myref and \Myref for single references to automatically add the name in brackets when ...


14

Even simpler, just put \crefname{equation}{}{} in your preamble. Then all the formats get defined for you automatically. (No need to redefine all of \crefformat, \crefmultiformat, \crefrangeformat, \labelcrefformat!) These days, cleveref is...clever enough to omit the usual non-breaking space after the cross-reference name if you define an empty name.


14

Underfull \hbox The problem is package cleveref that sets an unwanted space. The line starts with an object that fills the complete line. Usually the following \caption calls \par that ends the previous paragraph and removes the latest space in the process. However, if there is a space in \caption by some code of \cleveref before, then only one space gets ...


14

Rather than give special meaning to items based on the labels' "prefixes" (a:, b:, ...), I'd use a feature that's already provided by the cleveref package: use the optional argument of the \label command to override an item's default cross-referencing name. In the following example, I first inform cleveref about the singular and plural forms of items called ...


13

This is a known issue that is associated with hyperref and is discussed/answered in the UK TeX FAQ. In answer to your "bonus question": This stems from the fact that you're using the same counter to reference two different things by virtue of \newtheorem{thm}{Theorem} \newtheorem{lem}[thm]{Lemma} This tells LaTeX that you want a new environment called lem,...


Only top voted, non community-wiki answers of a minimum length are eligible