4

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.
  • Could you try \usepackage[backend=bibtex,style=nature]{biblatex} this? – Aung Feb 25 '14 at 15:44
  • @Aung Nothing to do with it: the backend doesn't really make a difference, and certainly never with BibTeX 'better' than Biber. – Joseph Wright Feb 25 '14 at 15:52
3

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.

  • This method doesn't work if you have multiple citations inside \textcite{article1, article2} (or \textcites{article1, article2}). It will print Author A and Author B then the first number in superscript, but will then print the delimiter and any subsequent reference numbers as normal text. – tmgriffiths Dec 14 '16 at 4:03
  • This solution works for me. I would like to add square brackets to the superscripted reference numbers. How can I do that? – Godey Jun 6 '18 at 7:53
  • I solved my issue by replacing these lines \mkbibsuperscript{% \bibopenbracket %added to get bracket[ \usebibmacro{cite:comp}% \bibclosebracket} % added to get bracket]. Don't know if it'll cause any other issues yet – Godey Jun 6 '18 at 8:49

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.