All references are marked with

  • eq -> equation
  • tab -> table
  • fig -> figure
  • app -> appendix
  • sec -> section
  • chp -> chapter

So a reference would look like


for Newton's law of motion, and the introduction section.

I have been looking around for a way to sort my reference so that if I write \eqref the auto-completion only give me options to chose between references with 'eq' in. And the same for the other pre-fixes.

I have tried to use the \newcommand function, but this does not give me the auto-completion options.


But the auto-completion doesn't seem to work.

  • 1
    With other words: If the label refers to a table, the reference should show Table 1.1 etc automatically? cleveref package and \cref ?
    – user31729
    May 29 '15 at 8:21
  • Never heard of that one, need to look it up, but that does what I'm looking for/making?
    – Mikkel
    May 29 '15 at 8:22
  • I'll show an example in a few minutes. It won't expand however your label prefix in a direct way. The appendix app could be difficult, actually.
    – user31729
    May 29 '15 at 8:23
  • 2
    @Mikkel Are you talking about the text editor's autocompletion? I don't think Texmaker can do it out of the box, so this should probably be a feature request for the program's developers.
    – egreg
    May 29 '15 at 8:28
  • @egreg that was what I was hoping for, but it seems that it is to much to ask for..
    – Mikkel
    May 29 '15 at 9:04

This shows the application of cleveref for the standard counters and the difference between \cref and \Cref -- the later is used for uppercase completion of the counter name.

The completion names can be specified with the commands \crefname and \Crefname (see the documentation please)




\chapter{First} \label{chp:somechapter}

\section{first section} \label{sec:somesection}

E=mc^2 \label{eq:einstein}

\caption{dummytable} \label{tab:dummytable}

\caption{dummyfigure} \label{fig:dummyfigure}

In \cref{eq:einstein}, \cref{tab:dummytable} and \Cref{fig:dummyfigure} from \cref{chp:somechapter} and \cref{sec:somesection} we see that... but in \Cref{app:chapter1}

\chapter{First appendix chapter} \label{app:chapter1}


enter image description here

  • I can't download the cleveref.sty would it be possible for you to include a output example?
    – Mikkel
    May 29 '15 at 8:37
  • @Mikkel: I was just doing it ;-)
    – user31729
    May 29 '15 at 8:38
  • -1 to university network restrictions! just needed another download source. On topic, that is exactly what I was looking for!. A wounder that I never meet it before ... Thanks Christian
    – Mikkel
    May 29 '15 at 8:41
  • @Mikkel: No problem at all. Happy TeXing then! cleveref is a standard nowadays, I would say, it should be on any TeX distribution. Make sure to include it after hyperref
    – user31729
    May 29 '15 at 8:43
  • Just noticed that i does not have the auto-completion, functionality, but as egreg pointed out, that is most likely a functionality of the editor. With the cleveref I still get most of the functionality I was looking for
    – Mikkel
    May 29 '15 at 9:07

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.