BibTeX, biblatex and biberMaster thesis, urgent(!) natbib sort&compress does not work

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
MissE
Posts: 4
Joined: Thu Jun 19, 2014 12:22 pm

Master thesis, urgent(!) natbib sort&compress does not work

Post by MissE »

Hello,
I'm struggling with the natbib-package. I have spent an aweful lot of time on this problem, and it just won't work. After multiple citations, I want them to appear in a sorted and compressed manner, i.e [2-4,10,20-23] instead of [10,20,2,4,3,21,22,23]. I REALLY hope one of you can help me. I would be truly grateful!hope one of you can help me. I would be truly grateful!
I'm new to LaTeX,so please bear with me :-)

My source code is something like this:

Code: Select all

\documentclass[12pt]{report}
\usepackage{ramsstyle, float, acronym, pbox, color, xcolor, colortbl, hhline, rotating, enumerate, subfigure, caption, tocloft, url, footmisc, amsmath, multirow, amsfonts, array, caption, subfigure, setspace, inputenc, tikz} 

\hypersetup{linkcolor=black,citecolor=black,urlcolor=black}
\usepackage[square, numbers, comma, sort&compress]{natbib}

\begin{document}
        \cite{A, B, C, D}

\bibliographystyle{unsrtnat}
\bibliography{bibliography/bibl}

\end{document}
Thanks!
Miss E

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Master thesis, urgent(!) natbib sort&compress does not work

Post by Johannes_B »

I wuould like to help, but even if i extend your example to make it compilable, i can't see the behaviour you described.

Code: Select all

\documentclass[12pt]{report}
\usepackage{
% ramsstyle,%personalised class?
 float,%usually not needed
 acronym,
 pbox,
 color,%loaded by xcolor
 xcolor,
 colortbl,
 hhline,
 rotating,
 enumerate,
% subfigure,%obsolet
 caption,
 tocloft,
 url,
 footmisc,
 amsmath,
 multirow,
 amsfonts,
 array,
% caption,%Why are you loading those again?
% subfigure,
 setspace,
% inputenc,%useless without option
 tikz}
 \usepackage[T1]{fontenc}
%\hypersetup{linkcolor=black,citecolor=black,urlcolor=black}
 %you did not load hyperref
\usepackage[square, numbers, comma, sort&compress]{natbib}

\begin{document}
\cite{westfahl:space, aksin, angenendt, baez/article}

\bibliographystyle{unsrtnat}
\bibliography{biblatex-examples}

\end{document}
Best and safest way to find the cause is preparing a real minimal working example. Please follow the link if you need instructions.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
MissE
Posts: 4
Joined: Thu Jun 19, 2014 12:22 pm

Re: Master thesis, urgent(!) natbib sort&compress does not w

Post by MissE »

Hello Johannes_B,
thank you for your reply! :-) I figured out what is causing the problem: it's the ramsstyle package. If I leave it out, the citations appear like I wanted. The only problem is that by leaving it out, my thesis looks very ugly (Among other things: poor contrast and incorrect margin sizes). Is there a similar 'styling' package that I can use instead, compatible with natbib? Or is there a way to make ramsstyle compatible with natbib?
MissE
Posts: 4
Joined: Thu Jun 19, 2014 12:22 pm

Master thesis, urgent(!) natbib sort&compress does not work

Post by MissE »

By the way: I got the ramsstyle package from downloading a thesis template here (provided by my university):

https://www.ntnu.no/wiki/display/ross/L ... ter+Theses
MissE
Posts: 4
Joined: Thu Jun 19, 2014 12:22 pm

Re: Master thesis, urgent(!) natbib sort&compress does not w

Post by MissE »

Ok, problem solved! Seems like the ramsstyle package already included a natbib command. Anyway, thank you for making me aware of ramsstyle package, I never questioned it before now :-P
Post Reply