BibTeX, biblatex and biberclassicthesis, natbib | Sorted and compressed Citations

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
mble
Posts: 4
Joined: Fri Apr 20, 2012 12:20 pm

classicthesis, natbib | Sorted and compressed Citations

Post by mble »

Hello Dear LaTex users,

I’m writing PhD thesis with Lyx 2.0.3 and ClassicThesis-LyX-v4.0 template. The citation format is governed by Natbib numerical style. I wanted to have my references number sort and compressed, it means: [2-5,11] instead of [2, 3, 4, 5, 11], but unfortunately I’m struggling two days to obtain this.

I tried in main classicthesis file(ClassicThesis.lyx) to add in Document/Settings/LaTeX Preamble and then

Code: Select all

 \usepackage[sort&compress]{natbib}

I tried to change in classicthesis-config.tex:

Code: Select all

\PassOptionsToPackage{square,numbers}{natbib}
 \usepackage{natbib}
to

Code: Select all

\PassOptionsToPackage{square,numbers,sort&compress}{natbib}
 \usepackage{natbib}
Google gives http://www.mail-archive.com/lyx-users@l ... 54936.html :
under Document Class->Class Settings->Options you enter "sort&compress".
So, I tried to Document/Settings/Document Class and in field Class option Custom I entered "sort&compress".

All this is not working. Have Anyone idea how to solve this problem?

I would really appreciate any help!

Thanks!
Michal

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

mble
Posts: 4
Joined: Fri Apr 20, 2012 12:20 pm

classicthesis, natbib | Sorted and compressed Citations

Post by mble »

This problem can be solved by switching to default citation manager. Then one can edit classicthesis-config.tex and change options here:

Code: Select all

\PassOptionsToPackage{square,numbers}{natbib}
     \usepackage{natbib}
Explanation:
when you choose natbib as your citation manager, LyX adds a line

Code: Select all

\usepackage[numbers]{natbib}
to the preamble. AFTER that classicthesis-config.tex is loaded, having two lines

Code: Select all

\PassOptionsToPackage{square,numbers}{natbib}
     \usepackage{natbib}
that once again try to configure natbib. But doing so is not allowed in LaTeX, so these two lines are ignored.
However, when you use Default (numerical) in LyX, than NO package is loaded from LyX, and natbib IS only configured and started from classicthesis-config.tex.

Finally, let me explain what happens when you put a custom class option into the respective field in LyX: these global options are forwarded to each and every package that is loaded afterwards, and this one simply meets natbib when it is called.

I would like to thank person, who helped me to solve it ;)

Regards,
Michal
Post Reply