1

I found how to make \supercite with square brackets and grouped at Biblatex supercite with square brackets and grouped

So I add the option autocite=superscript for biblatex package, and get this MWE:

\documentclass{article}

\usepackage[autocite=superscript,citestyle=numeric-comp]{biblatex}


\DeclareCiteCommand{\supercite}[\mkbibsuperscript]
  {\usebibmacro{cite:init}%
   \let\multicitedelim=\supercitedelim
   \iffieldundef{prenote}
     {}
     {\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}
     {}
     {\BibliographyWarning{Ignoring postnote argument}}%
  \bibopenbracket}%
  {\usebibmacro{citeindex}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}\bibclosebracket}

\usepackage{filecontents}

\begin{filecontents}{test.bib}
@book{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
@book{B02,
  author = {Buthor, B.},
  year = {2002},
  title = {Bravo},
}
@article{C03,
  author = {Cuthor, C.},
  year = {2003},
  title = {Charlie},
}
\end{filecontents}

\addbibresource{test.bib}

\begin{document}

We are citing \autocites{A01}{B02}{C03} and \autocites{A01}{C03} and \autocites*{A01}{B02}.

\printbibliography

\end{document}

But the number is not grouped. I get [1],[2],[3] instead of [1-3].

2

The issue here is twofold.

  1. You can get better results by moving the brackets into the wrapper command instead of the pre- and post-code and doing the same thing for the multicite command.

  2. The multicite commands do not sort or compress citations across different groups. See also https://github.com/plk/biblatex/issues/817 (there are inelegant workarounds available as the last post in the linked discussion shows).

For now, all I can offer is

\documentclass{article}

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

\newrobustcmd*{\mkbibbracketedsuperscript}[1]{%
  \mkbibsuperscript{\mkbibbrackets{#1}}}

\DeclareCiteCommand{\supercite}[\mkbibbracketedsuperscript]
  {\usebibmacro{cite:init}%
   \let\multicitedelim=\supercitedelim
   \iffieldundef{prenote}
     {}
     {\BibliographyWarning{Ignoring prenote argument}}%
   \iffieldundef{postnote}
     {}
     {\BibliographyWarning{Ignoring postnote argument}}}%
  {\usebibmacro{citeindex}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}}

\DeclareMultiCiteCommand{\supercites}[\mkbibbracketedsuperscript]
  {\supercite}{\supercitedelim}

\addbibresource{biblatex-examples.bib}

\begin{document}
We are citing \autocites{sigfridsson}{worman}{nussbaum} and \autocites{sigfridsson}{nussbaum} and \autocites*{sigfridsson}{worman}.

We are citing \autocite{sigfridsson,worman,nussbaum} and \autocite{sigfridsson,nussbaum} and \autocite*{sigfridsson,worman}.

\printbibliography
\end{document}

enter image description here

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.