Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Ntheorem: How to refer to environment type

0 views
Skip to first unread message

dcl...@gmail.com

unread,
Aug 9, 2006, 3:51:24 PM8/9/06
to
How can I refer to the environment name alone in ntheorem?

For example (abbreviated code),

\newtheorem{prop}{Proposition}

\begin{document}
\begin{prop}
\label{foo}
\end{prop}

In \thref{prop} we saw that.
vs.
In the preceding \envref{prop} we saw that.

\end{document}


\envref{prop} is the command I'm looking for that would substitute the
word 'Proposition'.

Morten Høgholm

unread,
Aug 9, 2006, 4:11:27 PM8/9/06
to

The definition of \thref in ntheorem.sty is

\def\thref#1{%
\expandafter\ifx\csname r@#1@type\endcsname\None
\PackageWarning{\basename}{thref: Reference Type of `#1' on page
\thepage \space undefined}\G@refundefinedtrue
\else\csname r@#1@type\endcsname~\fi%
\expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}}

Hence you can construct a macro based on that which only inserts the type
name.

\makeatletter
\newcommand*\envref[1]{%
\expandafter\ifx\csname r@#1@type\endcsname\None
\PackageWarning{\basename}{thref: Reference Type of `#1' on page
\thepage \space undefined}\G@refundefinedtrue
\else\csname r@#1@type\endcsname\fi
}
\makeatother

--
Morten

dcl...@gmail.com

unread,
Aug 9, 2006, 5:27:15 PM8/9/06
to
Morten Høgholm wrote:
> The definition of \thref in ntheorem.sty is
<snip>

> you can construct a macro based on that which only inserts the type
> name.
<snip>


Thank you very much. My low-level TeX/LaTex skills are poor
(non-existant). You really helped me out with the code.

Ulrich M. Schwarz

unread,
Aug 9, 2006, 4:29:17 PM8/9/06
to
dcl...@gmail.com writes:

\makeatletter
\newcommand\envref[1]{%
\@nameuse{r@#1@type}%
}
\makeatother
should do the trick.

HTH
Ulrich
--
http://talcum.sarovar.org/ (Current release: 0.5.138 20050911)

dcl...@gmail.com

unread,
Aug 10, 2006, 11:37:23 AM8/10/06
to

Ulrich M. Schwarz wrote:
> \makeatletter
> \newcommand\envref[1]{%
> \@nameuse{r@#1@type}%
> }
> \makeatother
> should do the trick.

Thanks.

I've realized that it is probably incorrect to capitalize Proposition
as a proper noun when I am referring to the class of propositions, as
in "the preceding proposition..." and not a particular instance as in
"Proposition 1".

Is there any way to convert it to the proper case? That is, lower case
unless at the start of a sentence.

0 new messages