1

I have just been using the default label and reference formats, i.e. $\label{eqn:a}$ and \ref{eqn:a} but I was wondering if there's a way to change the format of the references. For example if I am referring back to Theorem 1.1 $\label{thm:1.1}$ using \ref{thm:1.1} it shows in the .pdf file as simply 1.1. I would like my references to say more than the number, i.e. to say Theorem 1.1 in the .pdf (I would also like this to be true for my Definitions and Lemmas). Obviously I know that this doesn't make sense for a line in a proof but is there a way to change the format when you are referring to a labelled theorem(or definition/lemma/etc.)??

  • \usepackage{cleveref} and \cref{eqn:a} etc. – user31729 Apr 13 '16 at 15:24
  • I have changed all my refs to clever ref but now it just gives me whats in the curly brackets, i.e. \cref{eqn:a} gives eqn:a. Is there another way or do I have to go and manually change all of my labels? – Annalise Apr 13 '16 at 15:32
  • I don't know what is going wrong there. Without any document this is hard to tell! – user31729 Apr 13 '16 at 15:35
  • 2
    Please show us a short, compilable code resulting in your error. – Mensch Apr 13 '16 at 15:37
2

A possibility is to use cleveref and its \cref or \Cref commands to include the type of the referenced counter, e.g. an equation or a theorem. The \Cref is used for uppercase purposes, e.g. at the beginning of a sentence.

Please note, that \usepackage[english]{cleveref} etc. is perhaps more useful, depending on the needed language.

cleveref's output format for references can be reconfigured using \crefformat etc.

cleveref should be the last package be loaded here!

\documentclass{book}

\usepackage{mathtools}

\usepackage{amsthm}

\usepackage{cleveref}
\newtheorem{theorem}{Theorem}[chapter]


\begin{document}

\chapter{First chapter}

In \cref{Einstein} and in \cref{theo} or \Cref{theo} we'll see that ...



\begin{equation}
  E=mc^2 \label{Einstein}
\end{equation}

\begin{theorem} \label{theo}
First we have...
\end{theorem}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.