2

I am using this answer to create a proposition with custom numbering. This allows me to manually enter the proposition name/number. As it happens, my purpose in doing this is to create a "version b" of a proposition with standard numbering:

\usepackage{amsthm}
\usepackage{hyperref}
...
\newtheorem{innercustomthm}{Proposition}
\newenvironment{customthm}[1]
  {\renewcommand\theinnercustomthm{#1}\innercustomthm}
  {\endinnercustomthm}

\begin{document}

\begin{proposition}\label{prop:onlyifdirection}
First version of the proposition.
\end{proposition}

\begin{customthm}{\ref{prop:onlyifdirection}b}\label{prop:onlyifconstructive}
Second version of the proposition.\qed
\end{customthm}

\end{document}

It looks great. The original proposition comes out as 4.2 and the second version as 4.2b. My question is about how it interacts with the hyperref package. Right now, when I refer to the second version of the proposition with a

\ref{prop:onlyifconstructive}

if I click on the "b" it links to the second version but if I click on the "4.2" it passes through and links to the first version. I would like to accomplish the same visual / printed results but in such a way that whenever I call the

\ref{prop:onlyifconstructive}

the hyperref link is only to the second version of the proposition.

Now, I can certainly accomplish this by hardcoding the "4.2" rather than putting \ref{prop:onlyifdirection} in the label of the second version. But ideally there would be a way to do this that wouldn't have to be manually changed if the numbering changes.

How is this done?

1
  • Sorry, your code is not compilable and the question is unclear.
    – user31729
    Commented Feb 5, 2018 at 19:15

1 Answer 1

1

Specific to your application, you can use \ref* in your redefinition of the counter display which excludes the hyperlink for the reference:

enter image description here

\documentclass{article}

\usepackage{amsthm}
\usepackage{hyperref}

\newtheorem{proposition}{Proposition}
\newtheorem{innercustomthm}{Proposition}
\newenvironment{customthm}[1]
  {\renewcommand\theinnercustomthm{#1}\innercustomthm}
  {\endinnercustomthm}

\begin{document}

\begin{proposition}\label{prop:onlyifdirection}
First version of the proposition.
\end{proposition}

\begin{customthm}{\ref*{prop:onlyifdirection}b}\label{prop:onlyifconstructive}
Second version of the proposition.
\end{customthm}

See Propositions~\ref{prop:onlyifdirection} and~\ref{prop:onlyifconstructive}.

\end{document}
0

You must log in to answer this question.

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