BibTeX, biblatex and biberProblem in multiple bibliographies

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
viniciusbrbio
Posts: 1
Joined: Sat Mar 11, 2017 9:21 pm

Problem in multiple bibliographies

Post by viniciusbrbio »

Hi!

I'm doing my Ph.D. thesis in latex, but I'm in trouble to split the bibliography between the chapters. I tried a lot of stuff and packages and I get nothing. I don't know what I'm doing wrong. Despite the chapters have differents citations, for some reason, in both chapter's bibliography I have all citations. Please, take an look:

This is my "main.tex" file, wich is the only one that I compile:

Code: Select all

\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[brazilian,brazil]{babel}
\usepackage[a4paper,left=4cm,right=3cm,bottom=2.5cm,top=2.8cm]{geometry}
\usepackage{fancyhdr,setspace,float,graphicx,lscape,array,longtable,colortbl,amsmath,amssymb,booktabs,multirow,hyperref,pdfpages,tocloft,titlesec,lipsum,natbib}
\usepackage[sectionbib]{chapterbib}
\renewcommand\cftloftitlefont{\Large\bfseries\hfill}
\renewcommand\cftlottitlefont{\Large\bfseries\hfill}
\renewcommand\cfttoctitlefont{\Large\bfseries\hfill}
\titleformat{\chapter}[display]
{\vspace*{-0.7cm}\bfseries\Huge}
{\filleft{\chaptertitlename}\Huge~\thechapter}
{1ex}
{\titlerule
\vspace{2ex}%
\filright}
[]
%****************************************************************************************************
% Seleção da fonte Palladio
\usepackage[sc]{mathpazo}
\linespread{1.05}
\usepackage[T1]{fontenc}
%****************************************************************************************************
\graphicspath{{imagens/}}
%****************************************************************************************************

\begin{document}
\input{capitulos/introduction}

\input{capitulos/cap02}

\end{document}

This is my "introduction.tex" file:

Code: Select all

\chapter{\sc Um título}
\lipsum[2-2]
Um exemplo de citação \citep{lamport1986latex} .
\begin{figure}[h]
\centering
\caption{Minha figura}
 \includegraphics[scale=1.5]{ufv.jpg}
\end{figure}
\section{Seção nova}
\lipsum[2-3]

%%%% Referências do capítulo
\addcontentsline{toc}{section}{Referências Bibliográficas}
\bibliographystyle{apalike}
\bibliography{referencias}

And this is my "chap02.tex":

Code: Select all

\chapter{\sc Título do capítulo}
\lipsum[2-4] \lipsum[1]
\begin{table}[]
\centering
\caption{Minha tabela}
\label{my-label}
\begin{tabular}{lll}
1 & a & s \\ \hline
1 & a & x \\
2 & z & s
\end{tabular}
\end{table}
\section{Seção nova}
\lipsum[2-3]
De acordo com \cite{Rodrigues2016} e \cite{kopka2004guide}.
\addcontentsline{toc}{section}{Referências Bibliográficas}
\bibliographystyle{apalike}
\bibliography{referencias}

And this is what I get:

https://mega.nz/#!2Q5QlQqY!h5hnCWqh99Ej ... SGQXfcanoY

Despite the chapters have differents citations, for some reason, in both chapter's bibliography I have all citations.


Many thanks.

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

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Problem in multiple bibliographies

Post by Johannes_B »

I would use the modern biblatex for that task.

Hint: You can see the output by clicking on Open in Overleaf

Code: Select all

%\RequirePackage{filecontents}
\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[brazilian,brazil]{babel}
\usepackage[a4paper,left=4cm,right=3cm,bottom=2.5cm,top=2.8cm]{geometry}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage{float}
\usepackage{graphicx}
\usepackage{lscape}
\usepackage{array}
\usepackage{longtable}
\usepackage{colortbl}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{pdfpages}
\usepackage{tocloft}
\usepackage[explicit]{titlesec}
\usepackage{lipsum}
\usepackage[style=authoryear,natbib=true,refsection=chapter]{biblatex}
  \defbibheading{subchap}[Referências Bibliográficas]{%
    \section*{#1}%
    \addcontentsline{toc}{section}{#1}%
    \markboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}}
\addbibresource{biblatex-examples.bib}
\usepackage{hyperref}
\renewcommand\cftloftitlefont{\Large\bfseries\hfill}
\renewcommand\cftlottitlefont{\Large\bfseries\hfill}
\renewcommand\cfttoctitlefont{\Large\bfseries\hfill}
\titleformat{\chapter}[display]
{\vspace*{-0.7cm}\bfseries\Huge}
{\filleft{\chaptertitlename}\Huge~\thechapter}
{1ex}
{\titlerule
	\vspace{2ex}%
\normalfont\scshape#1\filright}
[]
%****************************************************************************************************
% Seleção da fonte Palladio
\usepackage[sc]{mathpazo}
\linespread{1.05}
\usepackage[T1]{fontenc}
    %****************************************************************************************************
\graphicspath{{imagens/}}
%****************************************************************************************************
\begin{filecontents}{\jobname-I.tex}
	\chapter{ Um título}
	\lipsum[2-2]
	Um exemplo de citação \citep{doody} .
	\begin{figure}[h]
		\centering
		\caption{Minha figura}
	\end{figure}
	\section{Seção nova}
	\lipsum[2-3]

     %%%% Referências do capítulo
	\printbibliography[heading=subchap]
\end{filecontents}
\begin{filecontents}{\jobname-2.tex}

	\chapter{Señor Pato}
	\lipsum[2-4] \lipsum[1]
	\begin{table}
		\centering
		\caption{Minha tabela}
		\label{my-label}
		\begin{tabular}{lll}
			1 & a & s \\ \hline
			1 & a & x \\
			2 & z & s
		\end{tabular}
	\end{table}
	\section{Seção nova}
	\lipsum[2-3]
	De acordo com \cite{ctan} e \cite{aristotle:physics}.
	\printbibliography[heading=subchap]
\end{filecontents}

\begin{document}
\tableofcontents
\input{\jobname-I}

\input{\jobname-2}

\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply