I exported an essay written in org mode to a LaTeX file (and then a pdf) today. It had `example' blocks in several consequent sections, each with a name (i.e. `#+name'). I have `org-latex-prefer-user-labels' set to t, and used these names to refer to the examples later on. I noticed that some of these labels were resolved wrong (i.e. printed as the wrong number) in the resulting pdf. Examining the tex source, this was because the labels had been printed outside (just before) the example blocks, thus: ,--- | \label{ex:foo} | \begin{example} | My example here | \end{example} `--- In tnhese cases, sometimes LaTeX interpreted the surrounding section as the subject of the label, and printed the number of that section when the label was referred to. The attached patch forces example environments to be printed thus: ,--- | \begin{example}\label{ex:foo} | My example here | \end{example} `--- This solves the problem. The logic/conditions for when to print a label, and how it is generated remain unchanged. Hope this is helpful for someone else too! Hugo