0

My preferred citation style using biblatex is the numeric-comp style with theautocite=superscript option. However occasionally I need to refer to a specific reference in text and thus would like to switch to something like authoryear in this instance.

Using \textcite just negates the superscript option. Is it possible to write a new function that allows me to mix the two citation styles?

MWE:

\documentclass{report}

\begin{filecontents}{example.bib}
@article {Example_article,
 AUTHOR = {Author, A. B.},
 TITLE = {A example paper},
 JOURNAL = {Example journal},
 VOLUME = {1},
 YEAR = {2018},
 NUMBER = {1},
 PAGES = {1-100}}
\end{filecontents}

\usepackage[style=numeric-comp,
      autocite=superscript,
      backend=biber
]{biblatex}

\addbibresource{example.bib}

\begin{document}

I normally cite like this \autocite{Example_article} which is great but sometimes I want to do this \textcite{Example_article} but it doesn't seem to to work.

\end{document}

This produces:

I normally cite like this1 which is great but sometimes I want to do this Author [1] but it doesn’t seem to to work.

when what I would like is:

I normally cite like this1 which is great but sometimes I want to do this Author (2018) but it doesn’t seem to to work.

preferably only one author et al. (year) is listed when there are multiple authors.

  • 1
    It doesn't make sense to use Author (2018) unless there's a bibliography entry labelled something like Author, First names (2018). What would the label refer to? Author-year is just like a numerical style: it uses labels in the text and those labels match sources in the bibliography. If nothing is labelled that way, it makes no sense to use the label in the text. Also, the bibliography is organised to make the labels easy to find: 1, 2 ... for numeric; A, B ... fro author-year. – cfr Feb 16 '18 at 3:29
  • I see your point in that they are conflicting series of labeling. However to refer to something in text as "reference [1]" as in "as discussed by reference [1]" seems jarring as the number 1 is only assigned to it in the context of my document while Author (2018) specifies attributes that are specific to the document. I guess I'm not necessarily looking for a "citation" as much as a method to link text to a specific bibliography entry which after all has the author and year specified following the 1. – G_T Feb 16 '18 at 3:44
  • 1
    The way \textcite does it is right. If I want to follow up the reference, I expect you to tell me the label which is assigned to that reference in your bibliography. I don't expect to have to trawl through half a dozen pages of sources searching for the relevant one. And it isn't about saying by reference. \textcite will give you by Author. It will just also give you the label rather than some fragment of the content of an entry with a label you don't bother to share. The point of these systems is to make it easy to find stuff. If the year's important, include it, but also the label. – cfr Feb 16 '18 at 4:26
3

It is in general a better idea to define a new command via \DeclareCiteCommand instead of lumping together several \cite... commands in a \newcommand. While you may not see the benefits for your particular use case, it is a good idea to avoid bad habits. The \newcommand approach can go wrong especially in cases with pre- and postnotes or if you want to cite several sources at once.

\documentclass{report}

\usepackage[style=numeric-comp,
      minbibnames=3,
      maxbibnames=5, 
      maxcitenames=2, 
      mincitenames=1,
      autocite=superscript,
      backend=biber,
      labeldateparts,
]{biblatex}

\usepackage{hyperref}

\newbibmacro{aycite}{%
  \printtext[bibhyperref]{%
    \printnames{labelname}%
    \setunit{\addspace}%
    \printtext[parens]{%
      \ifnumequal{\value{citecount}}{1}
        {\usebibmacro{prenote}}
        {}%
      \printlabeldate
      \setunit{\addsemicolon\space}%
      \printtext{ref\adddot}%
      \setunit{\addspace}%
      \printfield{labelprefix}%
      \printfield{labelnumber}%
      \ifnumequal{\value{citecount}}{\value{citetotal}}
        {\usebibmacro{postnote}}
        {}}}}

\DeclareCiteCommand{\aycite}
  {}
  {\usebibmacro{citeindex}%
   \usebibmacro{aycite}}
  {\multicitedelim}
  {}

\addbibresource{biblatex-examples.bib}

\begin{document}
How about this where \aycite{sigfridsson} discus a topic.

How about this where \aycite[cf.][1]{sigfridsson} discuss a topic.

How about this where \aycite{sigfridsson,worman} discuss a topic.

\printbibliography
\end{document}

enter image description here

0

I have come up with an answer which I think is satisfactory. In the process these two questions were helpful: Question 1 and Question 2

I should also say I agree with the comments from @cfr about reference labels but this was not at the top of my mind as I usually use the hyperref package so citations and references are linked. I usually just click on citations as opposed to using them as keys in a reference table. I have thus incorporated the labels into my solution.

This is what I've got:

\documentclass{report}

\begin{filecontents}{example.bib}
@article {Example_article,
 AUTHOR = {Author, A. B.}, 
 TITLE = {A example paper},
 JOURNAL = {Example journal},
 VOLUME = {1},
 YEAR = {2018},
 NUMBER = {1},
 PAGES = {1-100}}
\end{filecontents}

\usepackage[style=numeric-comp,
      minbibnames=3,
      maxbibnames=5, 
      maxcitenames=2, 
      mincitenames=1,
      autocite=superscript,
      backend=biber
]{biblatex}

\usepackage{hyperref}

\DeclareCiteCommand{\tabcite}
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}%
   \usebibmacro{postnote}}

\addbibresource{example.bib}

\newcommand{\citelink}[2]{\hyperlink{cite.\therefsection @#1}{\citeauthor{#1} (\citeyear{#1}; ref. \tabcite{#1})}}

\begin{document}


How about this where \citelink{Example_article}{} discusses a topic.


\printbibliography

\end{document}

which produces:

How about this where Author (2018; ref. 1) discusses a topic.

which links to the appropriate bibliography reference.

  • It makes little sense to define \citelink to take two arguments, when it only uses one. Now you always need to carry around an empty argument. Defining a new command that expands to \citeauthor{#1} (\citeyear{#1}; ref. \tabcite{#1}) is really bad practice. Check out what happens if you cite two entries with \citelink{sigfridsson,worman}{}. You'll also find that this approach does not support pre and postnotes at all. – moewe Feb 16 '18 at 6:53
  • In what way is it bad practice and how could it be improved? From my perspective it solves the problem I had which is to refer to "a specific reference in text" so naturally the need for multiple entries does not arise and I do not envision having to use pre-and postnotes. – G_T Feb 16 '18 at 7:46
  • The multiple arguments is a consequence of copy/pasting code from the linked question and not understanding what exactly each component did. – G_T Feb 16 '18 at 7:48
  • You might not need multiple citation and pre- and postnotes here. But imagine you need them for a different cite command you want to write and you remember this answer and adapt it: things will not work as expected. The easiest answer is not always the best answer especially if one thinks about extending it for other cases. – moewe Feb 16 '18 at 8:24

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.