6

I use the semantic package for displaying natural deduction-style inference rules in equations. The \inference command has an optional argument which can be used to tag rules:

\inference[Rule1]{A}{B}

When I use the inference rule in an equation of amsmath environment, I would like to be able to label the inference rule and use 'Rule1' as the reference name in the rest of the document. However, if I use \tag{Rule1}/\tag*{Rule1} the equation tag is (of course) displayed too. I've tried various ways of making the tag invisible, but since the \tag command does not itself render anything, nothing seems to work.

Is there a way to hide the equation tag but still tell LaTeX to use a custom tag name whenever the label is referenced?

4

You could do something like this:

\documentclass{article}
\usepackage{amsmath}
\usepackage{semantic}

\makeatletter
\def\@inferenceFrontName[#1]{%
  \def\@currentlabel{#1}%
  \ltx@label{semantic\detokenize{#1}}%
  \setbox3=\hbox{\footnotesize #1}%
  \ifdim \wd3 > \z@
    \unhbox3%
    \hskip\@@nSpace
  \fi
  \@inferenceMiddle
}
\newcommand{\ruleref}[1]{\ref{semantic\detokenize{#1}}}
\makeatother

\begin{document}

\begin{equation*}
\inference[Rule1]{A}{B}
\end{equation*}

\ruleref{Rule1}

\end{document}

enter image description here

| improve this answer | |

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.