Reading manuals I always find figure labeled as \label{fig:name}. I wonder where is the advantage of using this notation with fig:instead to start with the name it self. If in my document I have only figures when I \ref something using the label without fig: is more quick because I don't have to type fig: before to find the right figure that I want. Is there any advantage I'm missing? Should I use fig:?

enter image description here

  • 6
    If you have sure that you will only have labels for figures you don't need fig:. But in other cases, it is very recommended since you can quickly find the figure labels or table labels or section labels and so on...
    – Sigur
    Commented Jan 2, 2014 at 22:41
  • 2
    @Sigur thanks ok so however is arbitrary if I use f is the same thing...
    – G M
    Commented Jan 2, 2014 at 22:43
  • 6
    @GM Labels are completely arbitrary (as long as they consist of ASCII characters only). However a personal naming scheme is surely good: with several internal cross references it becomes difficult to keep track of them and some helper is useful.
    – egreg
    Commented Jan 2, 2014 at 22:47
  • 2
    I usually put '.fig' at the end of the label instead of 'fig:' at the beginning. The reason being that half the time, by the time I've typed "\ref{fig:", I've forgotten what the label name is.
    – N. Virgo
    Commented Jan 3, 2014 at 2:06
  • 1
    I use fig= instead of fig: because I've had issues with packages making : active, but other than that it is a convenient namespace convention. Commented Jan 3, 2014 at 11:11

4 Answers 4


Here are at least two reasons:

  • It expresses the meaning of the label in a very sensible way, in all the below cases the intent of the label is straightforward and it will also let you group things that have meaning to each other, fig:system and eq:system have the meaning of system and one is a figure, the other an equation.

    • fig: for figures
    • tbl:/tabl: for tables
    • eq: for equations
    • chap:/chp: for chapters
    • sec: for sections
  • It can typically be parsed by your editor to easier lookup only figure/table/equation labels. In the case of emacs there is RefTeX which eases the cross-reference system. Several other editors also have such instances of cross-reference system.


In addition to the reasons given by others (intelligibility of source; leveraging editor capabilities etc.), if you use fancyref, you can automate more descriptive cross-referencing. This makes it easy to ensure that your cross-references are consistently formatted throughout the document. The system can be adapted to use your own preferred prefixes and labels, and can be extended to cover cross-references to other elements of your document. It can handle both plain and vario referencing and offers upper and lower case referencing commands out of the box.



\section{A section}\label{sec:mysec}

  \centering \fbox{A figure}
  \caption{My figure}\label{fig:myfig}

\Fref{sec:myothersec} will demonstrate that \fref{fig:myfig} is fantastic.

\section{Another section}\label{sec:myothersec}

\Fref{fig:myfig} showed whatever my figure showed in \fref{sec:mysec}.


fancyref demo

  • 24
    cleveref provides a similar functionality without the need of identifiers like fig:. But using them is still a good idea …
    – Tobi
    Commented Jan 3, 2014 at 1:48
  • 2
    cleveref looks really nice. Not so much because of the automated identification (though it does rather undercut my answer here!) but because it promises to automatically compress multiple references which is something I've wished fancyref could do. I will definitely have to take a look. I'm guessing you are the author? Thanks! (Though I guess I would lose my current config which is definitely a disincentive!)
    – cfr
    Commented Jan 3, 2014 at 2:01
  • No no … I’m just a user of the package :-)
    – Tobi
    Commented Jan 3, 2014 at 2:05
  • 1
    Ah, well. Thanks for the pointer in any case. I notice now that he spells his name with a y not an i.
    – cfr
    Commented Jan 3, 2014 at 2:06
  • Oh … I never noticed that the author has nearly the same name :-)
    – Tobi
    Commented Jan 3, 2014 at 2:11

Personally I have never used such a convention (and LaTeX doesn't assume any structure to the labels) the label string is really just an opaque internal identifier. If you find it convenient to give a common prefix to labels of similar objects then do so, but it is certainly not a requirement of the system. Some packages and/or editors may try to parse the structure of the labels and look for fig: etc, but probably they shouldn't.


I'm currently writing some lecture notes for "Geometry and Topology" (in German). With that project I've learned why namespaces for labels make sense.

Avoid double labels: I have had problems without prefixes like fig: and sec: or bsp: (for examples) or thm:, because of double labels. Quite often, I have had a figure I want to reference and a theorem. Namespaces solve that problem nicely.

Make code easier to read

Avoid mix-ups: Sometimes, I wanted to reference sections. So I was sure the section had a label, e.g. \label{lifting}. But in fact, that label was chosen for a figure. This would not have happened when I had prefixes. With prefixes, LaTeX would produce some ?? and make it obvious that I made an error.

After I have seen the screenshot from above, I think there is another advantage for you:

Autocompletion: I guess most of the time you know if you want to reference a figure, a section, a table or whatever. This way, you reduce the number of elements you actually need to think about quite a lot. (By the way, what editor do you use? I still type my LaTeX with gEdit / pluma mot of the time ... maybe you have a better alternative?)

Cleveref and Fancref: There are some reasons why you should use \usepackage{cleveref} (see long answer). With that, you can do something like

 As you can see in \cref{sec:abc} ...

which might translate to

 As you can see in section 7

where "section 7" is linked. Additionally, you can pass language options to cleveref which might make translation easier.

So there are some important reasons for using your own convention for label-namespaces.

Collaboration is the only reason for using a "well known namespace scheme" like fig: for figures and sec: for sections.

However, LaTeX doesn't care about label namespaces. They are just a part of the name of the label.


You must log in to answer this question.

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