Text Formatting[1,2,3,4,5] into [1-5] WITHOUT adding packages (i.e. natbib)

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
Successful
Posts: 5
Joined: Fri Nov 07, 2008 10:54 pm

[1,2,3,4,5] into [1-5] WITHOUT adding packages (i.e. natbib)

Post by Successful »

This problem is frustrating the heck out of me. How can i turn [1,2,3,4,5] into [1-5] WITHOUT using bibtex, natbib, citep, mcite, etc. ???? It is imperative that I not use anything but the most basic of LaTeX commands. i.e.

\begin{thebibliography}{99}
\bibitem{Author} asdfasdfasdf
\end{thebibliography}

I can't figure out how to get that hyphen in there.

right now i'm using

Code: Select all

~\cite{Kooij, Muskens2006, Kreibig, BohrenHuffman, vandeHulst}
to get it in there, but i need it to show up as [1-5]. all my references are in order of appearance and I read somewhere that latex will automatically put the hyphen in there if it "sees" the references in numerical order, but this is not happening here. i'm just getting commas. How do I get that hyphen in there without manually coding it, without bibtex, and without any other packages? (is this even possible?)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

Re: [1,2,3,4,5] into [1-5] WITHOUT adding packages (i.e. natbib)

Post by josephwright »

The LaTeX \cite command just can't do "compressed" citations, sorry. Hence the cite package (which makes only a few changes to how \cite works). If you really don't want to load cite for some reason (you don't say why you can't use a package), then you can either:
- Copy the relevant parts of cite into you file
- Do the citation by hand

Sorry that this is probably not what you wanted to hear.
--
Joseph Wright
Post Reply