Bibliography and Citation numbering by chapter

1,234 views
Skip to first unread message

Carlos João

unread,
Apr 27, 2016, 12:52:05 PM4/27/16
to UNL Thesis
Hello

I would like to start citations from the beginning and print the corresponding bibliography in each thesis chapter.

In a first approach and using the biblatex documentation I tried to change the document preambule in 

biblatex={            % Options for biblatex (see biblatex documentation)
style=numeric-comp,      % numeric(*), alphabetic, authoryear, bwl-FU
sorting=none,        % none, nyt(*), ynt
firstinits=true,    % render all first and middle names as initials
sortcites=true,     % If numeric, sort cites by crescent order
    hyperref=true,       % Hyperlinks in citations: true(*) false
refsection=chapter,%
citereset=chapter %
}

using \printbibliography in each chapter.tex.

It seems that something is missing since the document is not able to produce any bibliography and citations
leaving the citation command in the text.

Then in the beginning and end of each chapter I introduced \begin{refsection} and \end{refsection} in order
to establish the refsection environment but the same result happened.

Any suggestion??

Thank you very much for all the help
Carlos João

Joao Lourenco

unread,
Apr 27, 2016, 4:30:49 PM4/27/16
to UNL Thesis
Hi Carlos,

Check the link:

It reports another "problem" but has a working example. 

Does this link help?

If no, let me know and I'll make an effort on working with you on this problem.

João

Carlos João

unread,
Apr 28, 2016, 6:13:32 AM4/28/16
to UNL Thesis
Hello Professor

Well i looked for the information in the link and tried the suggestion of not using the refsection=chapter and establishing
the \begin and \end{refsection) but without any results.

Meanwhile I tried another way that partially resolved the problem. Applying the \begin{refsegment} and \end{refsegment)
in each chapter and putting \printbibliography[segment=#,heading=subbibliography] being # the number of segment
corresponding to the chapter (1or 2 or.....). The generated pdf presents the bibliography by chapter. But I was not
able to start the citations from the beginning in each chapter. If chapter 1 ends with citation 24 the chapter 2 will begin
with citation 25 or will present the same citation number if the same citation is used in both chapters.

So even though the refsegment environment seems to work I still need a restart in citations numbering.

Carlos João

Joao Lourenco

unread,
Apr 28, 2016, 6:48:12 AM4/28/16
to UNL Thesis
Hy Carlos,

This is great. You are a very resourceful LaTeXian.  :)

You need to add the "citereset=chapter" option to BibLaTeX.   Check page 53 of bib latex manual.

Let me know if you had success.

João

Carlos João

unread,
Apr 28, 2016, 8:05:21 AM4/28/16
to UNL Thesis
Hello

Well thats the thing i can't understand. Reseting the citations should be easy with citereset=chapter option but
it seems that has no effect in the unl thesis template. No success :(

biblatex={            % Options for biblatex (see biblatex documentation)
style=numeric-comp,      % numeric(*), alphabetic, authoryear, bwl-FU
sorting=none,        % none, nyt(*), ynt
firstinits=true,    % render all first and middle names as initials
sortcites=true,     % If numeric, sort cites by crescent order
    hyperref=true,       % Hyperlinks in citations: true(*) false
citereset=chapter, %
}

Regards
Carlos João

Joao Lourenco

unread,
Apr 28, 2016, 3:30:46 PM4/28/16
to UNL Thesis
Hi,

Another alternative.  :)

— Add the option "defernumbers=true"  to biblatex; and
— Ass the option "resetnumbers=true"  to the "\printbibliography[resetnumbers=true,…]"

Let me know if this one works.  :)

João

Carlos João

unread,
Apr 29, 2016, 6:52:39 AM4/29/16
to UNL Thesis
Hello

I think we are close to the correct answer :)

1) The option defernumbers=true doesn't seem to do any action in the document.
2) The option "resetnumbers=true" works and resets all the new citations beginning at number 1 again.

So although reset numbers works and resets citations if we use an "old" citation from previous chapters,
the document preserve it numbering and in the bibliography two entities with same number will appear, example:

If citation number 4 from chapter 1 is used in chapter 2, in the bibliography printing it will appear first the old citation 4
and then the new citations 1, 2, 3 and new 4....

Carlos João

Joao Lourenco

unread,
Apr 29, 2016, 8:15:31 AM4/29/16
to UNL Thesis
Carlos,

Not sure I understood the problem this time.  :(

Would you like to meet with me personally to see if we can handle this together?

In alternative, would you share your LaTeX sources with me and we have a Skype session and work remotely on the problem?

João

Carlos João

unread,
Aug 6, 2016, 8:04:03 AM8/6/16
to UNL Thesis
Hello Professor

Last time we were able to produce the bibliography by chapter using the refsection environment and using the Scripts/bibliography.sh in the Terminal to clean
all bibliography and rewrite the bibliography in the right way. This method has been functioning for me in the first 4 chapters of the thesis however when I add more chapters to the
file, doesn't work anymore. 

I looked to the terminal and the template folder and what is happening is:

1) When I run the template  in texshop it will create template-1-blx-aux, template 2-blx-aux.....template12-blx.aux files or more depending on the number of chapters that i add.
2) When I run the Scripts/bibliography.sh in Terminal, the system just creates the files .bbl and .blg until template9-blx.

