[Tex/LaTex] Biblatex-nature \textcite with superscript reference number

biblatexciting

My question is related to this question (shameless copy pasta of MWE).

I would like to obtain the same citation style,
so a \textcite that results in the author followed by a superscript reference.
The standard for biblatex-nature however is a "full sized" reference

\documentclass{report}

\usepackage[style=nature]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{ABib.bib}
@article {article1,
 AUTHOR = {Author, A. N.},
 TITLE = {A sample paper},
 JOURNAL = {Sample journal},
 VOLUME = {1},
 YEAR = {2013},
 NUMBER = {1},
 PAGES = {1--2}}
\end{filecontents}

\addbibresource{ABib.bib}

\begin{document}
Someone saw something \autocite{article1}.

\textcite{article1} saw something.
\end{document}

However, the answer given on the previous linked question gives the following error when used in combination with the style=nature command;

! Package biblatex Error: Bibliography macro 'cite' undefined.

Best Answer

Assuming you don't want 'auto-cite' magic, then

\makeatletter
\renewbibmacro*{textcite}{%
  \iffieldequals{namehash}{\cbx@lasthash}
    {\usebibmacro{cite:comp}}
    {\usebibmacro{cite:dump}%
     \ifbool{cbx:parens}
       {\bibclosebracket\global\boolfalse{cbx:parens}}
       {}%
     \iffirstcitekey
       {}
       {\textcitedelim}%
     \usebibmacro{cite:init}%
     \ifnameundef{labelname}
       {\printfield[citetitle]{labeltitle}}
       {\printnames{labelname}}%
     \addspace
     \ifnumequal{\value{citecount}}{1}
       {\usebibmacro{prenote}}
       {}%
     \mkbibsuperscript{\usebibmacro{cite:comp}}%
     \stepcounter{textcitecount}%
     \savefield{namehash}{\cbx@lasthash}}}
\makeatother

will do the job. This works for any style derived from numeric-comp (which includes the nature style): the compressed style uses a multi-part approach to the citation numbers so the 'simple' solution does not apply.

Note that this approach does not move punctuation if the citation comes for example at the end of a sentence.

Related Question