3

I have a very long list of citations in my TeX file. Rather than each bibliographic key appearing in the list, I would like a range of values, e.g. given

\cite{ref1,ref2,ref3,ref4}

I get

[1,2,3,4]

but would prefer

[1-4].

I am using TeX + Eplain + BibTeX. Any suggestions? I have tried using a few LaTeX packages (cite,mcite, and natbib), but (unsurprisingly) they all fail to load.

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
  • 1
    Have you already checked http://tex.stackexchange.com/questions/3871/citing-a-range-of-papers-using-numeric-keys? – Nico Feb 07 '14 at 16:40
  • Have you tried loading the cite package using an \input statement, i.e., as \input cite.sty %? – Mico Feb 07 '14 at 23:01
  • @Nico That post doesn't really work here as I am using plain TeX as opposed to LaTeX. – Doug Moore Feb 08 '14 at 05:03
  • @Mico That doesn't work as cite.sty is a LaTeX package and so it has macros that are not defined in TeX. – Doug Moore Feb 08 '14 at 05:04

2 Answers2

2

OPmac is plainTeX specific. You can use it. See this page.

\input opmac-bib

\sortcitations  % the cites are sorted in each \cite[a,b,c,d]
\shortcitations % the intervals [a--d] instead [a,b,c,d] are printed

Here is \cite[white,texbook,nierhaus,lech]
and \cite[demay,rowling].

\nonum\sec References

\rightskip=0em plus 5em
\usebib/s (iso690) op-example % op-example.bib plus iso690 bib style is used

\bye

The op-example.bib, opmac-bib.tex, opmac.tex and opmac-bib-iso690.tex files were used from this page (see the end of the page). You can try to process this example by pdftex document twice. No bibTeX is needed. All processing is done at TeX level. The result:

enter image description here

wipet
  • 74,238
0

If you compile with (pdf) latex, you can use biblatex with its numeric-comp or numeric-icomp citation styles ("comp" is for "compact"; choice to be given as an option in the preamble) together with the \cites and its siblings commands.

See the details in §3.3.1 and 3.7.3 of the documentation.

Bernard
  • 271,350
  • 1
    Note that OP uses plain TeX with eplain, not LaTeX. – morbusg Feb 07 '14 at 20:58
  • That's precisely why I wrote: if you compile with (pdf)latex, thereby meaning "perhaps you should consider using (pdf)latex". As far as I understand it, neither natbib nor (m)cite are plaintex sets of macros. – Bernard Feb 07 '14 at 21:24
  • @Bernard You are right at natbib and mcite are LaTeX specific. They won't work for me here. – Doug Moore Feb 08 '14 at 05:05