General\label placement

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
drowsy
Posts: 44
Joined: Tue Dec 23, 2008 6:00 am

\label placement

Post by drowsy »

Hi,

I have seen this a few times:

\begin{theorem\label{mylabel}}
$2+2=4$.
\end{theorem}

and it does work.
Is it OK to do this? I mean, is this behavior official/will be always supported? Looks kinda weird to me to put a label inside of \begin{something}.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

\label placement

Post by localghost »

This is not a reliable method of placing labels. For some structures it works, but in the most cases not. In this case you better place the label right behind the beginning of the environment.

Code: Select all

\begin{theorem}\label{thm:label}
  % theorem contents
\end{theorem}

Best regards
Thorsten
Post Reply