#532650 lacheck: Should warn when \label is used before \caption in a {figure}

Package:
lacheck
Source:
lacheck
Description:
Simple syntax checker for LaTeX
Submitter:
Török Edwin
Date:
2011-12-25 03:48:04 UTC
Severity:
wishlist
#532650#5
Date:
2009-06-10 16:04:17 UTC
From:
To:
lacheck doesn't give any warnings if you use \label before \caption
in a figure environment, and neither does LaTeX.

Consider this example:
\documentclass{article}
\begin{document}
\section{Section}

\begin{figure}
\label{fig:l1}
\caption{First figure}
\end{figure}
\begin{figure}
\label{fig:l2}
\caption{Second figure}
\end{figure}
\begin{figure}
\caption{Working figure}
\label{fig:l3}
\end{figure}

This is the first figure:~\ref{fig:l1}, and this is the second one:~\ref{fig:l2}.
This is a good reference: \vref{fig:l3}.

\end{document}

This will print: first figure: 1, and this is the second one: 1. This is a good
reference: 3.

Obviously the document is written wrong, \label should be used after \caption,
otherwise it doesn't work.

It would be useful if lacheck, or LaTeX itself could warn about this situation.
It is annoying to see all your figure references refering to the same figure.