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
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
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
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
Post Reply