moewew / biblatex-trad

traditional bibliography styles with biblatex
LaTeX Project Public License v1.3c
31 stars 7 forks source link

How to compress cites? #36

Closed eboigne closed 1 year ago

eboigne commented 1 year ago

Hello,

Thanks for the contribution, working great for my thesis! I'm looking to use the "compress" bib option, with which [1,2,3,4] becomes [1-4]. I couldn't make it work with biblatex options. I'm using:

\usepackage[backend=bibtex,sorting=none,style=trad-abbrv,citestyle=numeric,sortcites=true]{biblatex}

In biblatex, it seems that compressing is done by using the compact "-comp" version of the desired style: https://www.overleaf.com/learn/latex/Biblatex_citation_styles, https://tex.stackexchange.com/questions/61524/sort-but-do-not-compress-numeric-citations-in-biblatex. Is there any chance you'd have that option for these native styles? I'm particularly interested in trad-abbrv-comp. Thanks in advance!

moewew commented 1 year ago

The .cbx files (i.e. the citation styles of this bundle) are just imports of the standard biblatex base styles (numeric for and trad-abbrv, trad-plain and trad-unsrt and alphabetic for trad-alpha), so you don't lose anything if you explicitly select a different citestyle (as you did already). Just go with citestyle=numeric-comp,.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=bibtex, style=trad-abbrv, citestyle=numeric-comp, sorting=none,]{biblatex}

\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite{sigfridsson,worman,geer,nussbaum}

\printbibliography
\end{document}

Lorem [1–4]

eboigne commented 1 year ago

Understood, this works great! Thanks for the quick help.