0

Here is the code:

\documentclass{article}


\usepackage{amssymb,latexsym,amsmath} 

\usepackage{ntheorem}
\theorembodyfont{\upshape}
\newtheorem*{theorem}{Theorem:}

\newtheorem*{lemma}{Lemma:}

\newenvironment{proof}{\paragraph{\ Proof:}}{\hfill$\square$}

\RequirePackage{hyperref}
\usepackage[nameinlink]{cleveref}

\begin{document}

\begin{lemma} Here is the statement of the lemma.\label{lemma}
\end{lemma}
\begin{theorem}Here is the statement of the theorem.
\end{theorem}

\begin{proof}This is the proof of the theorem using \Cref{lemma}
\end{proof}
\end{document}

Though I have not numbered the lemma using \newtheorem* while referring to the lemma in the proof of the theorem, Lemma 1 comes up. I want to see Lemma, no numbering after that.

I really appreciate any help you can provide.

4
  • That is not the normal way to define a proof via ntheorem, you'd normally use \theoremstyle{empty} and then define it as a theorem like the others \newtheorem{proof}{Proof} onto which the normal ntheorem stylings then apply.
    – daleif
    Apr 13, 2021 at 13:54
  • 1
    Also note that \newheorem* does not do what you think in ntheorem. Why are you even using ntheorem with the settings you show in this example it sounds more like you are looking for amsthm` in which \newtheorem* does what you think and the proof env is already defined for you.
    – daleif
    Apr 13, 2021 at 13:56
  • @daleif I have made changes following your comment. Only the last problem left. Thanks.
    – User
    Apr 13, 2021 at 14:20
  • Note again that this proof env you provide is broken, the tombstore is not always at the right edge. I cannot help you with cleveref as I personnally never use it. Again you are problably better of using amsthm (note that my suggestion for proof with ntheorem above was missing the thmmarks option for ntheorem)
    – daleif
    Apr 13, 2021 at 14:35

1 Answer 1

1

I admit I am not sure why you want to use cleveref with this. If you are only using the no-number style then you are probably using the environment only once. And so there's really no need to automatically "detect" reference types! But since you asked for it, here it is.

\documentclass{article}

\usepackage{amssymb,latexsym,amsmath} 

\usepackage{ntheorem}
\usepackage{hyperref}
\usepackage[nameinlink]{cleveref}

\theoremstyle{nonumberplain}   % note 1
\theorembodyfont{\normalfont}
\theoremseparator{:}           % note 2
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}

\theoremsymbol{\ensuremath{\color{lightgray}\blacksquare}}
\newtheorem{proof}{Proof}

\Crefformat{lemma}{#2Lemma#3}   % note 3
\crefformat{lemma}{#2lemma#3}

\begin{document}

\begin{lemma} Here is the statement of the lemma.\label{lemma}
\end{lemma}
\begin{theorem}Here is the statement of the theorem.
\end{theorem}

\begin{proof}This is the proof of the theorem using \Cref{lemma}
\end{proof}
\end{document}
  1. Instead of using \newtheorem*, since you are going to need to define the proof environment anyway, and it looks like you are using more or less the same style for all of them, I specified the nonumberplain style.
  2. Instead of coding the colon in the theorem name, it is better to use the \theoremseparator to specify it.
  3. This is a difference between ntheorem and amsthm. In the latter, theorems created using \newtheorem* get no reference counter, and so cannot be cross referenced. With ntheorem the counter is still there, just suppressed from display. cleveref however does not detect the theorem style at all (in fact, it cares not what the style is). So you have to do it yourself by defining a corresponding \Crefformat and \crefformat. See section 8.2.1 of the cleveref manual for details on how this works.
1
  • Just in case: in the unlikely case that you don't care about the hyperlinks produced (in which case I doubly don't understand why you'd be using cleveref), you can just use \namecref and \nameCref to suppress the number. Apr 13, 2021 at 19:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .