Text FormattingProposition, Theorem, etc numbering and \ref

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
lalop
Posts: 63
Joined: Fri Sep 11, 2009 11:25 pm

Proposition, Theorem, etc numbering and \ref

Post by lalop »

I'm using the memoir class with amsmath, amssymb, amsthm.

I have two questions:

1) When I index the theorem by page, specifically

Code: Select all

\newtheorem{thm}{Theorem}[page]

\newtheorem{lem}[thm]{Lemma} %to be part of the same numbering scheme
\newtheorem{cor}[thm]{Corollary}
...
etc
so that the theorems come out like Theorem 15.2 (15th page, 2nd item), the numbering has a tendency to commonly overspill to the next page. For example, the first item on page 15 is usually Theorem 14.6. It's really only a problem with spilling over to the topmost item on a page. Does anyone have any suggestions on how to fix/minimize this?


2) Does anyone know how to make it so using \ref{theoremlabel} gives not only the number, but the type as well? For instance, "Corollary 9.2" instead of just "9.2".



Thanks beforehand.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Proposition, Theorem, etc numbering and \ref

Post by gmedina »

Hi,

the first problem comes from the asynchronous mechanism that LaTeX uses to build the document pages. I'll think about this.
lalop wrote:...2) Does anyone know how to make it so using \ref{theoremlabel} gives not only the number, but the type as well? For instance, "Corollary 9.2" instead of just "9.2"...
Use the ntheorem package and the \thref command.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
lalop
Posts: 63
Joined: Fri Sep 11, 2009 11:25 pm

Re: Proposition, Theorem, etc numbering and \ref

Post by lalop »

Hm, the option thmmarks seems to conflict with \tag in the \[ \] environment; it comes with an error saying tag isn't allowed.

Current options: [amsmath,amsthm,thref,thmmarks] or [amsmath,plain,thref,thmmarks]


[It's not that terribly great a problem, I guess, since I can just define my own command to test the actual label.]
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Proposition, Theorem, etc numbering and \ref

Post by gmedina »

By now you should be aware of the relevance of providing minimal and complete code and not just useless snippets. The following code works OK for me:

Code: Select all

\documentclass{book}
\usepackage{amsmath}
\usepackage[amsmath,amsthm,thref,thmmarks]{ntheorem}

\begin{document}

\[ a=b \]

\end{document}
If you are experiencing some problem, please give us some minimal and complete code allowing us to easily reproduce the undesired behaviour.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
lalop
Posts: 63
Joined: Fri Sep 11, 2009 11:25 pm

Proposition, Theorem, etc numbering and \ref

Post by lalop »

gmedina wrote:...
Try:

Code: Select all

\documentclass{book}
\usepackage{amsmath}
\usepackage[amsmath,amsthm,thref,thmmarks]{ntheorem}

\begin{document}

\[ a=b \tag{hi} \]

\end{document}
daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

Re: Proposition, Theorem, etc numbering and \ref

Post by daleif »

that has nothing to do with ntheorem, you cannot add a tag (which would override an equation number) inside an environment that does not provide equation numbers.
lalop
Posts: 63
Joined: Fri Sep 11, 2009 11:25 pm

Proposition, Theorem, etc numbering and \ref

Post by lalop »

It does work, though, if you remove the ntheorem line:

Code: Select all

\documentclass{book}
\usepackage{amsmath}

\begin{document}

\[ a=b \tag{hi} \]

\end{document}
daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

Re: Proposition, Theorem, etc numbering and \ref

Post by daleif »

to me that is an error (or undocumented feature)
lalop
Posts: 63
Joined: Fri Sep 11, 2009 11:25 pm

Re: Proposition, Theorem, etc numbering and \ref

Post by lalop »

oh well : x as i said, i can customize \thref instead
Post Reply