GeneralRefrences section getting 2 lines in TOC

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
KMnO4aq
Posts: 7
Joined: Fri Jan 17, 2014 12:37 am

Refrences section getting 2 lines in TOC

Post by KMnO4aq »

Hello! I am working on my thesis, and for some reason my toc is giving the final section in my chapter, references, two lines (see pic).

My best guess is that my custom sty is messing something up. I have edited one passed down through the generations. It was printing "Bibliography" really large, and forcing it into the TOC, so I removed the code by adding "%"

Here is a minimal working example:

Code: Select all

\documentclass[12pt]{report}
\usepackage[super,sort&compress,comma]{natbib}
\usepackage[sectionbib]{chapterbib}
\usepackage{indentfirst}
\usepackage{urcsthesisLK}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{wrapfig}
\usepackage{esvect}
\usepackage{float}
\usepackage{array}

\usepackage[nottoc, notlof, notlot]{tocbibind} 
\renewcommand{\bibname}{}

\begin{document}


%\include{Thesis_opening}
\tableofcontents
\listoftables
\listoffigures


\chapter{Introduction}
\section{Section 1}
blah blah blah
\subsection{wheee subsections}
And I cite lots of things!\cite{Ahuja:2009kx,Ando95,Allen:2005uq,Alvaro:2006zh,Ananias:2000zr,Anderson:2007bd,Andersson:1999oa,Angelikopoulos:2010ta,Angelikopoulos:2011zk,Antaris:2010xv,Arai:2009ix,PSSB:PSSB200669196,doi:10.1021/nl050133o}

\section{more sections}



\section{References}
\begin{spacing}{1}
\setcounter{NAT@ctr}{0}
\bibliographystyle{unsrt-etal-webpage}
\bibliography{min}
\end{spacing}



\end{document}
Not sure if it will actually work this way for you guys, but I tried!
Attachments
min.bib
bib file so my example will work
(19.17 KiB) Downloaded 256 times
unsrt-etal-webpage.bst
my slightly custom, but working bst file
(16.74 KiB) Downloaded 256 times
urcsthesisLK.sty
My modified thesis sty
(8.08 KiB) Downloaded 250 times
Image of the references section showing twice
Image of the references section showing twice
tworef.jpg (42.85 KiB) Viewed 4669 times

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

StarValkyrie
Posts: 89
Joined: Fri Jan 24, 2014 12:42 am

Re: Refrences section getting 2 lines in TOC

Post by StarValkyrie »

Try taking out the Section for References and changing the bibname to References in the preamble.
KMnO4aq
Posts: 7
Joined: Fri Jan 17, 2014 12:37 am

Refrences section getting 2 lines in TOC

Post by KMnO4aq »

StarValkyrie wrote:Try taking out the Section for References and changing the bibname to References in the preamble.
Just tried this. Changed tocbibind package part of the preamble to

Code: Select all

\usepackage[nottoc, notlof, notlot]{tocbibind}
\settocbibname{References}
and removed the

Code: Select all

\section{References}
, but now my References aren't a section (see picture). Sadly the code

Code: Select all

\usepackage[nottoc, notlof, notlot]{tocbibind}
\settocbibname{\section{References}}
doesn't work ;-)

I guess this will work, but I would prefer the References to have Section Formatting.
Attachments
tworef.jpg
tworef.jpg (33.89 KiB) Viewed 4647 times
StarValkyrie
Posts: 89
Joined: Fri Jan 24, 2014 12:42 am

Refrences section getting 2 lines in TOC

Post by StarValkyrie »

I haven't dealt with this myself but a quick google found https://stackoverflow.com/questions/103 ... tex-bibtex, which suggests two possible fixes. First try adding numbib to your tocbibind package option. It might be that simple. If that doesn't work, try instead (or in addition to, if it doesn't work alone) pasting this into your preamble:

Code: Select all

\makeatletter
\renewenvironment{thebibliography}[1]
     {\section{\bibname}
      \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\makeatother
KMnO4aq
Posts: 7
Joined: Fri Jan 17, 2014 12:37 am

Re: Refrences section getting 2 lines in TOC

Post by KMnO4aq »

numbib option in my tocbibind worked! Thanks :)
Post Reply