TeX - LaTeX Asked by RaviN on May 27, 2021
I am having the problem of a continuous numbering of bibliography in my PhD thesis. That is, if the bibliography of Chapter 1 goes from [1],…,[3], in Chapter 2 it starts from [4],…[6] like below.
I have provided a MWE of my thesis below. I am using multiple .tex files for each chapter.
Thesis.tex file =>
documentclass[11pt]{report}
usepackage[a4paper,left=35mm, right=25mm, top=19mm,bottom=23mm]{geometry}
usepackage{setspace}
doublespacing
usepackage[nottoc]{tocbibind}
usepackage[titletoc]{appendix}
usepackage{bm}
usepackage{etoolbox}
usepackage{multibib}
usepackage[round, sort, numbers, authoryear, sectionbib]{natbib}
usepackage[sectionbib]{chapterbib}
usepackage[utf8]{inputenc}
usepackage[english]{babel}
usepackage{titlesec}
usepackage{bibentry}
usepackage{lmodern}
usepackage{amsthm,amsmath,amsfonts,amssymb,bbm}
usepackage{graphicx}
usepackage{graphics}
usepackage{csquotes}
usepackage[pdfencoding=auto, psdextra]{hyperref}
hypersetup{colorlinks=true,linkcolor=blue, anchorcolor=red, citecolor=blue, filecolor = red, urlcolor = blue,
pdfauthor=author}
pdfstringdefDisableCommands{defvarepsilon{textepsilon}}
usepackage{enumerate}
usepackage{bookmark}
usepackage{array, booktabs, makecell}
usepackage{siunitx}
usepackage{xurl}
usepackage[misc]{ifsym}
sisetup{table-number-alignment=center, exponent-product=cdot}
usepackage{pgfplots}
usepgfplotslibrary{fillbetween}
usepackage{subfig}
pgfplotsset{compat=1.10}
usepackage{comment}
usepackage{xcolor}
usepackage{listings}
definecolor{mygreen}{rgb}{0,0.6,0}
definecolor{mygray}{rgb}{0.5,0.5,0.5}
definecolor{mymauve}{rgb}{0.58,0,0.82}
newcounter{bibcount}
makeatletter
patchcmd{@lbibitem}{item[}{item[hfilstepcounter{bibcount}{thebibcount.}}{}{}
setlength{bibhang}{2parindent}
renewcommandNAT@bibsetup%
[1]{setlength{leftmargin}{bibhang}setlength{itemindent}{-parindent}%
setlength{itemsep}{bibsep}setlength{parsep}{z@}}
lstset{
backgroundcolor=color{white}, % choose the background color; you must add usepackage{color} or usepackage{xcolor}; should come as last argument
basicstyle=linespread{0.5}, % the size of the fonts that are used for the code
breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
breaklines=true, % sets automatic line breaking
captionpos=b, % sets the caption-position to bottom
commentstyle=color{mygreen}, % comment style
deletekeywords={...}, % if you want to delete keywords from the given language
%escapeinside={%*}{*)}, % if you want to add LaTeX within your code
extendedchars=true, % lets you use non-ASCII characters; for 8-bits encodings only, does not work with UTF-8
%frame=single, % adds a frame around the code
keepspaces=true, % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible)
keywordstyle=color{blue}, % keyword style
language=Octave, % the language of the code
morekeywords={*,...}, % if you want to add more keywords to the set
% numbers=left, % where to put the line-numbers; possible values are (none, left, right)
numbersep=5pt, % how far the line-numbers are from the code
numberstyle=tinycolor{mygray}, % the style that is used for the line-numbers
rulecolor=color{black}, % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. comments (green here))
showspaces=false, % show spaces everywhere adding particular underscores; it overrides 'showstringspaces'
showstringspaces=false, % underline spaces within strings only
showtabs=false, % show tabs within strings adding particular underscores
stepnumber=2, % the step between two line-numbers. If it's 1, each line will be numbered
stringstyle=color{mymauve}, % string literal style
tabsize=2, % sets default tabsize to 2 spaces
title=lstname % show the filename of files included with lstinputlisting; also try caption instead of title
}
lstdefinestyle{customc}{
belowcaptionskip=1baselineskip,
breaklines=true,
frame=L,
xleftmargin=parindent,
language=C,
showstringspaces=false,
basicstyle=footnotesizettfamily,
keywordstyle=bfseriescolor{green!40!black},
commentstyle=itshapecolor{purple!40!black},
identifierstyle=color{blue},
stringstyle=color{orange},
}
lstdefinestyle{customasm}{
belowcaptionskip=1baselineskip,
xleftmargin=parindent,
language=[x86masm]Assembler,
basicstyle=footnotesizettfamily,
commentstyle=itshapecolor{purple!40!black},
}
newtheorem{cond}{Condition}{bfseries}{itshape}
numberwithin{cond}{chapter}
theoremstyle{definition}
newtheorem{definition}{Definition}
numberwithin{definition}{chapter}
newtheorem{remark}{Remark}
numberwithin{remark}{chapter}
theoremstyle{plain}
newtheorem{notation}{Notation}
newtheorem{proposition}{Proposition}
newtheorem{assumption}{Assumption}
numberwithin{assumption}{chapter}
newtheorem{theorem}{Theorem}
numberwithin{theorem}{chapter}
newtheorem{lemma}{Lemma}
numberwithin{lemma}{chapter}
newtheorem{corollary}{Corollary}
newcommand{lfrac}[2]{genfrac{}{}{0pt}{}{#1}{#2}}
newtheorem{Example}{Example}
numberwithin{Example}{chapter}
newenvironment{example}{%
vspace{0.3cm} pagebreak [2]%
par%
refstepcounter{proposition}%
noindent%
{bf Example~theproposition. }}{qed}%
%
newenvironment{proof1}{%
vspace{0.3cm} pagebreak [2]%
par%
noindent%
{it Proof~}}{qed}%
%
defa{alpha}
defbe{beta}
defde{delta}
defDe{Delta}
deft{{bf t}}
defga{gamma}
defGa{Gamma}
defla{lambda}
defLa{Lambda}
defep{varepsilon}
defsi{sigma}
defe{eta}
defth{theta}
defo{omega}
defu{{overline u}}
%defO{Omega}
defcov{{rm Cov}}
defdiam{{rm diam}}
defdim{{rm dim}_{_{rm H}}}
defDim{{rm dim}_{_{rm P}}}
defadim{{rm adim}}
defaDim{{rm aDim}}
defsp{{rm supp}}
defvar{{rm Var}}
defl{{langle}}
defr{rangle}
defF{{EuScript F}}
defIn{{rm 1 hskip-2.9truept l}}
defOCC{{mathbb{O}}}
newcommand{wh}{widehat}
newcommand{wt}{widetilde}
defN{{mathbb N}}
defR{{mathbb R}}
defQ{{mathbb Q}}
defC{{mathbb C}}
defeps{varepsilon}
defRe {{rm Re},}
defE{{mathbb E}}
defI{{cal I}}
defP{{mathbb P}}
defZ{{mathbb Z}}
defM{{EuScript M}}
defEN{{EuScript{E}}}
defCAP{{EuScript{C}}}
defsleq{mathop{preccurlyeq}}
defsgeq{mathop{succcurlyeq}}
defkto{{cal K}}
defK{{cal K}_{j_0}}
defH{{cal H}_{l}^q}
defV{{cal V}}
defovl{overline}
defwh{widehat}
title{LARGE{bf{Working Draft}}
{Anomaly Detection}
{large Hello}
}
author{Anonymous}
date{16.11.2020}
begin{document}
%maketitle
begin{titlepage}
vspace*{1cm}
centering
{Hugebfseries bf{Working Draft ...} huge{Anomaly Detection} par}
end{titlepage}
tableofcontents
listoffigures
listoftables
chapter*{Abstract}
addcontentsline{toc}{chapter}{Abstract}
This is my abstract.
chapter*{Acknowledgements}
addcontentsline{toc}{chapter}{Acknowledgements}
Thank you all.
include{Introduction}
include{Definitions}
end{document}
Next, the Introduction.tex file =>
chapter{Introduction}label{Chapter1}
This chapter gives Introduction
section{Data science}label{SI:1}
Anomaly detection plays an important role in today's world, see~cite{Chandola:2009},cite{Patcha:2007},cite{Akoglu:2015}.
bibliographystyle{plainnat}
bibliography{BibInt}
Next, the Definitions.tex file =>
chapter{Definitions, notations and auxiliary results }label{Chapter2}
Anomaly detection plays an important role in today's world, see~cite{Chandola:2009},cite{Patcha:2007},cite{Akoglu:2015}.
bibliographystyle{plainnat}
bibliography{BibInt}
Finally, the .bib file =>
@article{Chandola:2009,
title = {Anomaly detection: A survey},
author = {Chandola, Varun and Banerjee, Arindam and Kumar, Vipin},
journal = {ACM computing surveys (CSUR)},
volume = {41},
number = {3},
pages = {1-58},
year = {2009},
}
@article{Patcha:2007,
title = {An overview of anomaly detection techniques: Existing solutions and latest technological trends},
author = {Patcha, Animesh and Park, Jung-Min},
journal = {Computer networks},
volume = {51},
number = {12},
pages = {3448-3470},
year = {2007}
}
@article{Akoglu:2015,
title = {Graph based anomaly detection and description: a survey},
author = {Akoglu, Leman and Tong, Hanghang and Koutra, Danai},
journal = {Data mining and knowledge discovery},
volume = {29},
number = {3},
pages = {626-688},
year = {2015}
}
I have spent many days trying to fix this issue. I need each bibliography to start from "1". I would really appreciate your help on this matter.
Thank you very much.
You already define a bibcount
counter to display the numbers in the bibliography. Therefore, you can reset this counter to 0 after each include
using setcounter{bibcount}{0}
.
MWE:
documentclass[11pt]{report}
usepackage{etoolbox}
usepackage[round, sort, numbers, authoryear, sectionbib]{natbib}
usepackage[sectionbib]{chapterbib}
usepackage{bibentry}
newcounter{bibcount}
makeatletter
patchcmd{@lbibitem}{item[}{item[hfilstepcounter{bibcount}{thebibcount.}}{}{}
setlength{bibhang}{2parindent}
renewcommandNAT@bibsetup%
[1]{setlength{leftmargin}{bibhang}setlength{itemindent}{-parindent}%
setlength{itemsep}{bibsep}setlength{parsep}{z@}}
begin{document}
include{bibIntroduction}
setcounter{bibcount}{0}
include{bibDefinitions}
end{document}
Note that I removed usepackage{multibib}
from the MWE because it is not necessary (the multiple bibliographies are handled by the chapterbib
package).
Result:
Correct answer by Marijn on May 27, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP