3

I'm working on a paper where the default citation style is a super script.

But in some parts of my text i like to put something like this:

....then more info see Ref[23].....

so in my doc with the paper bib style i get

enter image description here

what i want is get this

enter image description here

of course i can do it by hand but I'm wondering if there is an equivalent of \theequation coomand, thus I can type something like:

some text\cite{ref23} ..... see also [\thecite]
Jared Lo
  • 652
  • Can you please add a minimal working example so that people can see what packages etc you need to get your code to work (but don't add code that is not needed). In this case it would be helpful to see how you can achieve what you want "by hand". –  Sep 02 '14 at 03:34
  • 1
    This really depends on the citation package you might be using. You could try to mimic what \cite does using \makeatletter \newcommand{\getcitenumber}[1]{\@ifundefined{b@#1}{\hbox{\reset@font\bfseries ?}}{\csname b@#1\endcsname}} \makeatother and then using \getcitenumber{<cite>} wherever you need the number printed, but I'm not sure if it will work. – Werner Sep 02 '14 at 05:06

1 Answers1

4

The traditional \cite{<cite>} command tests for the existence of a macro \b@<cite> - yes, a citation is just a macro definition. The test is necessary because, like the \label-\ref system, it uses the .aux file for handling them and could be non-existent depending on your compilation. However, if the macro \b@<cite> exists, it sets it using a \csname...\endcsname construction. We can mimic this with

\makeatletter
\newcommand{\getcitenumber}[1]{% \getcitenumber{<cite>}
  \@ifundefined{b@#1}% Check if <cite> exists
    {\hbox{\reset@font\bfseries ?}}% <cite> doesn't exist; print ?
    {\csname b@#1\endcsname}}% <cite> exists; print `\b@<cite>
\makeatother

and use \getcitenumber{<cite>} wherever you wish to print the citation.

The above suggestion may be heavily dependent on the citation package you're using.

Werner
  • 603,163
  • I found the answer of you a couple of days ago and it was working like a charm. However, now, sometimes it works, sometimes not on overleaf? To make it work again: select your code -> ctrl +c -> delete -> ctrl+v. weird. – WhoCares Mar 11 '21 at 08:24