So what is happening is that the chapters bellow template9-blx-aux are correctly producing the bibliography by chapters, however above this no citation or bibliography appears.

Any guess why?

Best regards

Carlos João

Joao Lourenco

unread,
Aug 6, 2016, 8:07:33 AM8/6/16
to UNL Thesis
Hi Carlos,

Does it work for the first 4 chapters, but not for the 5th?  Or do you have more than 9 chapters?
Can you please attach the script "bibliography.sh" to a post, so that I can have a look at it?

Thanks.

João

Carlos João

unread,
Aug 6, 2016, 8:18:45 AM8/6/16
to UNL Thesis
Hi

At the total I have 8 chapters + 1 appendix without counting acknowledgments, glossaries etc. 

With all this files, when i run the template it will create template1-blx.aux until template18-blx.aux. But Scripts/bibliography.sh it is only working until template9-blx.aux.

Script:

Air-de-Carlos:LaTeX carlosjoao$ Scripts/bibliography.sh

This is BibTeX, Version 0.99d (TeX Live 2015)

The top-level auxiliary file: template1-blx.aux

The style file: biblatex.bst

Database file #1: template-blx.bib

Database file #2: bibliographypapers.bib

I was expecting a `,' or a `}'---line 4937 of file bibliographypapers.bib

 : 

 : @article{Mourad:2008fd,

(Error may have been on previous line)

I'm skipping whatever remains of this entry

Biblatex version: 3.3

(There was 1 error message)

This is BibTeX, Version 0.99d (TeX Live 2015)

The top-level auxiliary file: template2-blx.aux

The style file: biblatex.bst

Database file #1: template-blx.bib

Database file #2: bibliographypapers.bib

I was expecting a `,' or a `}'---line 4937 of file bibliographypapers.bib

 : 

 : @article{Mourad:2008fd,

(Error may have been on previous line)

I'm skipping whatever remains of this entry

Biblatex version: 3.3

(There was 1 error message)

This is BibTeX, Version 0.99d (TeX Live 2015)

The top-level auxiliary file: template3-blx.aux

The style file: biblatex.bst

Database file #1: template-blx.bib

Database file #2: bibliographypapers.bib

I was expecting a `,' or a `}'---line 4937 of file bibliographypapers.bib

 : 

 : @article{Mourad:2008fd,

(Error may have been on previous line)

I'm skipping whatever remains of this entry

Biblatex version: 3.3

(There was 1 error message)

This is BibTeX, Version 0.99d (TeX Live 2015)

The top-level auxiliary file: template4-blx.aux

The style file: biblatex.bst

Database file #1: template-blx.bib

Database file #2: bibliographypapers.bib

I was expecting a `,' or a `}'---line 4937 of file bibliographypapers.bib

 : 

 : @article{Mourad:2008fd,

(Error may have been on previous line)

I'm skipping whatever remains of this entry

Biblatex version: 3.3

Too many commas in name 1 of "Natl Univ Singapore, Dept Orthoped Surg, Singapore 0511, Singapore" for entry Lam:2002tw

while executing---line 2659 of file biblatex.bst

Too many commas in name 1 of "Univ London Imperial Coll Sci Technol {\&} Med, Dept Chem, London SW7 2AY, England" for entry Arshady:1999wb

while executing---line 2659 of file biblatex.bst

Too many commas in name 1 of "Natl Univ Singapore, Fac Sci, Dept Pharm, S-117543 Singapore, Singapore" for entry Chan:2002ve

while executing---line 2659 of file biblatex.bst

Too many commas in name 1 of "Natl Univ Singapore, Fac Sci, Dept Pharm, S-117543 Singapore, Singapore" for entry Chan:2002ve

while executing---line 2659 of file biblatex.bst

Too many commas in name 1 of "Peking Union Med Coll, Chinese Acad Med Sci, Inst Biomed Engn, Tianjin 300192, Peoples R China" for entry Liu:2007kj

while executing---line 2659 of file biblatex.bst

Too many commas in name 1 of "Peking Union Med Coll, Chinese Acad Med Sci, Inst Biomed Engn, Tianjin 300192, Peoples R China" for entry Liu:2007kj

while executing---line 2659 of file biblatex.bst

Too many commas in name 1 of "1024S Innovation Way, Stillwater, OK 74074, USA." for entry Liu:2007bj

while executing---line 2659 of file biblatex.bst

(There were 8 error messages)

This is BibTeX, Version 0.99d (TeX Live 2015)

The top-level auxiliary file: template5-blx.aux

The style file: biblatex.bst

Database file #1: template-blx.bib

Database file #2: bibliographypapers.bib

I was expecting a `,' or a `}'---line 4937 of file bibliographypapers.bib

 : 

 : @article{Mourad:2008fd,

(Error may have been on previous line)

I'm skipping whatever remains of this entry

Biblatex version: 3.3

(There was 1 error message)

This is BibTeX, Version 0.99d (TeX Live 2015)

The top-level auxiliary file: template6-blx.aux

The style file: biblatex.bst

Database file #1: template-blx.bib

Database file #2: bibliographypapers.bib

I was expecting a `,' or a `}'---line 4937 of file bibliographypapers.bib

 : 

 : @article{Mourad:2008fd,

(Error may have been on previous line)

I'm skipping whatever remains of this entry

Repeated entry---line 15182 of file bibliographypapers.bib

 : @book{Tabeling:2005wl

 :                      ,

I'm skipping whatever remains of this entry

Biblatex version: 3.3

(There were 2 error messages)

This is BibTeX, Version 0.99d (TeX Live 2015)

The top-level auxiliary file: template7-blx.aux

The style file: biblatex.bst

Database file #1: template-blx.bib

Database file #2: bibliographypapers.bib

I was expecting a `,' or a `}'---line 4937 of file bibliographypapers.bib

 : 

 : @article{Mourad:2008fd,

(Error may have been on previous line)

I'm skipping whatever remains of this entry

Biblatex version: 3.3

(There was 1 error message)

This is BibTeX, Version 0.99d (TeX Live 2015)

The top-level auxiliary file: template8-blx.aux

The style file: biblatex.bst

Database file #1: template-blx.bib

Database file #2: bibliographypapers.bib

I was expecting a `,' or a `}'---line 4937 of file bibliographypapers.bib

 : 

 : @article{Mourad:2008fd,

(Error may have been on previous line)

I'm skipping whatever remains of this entry

Biblatex version: 3.3

(There was 1 error message)

This is BibTeX, Version 0.99d (TeX Live 2015)

The top-level auxiliary file: template9-blx.aux

The style file: biblatex.bst

Database file #1: template-blx.bib

Database file #2: bibliographypapers.bib

I was expecting a `,' or a `}'---line 4937 of file bibliographypapers.bib

 : 

 : @article{Mourad:2008fd,

(Error may have been on previous line)

I'm skipping whatever remains of this entry

Biblatex version: 3.3

(There was 1 error message)

Air-de-Carlos:LaTeX carlosjoao$ 



Thanks

CJ

Joao Lourenco

unread,
Aug 6, 2016, 3:00:21 PM8/6/16
to UNL Thesis
Carlos,

You have errors in the BibTeX file. 

You should fix them in fist place.

Then you should try again and check if the behaviour is the same.  If it is, please explain again carefully what you were expecting, what you observe, and what you think should be (and is not) happening.

Thank you.

João L.

Carlos João

unread,
Aug 6, 2016, 3:51:30 PM8/6/16
to UNL Thesis
Thank you again Professor

I have fixed all bibliography issues but the result is still the same. So detailing what we did previously:

1) I have produced 8 chapters where the following code was introduced in each of them

\begin{refsection}
bla bla bla
bla bla bla
\printbibliography{refsection}
\end{refsection}

2) With refsection environment I am able to produce a unique citation and bibliography in each chapter. 

