5

I have a document in which I have a named proposition, which I wish to reference by its acronym. Since it is named, it ought not be numbered. Still, I'd like to reference it using a cross-reference, rather than hard-coding the acronym, in case I change it (so it gets updated everywhere) or remove it (so I get a warning).

The best I've been able to come up with uses a combination of thmtools, cleveref and manual definitions of the cleveref reference format and of the representation of the relevant LaTeX counter.

All of this seems rather circuitous and - at least in the case of the counter, which I don't even need - unnecessary. However, no simpler approach seems to work.

Dropping the following are NOT really viable options for me at this point as lots now depends on them: mathtools, amsthm and cleveref.

However, thmtools can be dropped if, for some reason, a nicer solution is possible without it. (I only started using it to try to deal with this case - I can easily revert to plain amsthm.)

Loading hyperref is NOT an option, as I can't submit a paper to a journal if it's got hyperlinks. So, even if this would help, I can't use such an approach.

MWE:

\documentclass{article}
\usepackage{mathtools,amsthm,thmtools,cleveref}
\declaretheorem[numbered=yes, name=Big Friendly Giant, refname={BFG,BFG}]{bfg}
\crefformat{bfg}{#2BFG#3}
\let\thebfg\unskip

\begin{document}
\begin{bfg} Big Friendly Giant theorem \label{thm:bfg}
\end{bfg}

Here's a reference: \cref{thm:bfg}.
\end{document}

output (target and desired)

Note that this output is both what I get and what I want. What is the most elegant way to get it?

If I use numbered=no or numbered=unless unique, I get an unnumbered proposition (good), but no cross-reference (bad). If I don't redefined \thebfg, I get a cross-reference (good), but a numbered proposition (bad). If I set \thebfg to \relax, I get an unwanted space, which \unskip gets rid of. And so on. That is, hackish though this code is, it is the most elegant - or the least inelegant - I've been able to come up with.

4
  • You approach will produce any reference to a bfg theorem/proposition as BFG then; I do not think that this is what you have in mind? As another solution I suggest to use a normal environment that only 'fakes' the look of a theorem.
    – user31729
    Sep 24 '17 at 20:48
  • I mean 'your approach' of course... sorry about that typo
    – user31729
    Sep 24 '17 at 21:39
  • @ChristianHupfer No, that really is what I have in mind. That is, the code I posted does what I want. It just seems a very circuitous way of doing it.
    – cfr
    Sep 24 '17 at 22:43
  • @ChristianHupfer That is, it might be more convenient to have a more generic environment, of course, such that the tag was specified on each use. My approach requires a distinct theorem type for each named result. However, since I only have one such result in my actual document, this aspect isn't really a big deal.
    – cfr
    Sep 24 '17 at 22:44
2

I'm not quite sure that I did understand the question. But I would probably do something like this:

\documentclass{article}
\usepackage{mathtools,amsthm,thmtools}
\makeatletter
\declaretheorem[numbered=no,name=Big Friendly Giant, postheadhook=\def\@currentlabel{BFG}]{bfg}

\begin{document}
\begin{bfg}[label=thm:bfg] Big Friendly Giant theorem 
\end{bfg}

Here's a reference: \ref{thm:bfg}.
\end{document}

enter image description here

2
  • Thanks. So use \ref rather than \cref? I guess I could do that, provided this still works with cleveref loaded. It isn't quite as seamless as using \cref, but certainly doable.
    – cfr
    Dec 8 '17 at 17:20
  • No, \ref is not the main point. The main point is to define \@currentlabel. I only removed the \cref definitions as I didn't really understand their purpose. Dec 8 '17 at 17:56

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.