I want to access the reference number directly, without making use of natbib or bibtex, but it doesn't work, it always adds the brackets [] around the number.
The reason: for multiple citations it is nice to write [1-3] instead of [1,2,3]. How can I get [1-3] with thebibliography alone?
// solution: adding the package cite via \usepackage{cite} in the preamble automatically converts citations from [1,2,3] to [1-3] which is what I wanted.
Here is the MWE:
\documentclass[12pt, letterpaper]{article}
\usepackage[colorlinks=true]{hyperref}
\begin{document}
Here is a sentence that refers to Refs.~\cite{ref1,ref2,ref3}.
I would also like to refer to these references as [1--3].
The closest I can get is \cite{ref1}--\cite{ref3}.
\begin{thebibliography}{5pt}
\bibitem{ref1}
J.~Doe, Some title 1.
\bibitem{ref2}
J.~Doe, Some title 2.
\bibitem{ref3}
J.~Doe, Some title 3.
\end{thebibliography}
\end{document}

natbiborbiblatex? – leandriis Jul 15 '19 at 19:19citepackage be an option for you? – leandriis Jul 15 '19 at 19:20--as well as[and]manually. A good solution™ would automatically sort and compress the citation, so that you don't have to worry about doing that. It is possible to write the code to do that, people have done so already and have even gone through the process of producing a package that is available for everyone to use (thecitepackage and alsonatbib), so if this question is just about compressed citations, I strongly suggest you load one of those packages. ... – moewe Jul 15 '19 at 19:31citeand to some extent evennatbibdon't rely on your using.bstfiles, they can be used with a manualthebibliography. So the fact that you want to usethebibliographyis no obstacle here. If there are other reasons why you don't want to useciteornatbibthat go beyond what I speculated here, a manual approach might be justified, but it should really be the last resort. – moewe Jul 15 '19 at 19:345ptlooks odd as the argument ofthebibliography. The mandatory argument tothebibliographyshould be the longest label in the bibliography, it should not be the width of the longest label (that is to say it should be text and not a length). In case you only have three bibliography items and you use the standard Computer Modern or Latin Modern font you could use any of1,2and3as argument (since all digits have the same width in those fonts). But if you have 12 entries, the argument should be10,11or12. See https://tex.stackexchange.com/q/198330/35864 ... – moewe Jul 15 '19 at 19:38