1

I am using biblatex and would like to define a new command like \textcite but with a freely configurable number of authors printed. In the rest of the document I still want to use the global configurations, e.g., the global maxcitenames.

Here is a small example:

\documentclass{article}
\usepackage[citestyle=numeric-comp,bibstyle=numeric,backend=biber,maxcitenames=1,maxbibnames=10]{biblatex}
\begin{filecontents}{ref.bib}
@BOOK{test1,
  AUTHOR    = {Author, A. and Buthor, B. and Cuthor, C. and Duthor, D.},
  TITLE     = {Test},
  YEAR      = {2000},
}  
\end{filecontents}
\addbibresource{ref.bib}

\newcommand{\textcitenew}[1]{\AtNextCite{\defcounter{maxnames}{#1}}\textcite}

\begin{document}
Reference to \textcite{test1} and \textcitenew{3}{test1}.
\printbibliography
\end{document}

The desired output is Reference to Author et al. [1] and Author, Buthor, Cuthor et al. [1].

The actual output is Reference to Author et al. [1] and Author et al. [1].

Reference to Author et al. 1 and Author et al. 1.

I assume, a good solution would be to locally change maxcitenames, which unfortunately does not lead to the desired result in the example.

Clarification: I want the number of authors printed to be exactly equal to the argument of the new command (without truncation).

1 Answer 1

0

Adaptations

Result

enter image description here

Code

\documentclass{article}
\usepackage[citestyle=numeric-comp,bibstyle=numeric,backend=biber,maxcitenames=1,maxbibnames=10]{biblatex}
\begin{filecontents}{ref.bib}
@BOOK{test1,
  AUTHOR    = {Author, A. and Buthor, B. and Cuthor, C. and Duthor, D.},
  TITLE     = {Test},
  YEAR      = {2000},
}  
\end{filecontents}
\addbibresource{ref.bib}

\makeatletter
\newrobustcmd*{\setmincitenames}{\numdef\blx@mincitenames}
\newrobustcmd*{\setmaxcitenames}{\numdef\blx@maxcitenames}
\makeatother
\newcommand{\textcitenew}[2]{{\setmincitenames{#1}\setmaxcitenames{#1}\textcite{#2}}}

\begin{document}
\textcite{test1}

2: \textcitenew{2}{test1}

3: \textcitenew{3}{test1}

4: \textcitenew{4}{test1}

\printbibliography
\end{document}
2
  • Thank you! I've added a clarification my question: I want the number of printed authors to be exactly equal to the argument of the new command \textcitenew without truncation. So this could be achieved by adding \setminbibnames{#1} to your command and by defining \newrobustcmd*{\setminbibnames}{\numdef\blx@mincitenames}. Please feel free to add this code to your answer, so that I can accept it (or post a better solution if there is one).
    – chillibaba
    Sep 17, 2022 at 15:50
  • @chillibaba I edited the answer.
    – dexteritas
    Sep 17, 2022 at 20:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .