Is there a package that automatically inserts the ToC level of the reference I inserted?

Section 1.1
Subsection 1.1.1
Subsection 1.1.2 

So that the text:

Blah \superref{a} and \superref{b} and \superref{c}


Blah Section 1.1 and Subsection 1.1.1 and Subsection 1.1.2

So that it automatically adapts if I change the level of a label?

3 Answers 3


Use the cleveref package and its \cref macro. Note that sectioning levels below \section are referred to as "section" by default, but this can be customized.

EDIT: In case you want the first letter of the reference name capitalized, use \Cref.








See \cref{a} and \cref{b} and \cref{c}~\dots


enter image description here

  • 4
    \Cref is for starting a sentence, akin to \Citet. For consistent capitalization, use the capitalize package option. Use noabbrev to fully spell out the reference names. (See Section 6 of the manual.)
    – krlmlr
    Jun 15, 2013 at 13:44
  • 1
    If one writes See \cref{a,b,c}, the output is See section 1.1 and subsections 1.1.1 and 1.1.2. A \cref instruction can take multiple inputs, and cleveref parses, sorts, and (if necessary) compresses the cross-references on its own.
    – Mico
    Mar 1, 2015 at 21:24

The hyperref package provides \autoref{<label>} which inserts the name of the reference type as well. These names can also be changed e.g. redefine \sectionautorefname to change the name for sections.


For Muggles like me who want to keep things simple :)

Declare your next-level ultra-custom prefixed reference command:

\newcommand{\secref}[1]{Sexy Section \ref{#1}}

And then go ahead and use it like this:

\section{On Mugglers and boring things}\label{mysweetbigbrainlabel}

Remember when I told you what a muggler is? if not read 
\secref{mysweetbigbrainlabel} again.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .