Hot answers tagged

46

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 ...


30

Load varioref first, then hyperref, then cleveref. See section 12.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 ...


30

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} ...


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, ...


24

The cleveref package sorts and compresses cross-references. It also automatically determines the format of references, so that you don't have to type "section" in the source. \documentclass{article} \usepackage{cleveref} \begin{document} \section{winter}\label{winter} \section{spring}\label{spring} \section{summer}\label{summer} ...


22

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} ...


18

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

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% ...


17

I recommend to use the cleveref package which enhances LaTeX's cross-referencing features determining types of cross-references and context. In your case, \cref{my new result} would output proposition 1. If you then change this particular environment into a lemma environment, the same \cref{my new result} would output lemma 1. You could even change the ...


17

use this order of the packages: \usepackage{hyperref}
 \usepackage{amsthm}
 \usepackage{cleveref}


16

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} ...


15

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 ...


15

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} ...


15

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 ...


15

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 ...


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

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 ...


13

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} ...


13

#1 and #2 of \crefrangelabelformat contains the formatted equation number. The following example expands them and stores them in \eq@ref@a and \eq@ref@b. Then both are analyzed, whether the equation numbers have a dot separator. If yes, then the first parts are compared and omitted in \eq@ref@b, if the first parts are equal. \documentclass{report} ...


13

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) ...


13

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 ...


13

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 ...


12

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 ...


12

You can use (as described in cleveref's documentation) \crefname, \Crefname, and the optional argument for the \label command to supply a new "type" for the sections in the appendices, ; a little example: \documentclass{report} \usepackage{titlesec} \usepackage{hyperref} \usepackage{cleveref} \crefname{secinapp}{appendix}{appendices} ...


12

cleveref is at version 0.18.4 at the moment. The noabbrev option was introduced in version 0.18 (from December 2011, announcement at comp.text.tex), so this is most likely a versioning issue. EDIT: According to your log file, you are using cleveref 0.17.9, so you need to switch to a more recent version.


12

Well, let's see, first the manual of cleveref, in the non-bugs section, cleveref will not work properly with the standard LaTeX eqnarray environment. There is no intention to fix this. The eqnarray environment is poorly implemented, making it difficult to get it to work properly with cleveref, and it's broken any way. You're far better off using ...


12

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 ...


12

This solution works by redefining \@@setcrefrange. For a hyperref solution, this will need extra work. Also the numbering-scheme of the subequations (which is actually the equation counter) is not saved with the label (neither is the scheme of the equations (which is actually the parentequation counter)). The problem is that not a, b and so on is stored ...


11

You need to tell cleveref how you want to refer to the algorithms. Something like: \crefname{algocf}{alg.}{algs.} \Crefname{algocf}{Algorithm}{Algorithms}


11

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.



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