8

I would like to typeset the citation number produced by \textcite as a superscript number, rather than enclosed by brackets, in line with the rest of my document. Is it possible to typeset "Author ^1" when autocite is set to superscript rather than the default "Author 1"?

\documentclass{report}

\usepackage[backend=bibtex8,autocite = superscript]{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}

The problem: references are different

  • You want \autocite, \textcite both to give superscripts for references ? You do not want to use \supercite (which prints superscripted references) ? – ach May 17 '13 at 19:56
  • @ach: I would like the citation number that is at the end of \textcite to be superscript (since the superscript option is chosen for biblatex). The MWE produces a "^1" for the \autocite but \textcite produces an inline style reference number "[1]" after the author name and year. I would have expected \textcite to typeset the reference number using the same style as the other citations. – Chris May 17 '13 at 20:41
  • I added an image which shows the issue. – Paul Stanley May 17 '13 at 21:15
11

I think this will do the job: it's largely a matter of copying the definitions pertinent to \supercite into the commands that define \textcite. Please note that I have "hardwired" this, in other words it will not adapt automatically to changes in "autocite", so if you stopped using "autocite=superscript" you would need to delete the redefinitions too.

Also, as with other superscript references, pre- and postnotes are not printed, but a warning is written to the log.

\documentclass{report}

\usepackage[backend=bibtex8,autocite = superscript]{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}

\makeatletter
\renewbibmacro*{textcite}{%
  \iffieldequals{namehash}{\cbx@lasthash}
    {\mkbibsuperscript{\supercitedelim}}
    {\cbx@tempa
     \ifnameundef{labelname}
       {\printfield[citetitle]{labeltitle}}
       {\printnames{labelname}}}%
  \ifnumequal{\value{citecount}}{1}
    {}
    {}%
  \mkbibsuperscript{\usebibmacro{cite}}%
  \savefield{namehash}{\cbx@lasthash}%
  \gdef\cbx@tempa{\addspace\multicitedelim}}%

\DeclareCiteCommand{\textcite}
  {\let\cbx@tempa=\empty
   \undef\cbx@lasthash
   \iffieldundef{prenote}
     {}
     {\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}
     {}
     {\BibliographyWarning{Ignoring postnote argument}}}
  {\usebibmacro{citeindex}%
   \usebibmacro{textcite}}
  {}
  {}
\makeatother

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

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

Producing:

enter image description here

  • It is surprising to me that this is not the default behaviour for this set of options. The code you provided does the job I need though so thank you. – Chris May 17 '13 at 21:31
  • 1
    Wouldn't using \let\textcite=\autocite achieve the same result? – fabikw Jan 19 '15 at 3:25
  • Is there a way to give parencite the same effect? – kennyB Jun 27 at 5:24
3

Another easier possibility if using the natbib and biber options in the biblatex package is this:

\usepackage[
    backend=biber,
    style=chem-acs,
    sortlocale=de_DE,
    natbib=true,
    url=false, 
    doi=true,
    eprint=true,
    autocite=superscript
]{biblatex}
\newcommand{\authorcite}[1]{\citeauthor{#1}\,\supercite{#1}}


\authorcite{CitationKey} 

will result in Author1 and Author^1

  • Note that the method of defining citation commands by putting two or more \cite* commands together into a \newcommand has several shortcomings. It does not support pre- or postnotes (though that could be remedied, I suppose), and it does not support citation of several works at the same time properly. So generally, a \DeclareCiteCommand is to be preferred. – moewe Aug 10 '16 at 14:35
  • 1
    @moewe Still, it's much simpler than the accepted solution, if you are looking for a fast hack. I'm giving it a like. Haven't seen any problems in practice. – Dr_Zaszuś Sep 10 at 12:15
  • @Dr_Zaszuś I'm well aware that people gravitate towards shorter (and simpler or easier-to-understand) solutions and that the two answers here are a prime example of this. For most uses people will probably not happen upon or care about the drawbacks of the specific solution here. Still it is important to me to have warned people about that, especially since the general approach of putting together several \cite... commands can be seen more often and always has structurally similar shortcoming that can manifest itself in more or less problematic ways. ... – moewe Sep 12 at 6:18
  • ... What you do with my advice is completely up to you. – moewe Sep 12 at 6:19

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.