Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have several references like \cite{a,b,c,d,e} which produces an output like [1], [2], [3], [4], [5].

Is there a way to automatically generate the above as [1]-[5]?

share|improve this question
    
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. –  Joseph Wright Apr 17 '12 at 16:23
    
Use the style numeric-comp. –  Marco Daniel Apr 17 '12 at 16:24
    
possible duplicate of Combine reference citations –  Werner Apr 17 '12 at 16:27
    
@Werner: Not really ;-) [1]-[5] isn't the default output of numeric-comp. Of course you can use it as a basic. –  Marco Daniel Apr 17 '12 at 16:31
    
@Werner: It seems the OP uses numeric-verb and wants to combine its features and that of numeric-comp. –  lockstep Apr 17 '12 at 16:37
show 7 more comments

1 Answer

up vote 10 down vote accepted

Based on your rudimentary information I guess you are using the style numeric-verb (Thanks lockstep). First of all I recommend to use the style numeric-comp which has the following output as default:

[1-5]

To obtain this output, see Combine reference citations. However it seems that you request the format

[1]-[5]

This is also possible by a modification of the command \cite:

Here is the example:

\documentclass{article}
\usepackage[style=numeric-comp,backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}

\DeclareCiteCommand{\cite}[\mkbibbrackets]
  {\usebibmacro{cite:init}%
   \usebibmacro{prenote}}
  {%
   \renewrobustcmd*{\bibrangedash}{\bibclosebracket\textendash\bibopenbracket}%
   \usebibmacro{citeindex}%
   \usebibmacro{cite:comp}}
  {}
  {\usebibmacro{cite:dump}%
   \usebibmacro{postnote}}

\begin{document}
\section{foo}
\cite{companion,knuth:ct,knuth:ct:a,knuth:ct:b,knuth:ct:c}

\parencite{companion,knuth:ct,knuth:ct:a,knuth:ct:b,knuth:ct:c}


\printbibliography
\end{document}

Compile with

(pdf)latex
biber
(pdf)latex
(pdf)latex

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.