2

I have a code which goes like:

\documentclass[12pt,a4paper]{report}
\usepackage[breaklinks=true]{hyperref}
\usepackage{color,mathtools,cleveref,xfrac,subcaption,multirow,multicol,amssymb,mathptmx,fancyhdr,natbib,graphicx,lipsum}
\usepackage[english]{babel}
\usepackage[shortlabels]{enumitem}
\usepackage{floatpag}\floatpagestyle{empty}
\crefname{equation}{Eq.}{Eqs.}
\crefname{figure}{Fig.}{Figs.}
\crefname{section}{Sect.}{Sects.}
\crefname{subsection}{Sect.}{Sects.}
\crefname{table}{Tab.}{Tabs.}
\linespread{1.5}
\usepackage[top=30mm,bottom=27mm,left=30mm,right=25mm,textheight=240mm,textwidth=160mm]{geometry}
\setlength{\parskip}{2.5pt}
\setlength{\parindent}{12mm}
\newcommand{\sectiontitle}{}
\fancyhead{}% clear default headers
\fancyhead[L]{\ifnum\value{section}=0\relax
    \else \nouppercase{\leftmark}
    \fi}
\pagestyle{fancy}
\begin{document}
    \input{chapter0}
    \input{chapter1}
    \input{chapter2}
    \input{chapter3}
    \input{chapter4}
    \input{chapter5}
    \input{chapter6}
    \newpage
    \fancyhead[L]{Bibliography}
    \bibliographystyle{plainnat}
    \bibliography{first_citations}      
    \vfill
    (Candidate name)
    \hfill
    (Guide name)\\
    Candidate
    \hfill
    Guide
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    \newpage
    \fancyhead[L]{Synopsis}
    \input{chapter7}    
    \bibliographystyle{plainnat}
    \bibliography{second_citation}  
    \vfill
    (Candidate name)
    \hfill
    (Guide name)\\
    Candidate
    \hfill
    Guide
\end{document}

From chapter0 to chapter6, the corresponding bib file is first_citations and only for chapter7 the corresponding bib file is second_citation. So, what I want is after chapter 6, the bibliography file first_citations should be printed and after chapter seven I want to get second_citation ONLY to be printed. But, only first_citations is getting printed on both instances.

When I comment from \input{chapter0} to %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newpage I can see that second_citation is being printed, but when I am combining all the files, I am not getting what I required.

Where have I gone wrong?

2

One solution is to use the bibunits package to handle the two bibliographies. Wrap the first 7 chapters in a bibunit environment, i.e.,

\begin{bibunit}[plainnat]
\input{chapter0}
...
\input{chapter6}
\putbib[first_citations]
...
\end{bibunit}

and do the same for the seventh chapter

\begin{bibunit}[plainnat]
\input{chapter7}
\putbib[second_citation]
...
\end{bibunit}

then the workflow to compile the file and the bibliographies is

latex main
bibtex bu1
bibtex bu2
latex main
latex main
  • many thanks for taking time to look into my issue. But i believe, \begin{bibunit}[plainnat] rather than \begin{biunit}[plainnat] in the beginning of the second part of codes. But nevertheless, did not get what do you mean by bibtex bu1 and bibtex bu2? I am using TexStudio i made a user command after going to "Options"-> Configure TexStudio-> Build and added user defined command "txs:///latex | txs:///bibtex | txs:///bibtex | txs:///latex | txs:///latex". But no bibliographies are coming? – sreeraj t Jan 5 '19 at 14:03
  • You have to specify different file names for bibtex. They should be bibtex bu1 and bibtex bu2. You can try from command line – Guido Jan 5 '19 at 22:13
  • I have made seperate files "chapter0" to "chapter7" with 2 separate bib files "first_citations" & "second_citation" along with a main file where I have written all codes that I have mentioned along with the suggestions that you have given. Then I opened command prompt and navigated to the folder. Then I typed: latex document, bibtex bu1, bibtex bu2, latex document, latex document in succession. I hope this is what you asked me to do. But still bibliographies are not coming... – sreeraj t Jan 6 '19 at 3:06
  • Have you added \usepackage{bibunits} in the preamble, and run pdflatex twice after running bibtex? – Guido Jan 6 '19 at 3:21
  • 1
    Anybody who is wondering how to incorporate bibtex bu1 and bibtex bu2 in TexStudio, see this post – sreeraj t Jan 6 '19 at 5:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.