3

I define a basic hypothesis called "Hyp A", using theorem environment, and also give it a label (say Hyp_A).

Then when I refer to this hypothesis, how to display something like "Let X and G satisfy Hyp A...", where "Hyp A" should link to the original definition of this hypothesis?

My method is as follow.

\newtheorem*{hyp}{} %I don't want the counter.

\begin{hyp} [\textbf{Hyp A}] \label{Hyp_A}

...

\end{hyp}

\nameref{Hyp_A}

Then I can have the following:

enter image description here

I don't like that parenthesis for the consistency reason.

Does any have suggestion to solve this problem?

Thanks in advance!

5
  • 2
    Welcome to TeX.SX! Contrary to what you say, you do want the number! Just change its representation to be alphabetic: \newtheorem{hyp}{Hyp} and \renewcommand{\thehyp}{\Alph{hyp}}. Now Hyp~\ref{Hyp_A} will do. – egreg Sep 2 '15 at 13:56
  • If you want to have \ref return names instead of numbers, that can be done too (just not using \label). – John Kormylo Sep 2 '15 at 19:16
  • @JohnKormylo, Thanks, but what's your meaning of "just not using \label"? – Fei Hu Sep 3 '15 at 3:40
  • @egreg Thanks! It is helpful for me. Instead of comment, I use \newtheorem{hyp}{} and \renewcommand{\thehyp}{Hyp \thehyp}. Then \ref{Hyp_A} works well. – Fei Hu Sep 3 '15 at 3:55
  • See tex.stackexchange.com/questions/236626/… . The hyperref version is slightly more complicated. – John Kormylo Sep 3 '15 at 14:21
2

Rather than manually numbering the environments, you should simply change the related counter's representation:

\documentclass{article}
\usepackage{amsthm}

\newtheorem{hyp}{Hyp}
\renewcommand{\thehyp}{\Alph{hyp}}

\begin{document}

\begin{hyp}\label{hyp-flat}
The Earth is flat.
\end{hyp}

Assuming Hyp~\ref{hyp-flat} we now prove that pigs can fly.

\end{document}

There's also the possibility of using cleveref:

\documentclass{article}
\usepackage{amsthm}
\usepackage{cleveref}

\newtheorem{hyp}{Hyp}
\renewcommand{\thehyp}{\Alph{hyp}}
\crefname{hyp}{Hyp}{Hyp} % always uppercase       

\begin{document}

\begin{hyp}\label{hyp-flat}
The Earth is flat.
\end{hyp}

Assuming \cref{hyp-flat} we now prove that pigs can fly.

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.