3

I'm using the package proof for drawing deductions. The package supports labels. However, I'd like to have clickable cross-references to them. Is this possible? Note that I want the label to be a custom text, not a number. The package doesn't seem to have inbuilt support for cross-references (neither clickable nor non-clickable). Neither does the seemingly more comprehensive bussproof. Below's an example of intended use:

\documentclass{llncs}   %or {article}
\usepackage{proof}      %\infer

\begin{document}

\[
\infer[\mbox{mylabel}]{a : A}{a ~\mbox{exists}}
\]

As %\intendedrefto{mylabel} shows, ...

\end{document}
3
3

You can set the reference text yourself, since \label uses the current definition of \@currentlabel:

\documentclass{article}
\usepackage{proof}             

\makeatletter
\newcommand{\labelthis}[2]{%
  \def\@currentlabel{#2}\label{#1}#2%
}
\makeatother

\begin{document}

\[
\infer[\mbox{\labelthis{ml}{mylabel}}]{a : A}{a ~\mbox{exists}}
\]

As \ref{ml} shows, ...

\end{document}

enter image description here

If you are also using amsmath, you need to use \ltx@label instead of \label

\makeatletter
\newcommand{\labelthis}[2]{%
  \def\@currentlabel{#2}\ltx@label{#1}#2%
}
\makeatother
5
  • Thanks. Could you expand on the meaning of [2]{\def\@currentlabel{#2}\label{#1}#2}? – jaam Jun 13 '16 at 21:33
  • @jaam The macro has two arguments; #1 is used to set the label, #2 is the text that you want to be printed by \ref (so it's stored in \@currentlabel) and also in the formula. – egreg Jun 13 '16 at 21:44
  • I unaccepted the answer since I couldn't get the solution to work in my manuscript (my solution works but isn't ideal) – jaam Feb 12 '17 at 5:56
  • @jaam Unaccepting, in this case, seems unfair in my opinion. – Dr. Manuel Kuehner Mar 20 '18 at 19:02
  • @Dr.ManuelKuehner Well, at least it retained the upvote – jaam Mar 20 '18 at 19:07
1

Here's a solution:

\documentclass{llncs}
\usepackage{proof}      %\infer
\usepackage{mathtools}  %\tag   
\usepackage{hyperref}
\usepackage{xcolor}     %\color

\begin{document}

\begin{equation}\label{wha}
\infer[\mbox{mylabel}]{a : A}{a ~\mbox{exists}}
\color{white}{\tag*{mylabel}}
\end{equation}

As \ref{wha} shows, ...

\end{document}

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.