3) With this refsection code, when I run typeset->latex in TeXshop it will create template1-blx.aux until template18-blx.aux.

4) When we tried before typeset->bibtex to compile the bibliography it was not working correctly by producing the bibliography by chapter and then
we used Scripts/bibliography.sh in Terminal that seem to work pretty well.

5)When I run Scripts/bibliography.sh in Terminal it will create template1-blx.bbl and template1-blx.blg file types until template9-blx-bbl and template9-blx.bgl. This allows the
production of citation and bibliography in the first 4 chapters.

6) So I found evidence that the following chapters are associated with the next template10 to template18 files and because Scripts/bibliography.sh is not producing
the respective bbl and blg files for 10 to 18, the citation and bibliography per chapter does not work in chapters 5 to 8.


Right Now I don't have the means to check if this issue is only happening in my computer so If you think that is better I can send you the files.
Thank you very much for your help

CJ



Joao Lourenco

unread,
Aug 8, 2016, 6:23:49 PM8/8/16
to UNL Thesis
Hi,

Can you please send me by email, or attach to a pst here, the file "Scripts/bibliography.sh".

hank you.

João

Joao Lourenco

unread,
Aug 10, 2016, 4:19:34 AM8/10/16
to UNL Thesis
Carlos,

Please replace the '?' by a '*' in the bibliography.sh file.   The file will become:

for i in template*-blx.aux; do bibtex $i; done

It will start processing all the "…box-aux" files.  Let me know if it solves your problem.

João L.

Carlos João

unread,
Aug 10, 2016, 6:55:07 AM8/10/16
to UNL Thesis
Professor

Fully working now!! Bibliography by chapters ok!

Thank you very much

CJ
Reply all
Reply to author
Forward
0 new messages