LaTeX forum ⇒ BibTeX, biblatex and biberProblem in multiple bibliographies

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

Problem in multiple bibliographies

Postby viniciusbrbio » Sat Mar 11, 2017 9:37 pm

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] [Expand/Collapse] [Download] ({untitled.tex})
  1. \documentclass[12pt]{report}
  2. \usepackage[utf8]{inputenc}
  3. \usepackage[brazilian,brazil]{babel}
  4. \usepackage[a4paper,left=4cm,right=3cm,bottom=2.5cm,top=2.8cm]{geometry}
  5. \usepackage{fancyhdr,setspace,float,graphicx,lscape,array,longtable,colortbl,amsmath,amssymb,booktabs,multirow,hyperref,pdfpages,tocloft,titlesec,lipsum,natbib}
  6. \usepackage[sectionbib]{chapterbib}
  7. \renewcommand\cftloftitlefont{\Large\bfseries\hfill}
  8. \renewcommand\cftlottitlefont{\Large\bfseries\hfill}
  9. \renewcommand\cfttoctitlefont{\Large\bfseries\hfill}
  10. \titleformat{\chapter}[display]
  11. {\vspace*{-0.7cm}\bfseries\Huge}
  12. {\filleft{\chaptertitlename}\Huge~\thechapter}
  13. {1ex}
  14. {\titlerule
  15. \vspace{2ex}%
  16. \filright}
  17. []
  18. %****************************************************************************************************
  19. % Seleção da fonte Palladio
  20. \usepackage[sc]{mathpazo}
  21. \linespread{1.05}
  22. \usepackage[T1]{fontenc}
  23. %****************************************************************************************************
  24. \graphicspath{{imagens/}}
  25. %****************************************************************************************************
  26.  
  27. \begin{document}
  28. \input{capitulos/introduction}
  29.  
  30. \input{capitulos/cap02}
  31.  
  32. \end{document}



This is my "introduction.tex" file:

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \chapter{\sc Um título}
  2. \lipsum[2-2]
  3. Um exemplo de citação \citep{lamport1986latex} .
  4. \begin{figure}[h]
  5. \centering
  6. \caption{Minha figura}
  7. \includegraphics[scale=1.5]{ufv.jpg}
  8. \end{figure}
  9. \section{Seção nova}
  10. \lipsum[2-3]
  11.  
  12. %%%% Referências do capítulo
  13. \addcontentsline{toc}{section}{Referências Bibliográficas}
  14. \bibliographystyle{apalike}
  15. \bibliography{referencias}



And this is my "chap02.tex":

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \chapter{\sc Título do capítulo}
  2. \lipsum[2-4] \lipsum[1]
  3. \begin{table}[]
  4. \centering
  5. \caption{Minha tabela}
  6. \label{my-label}
  7. \begin{tabular}{lll}
  8. 1 & a & s \\ \hline
  9. 1 & a & x \\
  10. 2 & z & s
  11. \end{tabular}
  12. \end{table}
  13. \section{Seção nova}
  14. \lipsum[2-3]
  15. De acordo com \cite{Rodrigues2016} e \cite{kopka2004guide}.
  16. \addcontentsline{toc}{section}{Referências Bibliográficas}
  17. \bibliographystyle{apalike}
  18. \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.

User avatar
Johannes_B
Site Moderator
Posts: 4185
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sun Mar 12, 2017 10:25 am

I would use the modern biblatex for that task.

Hint: You can see the output by clicking on Open in Overleaf
Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. %\RequirePackage{filecontents}
  2. \documentclass[12pt]{report}
  3. \usepackage[utf8]{inputenc}
  4. \usepackage[brazilian,brazil]{babel}
  5. \usepackage[a4paper,left=4cm,right=3cm,bottom=2.5cm,top=2.8cm]{geometry}
  6. \usepackage{fancyhdr}
  7. \usepackage{setspace}
  8. \usepackage{float}
  9. \usepackage{graphicx}
  10. \usepackage{lscape}
  11. \usepackage{array}
  12. \usepackage{longtable}
  13. \usepackage{colortbl}
  14. \usepackage{amsmath}
  15. \usepackage{amssymb}
  16. \usepackage{booktabs}
  17. \usepackage{multirow}
  18. \usepackage{pdfpages}
  19. \usepackage{tocloft}
  20. \usepackage[explicit]{titlesec}
  21. \usepackage{lipsum}
  22. \usepackage[style=authoryear,natbib=true,refsection=chapter]{biblatex}
  23. \defbibheading{subchap}[Referências Bibliográficas]{%
  24. \section*{#1}%
  25. \addcontentsline{toc}{section}{#1}%
  26. \markboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}}
  27. \addbibresource{biblatex-examples.bib}
  28. \usepackage{hyperref}
  29. \renewcommand\cftloftitlefont{\Large\bfseries\hfill}
  30. \renewcommand\cftlottitlefont{\Large\bfseries\hfill}
  31. \renewcommand\cfttoctitlefont{\Large\bfseries\hfill}
  32. \titleformat{\chapter}[display]
  33. {\vspace*{-0.7cm}\bfseries\Huge}
  34. {\filleft{\chaptertitlename}\Huge~\thechapter}
  35. {1ex}
  36. {\titlerule
  37. \vspace{2ex}%
  38. \normalfont\scshape#1\filright}
  39. []
  40. %****************************************************************************************************
  41. % Seleção da fonte Palladio
  42. \usepackage[sc]{mathpazo}
  43. \linespread{1.05}
  44. \usepackage[T1]{fontenc}
  45. %****************************************************************************************************
  46. \graphicspath{{imagens/}}
  47. %****************************************************************************************************
  48. \begin{filecontents}{\jobname-I.tex}
  49. \chapter{ Um título}
  50. \lipsum[2-2]
  51. Um exemplo de citação \citep{doody} .
  52. \begin{figure}[h]
  53. \centering
  54. \caption{Minha figura}
  55. \end{figure}
  56. \section{Seção nova}
  57. \lipsum[2-3]
  58.  
  59. %%%% Referências do capítulo
  60. \printbibliography[heading=subchap]
  61. \end{filecontents}
  62. \begin{filecontents}{\jobname-2.tex}
  63.  
  64. \chapter{Señor Pato}
  65. \lipsum[2-4] \lipsum[1]
  66. \begin{table}
  67. \centering
  68. \caption{Minha tabela}
  69. \label{my-label}
  70. \begin{tabular}{lll}
  71. 1 & a & s \\ \hline
  72. 1 & a & x \\
  73. 2 & z & s
  74. \end{tabular}
  75. \end{table}
  76. \section{Seção nova}
  77. \lipsum[2-3]
  78. De acordo com \cite{ctan} e \cite{aristotle:physics}.
  79. \printbibliography[heading=subchap]
  80. \end{filecontents}
  81.  
  82. \begin{document}
  83. \tableofcontents
  84. \input{\jobname-I}
  85.  
  86. \input{\jobname-2}
  87.  
  88. \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.


Return to “BibTeX, biblatex and biber”

Who is online

Users browsing this forum: No registered users and 5 guests