I have a problem with my LaTeX document. It either prints out the wrong page number of the chapter of my sources (Version 1), or it jumps to the wrong page (Version 2). (Minimal reproducible example below)
Version 1: Whenever I click on "Literatur", it jumps to the previous chapter and not to the chapter I want, but at least it prints out the correct page number in my table of contents.
\newpage
\setstretch{1.5}
\fancypagestyle{plain}{
\fancyhf{} % clear all header and footer fields
\fancyhead[R]{\normalsize \bfseries \thepage}
\fancyhead[L]{\normalsize \bfseries Literatur}
\renewcommand{\headrulewidth}{0.75pt}
\renewcommand{\footrulewidth}{0pt}}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\pagestyle{plain}
\addcontentsline{toc}{chapter}{Literatur}
\printbibliography
Version 2: Whenever I click on "Literatur", it jumps to the correct chapter, but it prints out the wrong page number in my table of contents. It doesn't print out the first page number of this chapter but the last page number.
\newpage
\setstretch{1.5}
\fancypagestyle{plain}{
\fancyhf{} % clear all header and footer fields
\fancyhead[R]{\normalsize \bfseries \thepage}
\fancyhead[L]{\normalsize \bfseries Literatur}
\renewcommand{\headrulewidth}{0.75pt}
\renewcommand{\footrulewidth}{0pt}}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\pagestyle{plain}
\printbibliography
\addcontentsline{toc}{chapter}{Literatur}
I have already tried adding \phantomsection and \cleardoublepage in every line possible, but they don't seem to work.
In case it's important, this is the class I'm using:
\documentclass[fontsize=11pt,paper=a4,oneside,toc=listof,listof=totocnumbered,ngerman]{scrreprt}
And I can't change the class or all of the stuff before \printbibliography because it's the template of my university. I also can't add all of the sources manually (I've seen this in some answers) because I have over 200 sources.
I appreciate any help that you can provide because I'm running out of ideas and I have to give in my thesis soon! :)
Minimal reproducible example
bibliography.bib path: content/bib/bibliography.bib
#misc{a,
author = {a},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{b,
author = {b},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{c,
author = {c},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{d,
author = {d},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{e,
author = {e},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{f,
author = {f},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{g,
author = {g},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{h,
author = {h},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{i,
author = {i},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{j,
author = {j},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
main.tex (Version 1)
\documentclass[fontsize=11pt,paper=a4,oneside,toc=listof,listof=totocnumbered,ngerman]{scrreprt}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[babel,german=guillemets]{csquotes}
\usepackage[sfdefault]{FiraSans}
\usepackage[T1]{fontenc}
\renewcommand*\oldstylenums[1]{{\firaoldstyle #1}}
%SPACING
\usepackage{setspace}
\setstretch{1,3}
%PAGE SETUP
\usepackage{pdflscape}
%margins
\usepackage[paper=a4paper,left=25mm,right=25mm,top=25mm,bottom=20mm]{geometry}
%header footer
\usepackage{fancyhdr} % header field
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyhead[R]{\normalsize \bfseries \thepage}
\fancyhead[L]{\normalsize \bfseries \thechapter \hspace{0.5em}\leftmark}
\renewcommand{\headrulewidth}{0.75pt}
\renewcommand{\footrulewidth}{0pt}}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}
}
%BIBLIOGRAPHY
\usepackage{bibgerm}
\usepackage[sortcites,style=numeric,sorting=none,backend=biber]{biblatex}
\IfFileExists{content/bib/bibliography_final.bib}
{\bibliography{content/bib/bibliography_final.bib}}%
{%
\IfFileExists{content/bib/bibliography.bib}%
{\bibliography{content/bib/bibliography.bib}}%
{%
\typeout{bibliography not found, using empty!}%
\bibliography{content/bib/empty.bib}%
}%
}%
%HYPERLINKS BOOKMARKS
\usepackage{hyperref} %Links
\hypersetup{colorlinks =false,linkbordercolor = {0 0 0},linktoc = all,pdfborder = {0 0 0},bookmarksdepth = subsection,bookmarksnumbered = true}
\urlstyle{same}
\usepackage[]{bookmark}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\tableofcontents
\chapter{Chapter}
Text \cite{a,b,c,d,e,f,g,h,i,j}
\section{Section}
More text
\newpage
\setstretch{1.5}
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyhead[R]{\normalsize \bfseries \thepage}
\fancyhead[L]{\normalsize \bfseries Literatur}
\renewcommand{\headrulewidth}{0.75pt}
\renewcommand{\footrulewidth}{0pt}}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\pagestyle{plain}
\addcontentsline{toc}{chapter}{Literatur}
\printbibliography
\end{document}
main.tex (Version 2)
\documentclass[fontsize=11pt,paper=a4,oneside,toc=listof,listof=totocnumbered,ngerman]{scrreprt}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[babel,german=guillemets]{csquotes}
\usepackage[sfdefault]{FiraSans}
\usepackage[T1]{fontenc}
\renewcommand*\oldstylenums[1]{{\firaoldstyle #1}}
%SPACING
\usepackage{setspace}
\setstretch{1,3}
%PAGE SETUP
\usepackage{pdflscape}
%margins
\usepackage[paper=a4paper,left=25mm,right=25mm,top=25mm,bottom=20mm]{geometry}
%header footer
\usepackage{fancyhdr} % header field
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyhead[R]{\normalsize \bfseries \thepage}
\fancyhead[L]{\normalsize \bfseries \thechapter \hspace{0.5em}\leftmark}
\renewcommand{\headrulewidth}{0.75pt}
\renewcommand{\footrulewidth}{0pt}}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}
}
%BIBLIOGRAPHY
\usepackage{bibgerm}
\usepackage[sortcites,style=numeric,sorting=none,backend=biber]{biblatex}
\IfFileExists{content/bib/bibliography_final.bib}
{\bibliography{content/bib/bibliography_final.bib}}%
{%
\IfFileExists{content/bib/bibliography.bib}%
{\bibliography{content/bib/bibliography.bib}}%
{%
\typeout{bibliography not found, using empty!}%
\bibliography{content/bib/empty.bib}%
}%
}%
%HYPERLINKS BOOKMARKS
\usepackage{hyperref} %Links
\hypersetup{colorlinks =false,linkbordercolor = {0 0 0},linktoc = all,pdfborder = {0 0 0},bookmarksdepth = subsection,bookmarksnumbered = true}
\urlstyle{same}
\usepackage[]{bookmark}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\tableofcontents
\chapter{Chapter}
Text \cite{a,b,c,d,e,f,g,h,i,j}
\section{Section}
More text
\newpage
\setstretch{1.5}
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyhead[R]{\normalsize \bfseries \thepage}
\fancyhead[L]{\normalsize \bfseries Literatur}
\renewcommand{\headrulewidth}{0.75pt}
\renewcommand{\footrulewidth}{0pt}}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\pagestyle{plain}
\printbibliography
\addcontentsline{toc}{chapter}{Literatur}
\end{document}
You can use \phantomsection before the \addcontentsline{toc}{chapter}{Literatur} line to give hyperref something it can jump to.
Please also note, that the biblatex syntax for adding a bib file is \addbibressource instead of \bibliography
\documentclass[fontsize=11pt,paper=a4,oneside,toc=listof,listof=totocnumbered,ngerman]{scrreprt}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[babel,german=guillemets]{csquotes}
\usepackage[sfdefault]{FiraSans}
\usepackage[T1]{fontenc}
\renewcommand*\oldstylenums[1]{{\firaoldstyle #1}}
%SPACING
\usepackage{setspace}
\setstretch{1,3}
%PAGE SETUP
\usepackage{pdflscape}
%margins
\usepackage[paper=a4paper,left=25mm,right=25mm,top=25mm,bottom=20mm]{geometry}
%header footer
\usepackage{fancyhdr} % header field
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyhead[R]{\normalsize \bfseries \thepage}
\fancyhead[L]{\normalsize \bfseries \thechapter \hspace{0.5em}\leftmark}
\renewcommand{\headrulewidth}{0.75pt}
\renewcommand{\footrulewidth}{0pt}}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}
}
\begin{filecontents*}[overwrite]{\jobname.bib}
#misc{a,
author = {a},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{b,
author = {b},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{c,
author = {c},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{d,
author = {d},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{e,
author = {e},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{f,
author = {f},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{g,
author = {g},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{h,
author = {h},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{i,
author = {i},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
#misc{j,
author = {j},
title = {asdfs},
url = {https://stackoverflow.com/questions/73990151/bibliography-in-latex-either-has-a-wrong-number-or-reference-is-wrong-how-can-i?noredirect=1#comment130644039_73990151}
}
\end{filecontents*}
%BIBLIOGRAPHY
\usepackage{bibgerm}
\usepackage[sortcites,style=numeric,sorting=none,backend=biber]{biblatex}
\addbibresource{\jobname.bib}
%HYPERLINKS BOOKMARKS
\usepackage{hyperref} %Links
\hypersetup{colorlinks =false,linkbordercolor = {0 0 0},linktoc = all,pdfborder = {0 0 0},bookmarksdepth = subsection,bookmarksnumbered = true}
\urlstyle{same}
\usepackage[]{bookmark}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\tableofcontents
\chapter{Chapter}
Text \cite{a,b,c,d,e,f,g,h,i,j}
\section{Section}
More text
\newpage
\setstretch{1.5}
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyhead[R]{\normalsize \bfseries \thepage}
\fancyhead[L]{\normalsize \bfseries Literatur}
\renewcommand{\headrulewidth}{0.75pt}
\renewcommand{\footrulewidth}{0pt}}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\pagestyle{plain}
\phantomsection
\addcontentsline{toc}{chapter}{Literatur}
\printbibliography
\end{document}
I have a reference file (bib file) I want to convert it as
\bibitem[\protect\citeauthoryear{Allen C.W.}{1973}] {b1} Allen C.W., 1973,
Astrophysical quantities, ${3^{rd}}$ ed. (Athlone Press, London)
when I use
\nocite{*}
\bibliographystyle{apalike}
\bibliography{bibfile}
Output ppl file as
\bibitem[Allen, 1973]{allen1973astrophysical}
Allen, C.~W. (1973).
Combining natbib with the newapa style gives something similar:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
#BOOK{1973asqu.book.....A,
author = {{Allen}, C.~W.},
title = "{Astrophysical quantities}",
keywords = {ASTROPHYSICS, ASTRONOMICAL CONSTANTS, TABLES, HANDBOOKS},
booktitle = {London: University of London, Athlone Press, |c1973, 3rd ed.},
year = 1973,
adsurl = {https://ui.adsabs.harvard.edu/abs/1973asqu.book.....A},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}
\end{filecontents*}
\usepackage{natbib}
\begin{document}
\cite{1973asqu.book.....A}
\bibliographystyle{newapa}
\bibliography{\jobname}
\end{document}
Resulting .bbl file:
\begin{thebibliography}{}
\bibitem[\protect\citeauthoryear{{Allen}}{{Allen}}{1973}]{1973asqu.book.....A}
{Allen}, C.~W. (1973).
\newblock {\em {Astrophysical quantities}}.
\end{thebibliography}
I'm making a poster through beamer and found a problem with my bibliography style. I want my references to use the full horizontal space available in the poster, like:
(1) Authors. Title. Journal.
But instead of that, every reference get breaked in 3 lines as:
(1) Authors
Title
Journal
Example
Here's the bibliography code I've been using:
\begin{block}{References}
\small
\bibliographystyle{sbc}
\bibliography{referencias.bib}
\end{block}
The line breaks can be avoided by setting the bibliography templates like this:
\setbeamertemplate{bibliography entry article}{}
\setbeamertemplate{bibliography entry title}{}
\setbeamertemplate{bibliography entry location}{}
\setbeamertemplate{bibliography entry note}{}
MWE:
\documentclass{beamer}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
#book{knuth,
author = {Knuth, Donald E.},
title = {The {\TeX} book},
date = 1984,
maintitle = {Computers \& Typesetting},
volume = {A},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
langid = {english},
langidopts = {variant=american},
sortyear = {1984-1},
sorttitle = {Computers & Typesetting A},
indexsorttitle= {The TeXbook},
indextitle = {\protect\TeX book, The},
shorttitle = {\TeX book}
}
\end{filecontents*}
\setbeamertemplate{bibliography entry article}{}
\setbeamertemplate{bibliography entry title}{}
\setbeamertemplate{bibliography entry location}{}
\setbeamertemplate{bibliography entry note}{}
\begin{document}
\begin{frame}
\cite{knuth}
\begin{block}{References}
\small
\bibliographystyle{plain}
\bibliography{\jobname}
\end{block}
\end{frame}
\end{document}
I am using class beamer to prepare scientific presentation. The myrefernces.bib is included using \addbibresource{}. In one slide, one citation is used twice using \footcite{}. The same citation appears twice in the bottom of the slide also with different numbers. How to avoid this and make the citation appear with same number in the slide as well as through out presentation to avoid confusion.
Thanks in advance.
manual workaround:
\documentclass{beamer}
\usepackage[style=authoryear]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
#book{knuth,
author = {Knuth, Donald E.},
title = {The {\TeX} book},
date = 1984,
maintitle = {Computers \& Typesetting},
volume = {A},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
langid = {english},
langidopts = {variant=american},
sortyear = {1984-1},
sorttitle = {Computers & Typesetting A},
indexsorttitle= {The TeXbook},
indextitle = {\protect\TeX book, The},
shorttitle = {\TeX book}
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\begin{document}
\begin{frame}
test\footcite{knuth}
test\footnotemark[1]
\end{frame}
\end{document}
I have a problem with reference style in LaTeX.
I use:
\usepackage[backend=bibtex,style=authoryear]{biblatex} %
But when I look at the references, the text is not inside parentheses.
For example:
,reviewed in Roy et al. 2010
should be
,reviewed in (Roy et al. 2010)
All bibliography package have a mean to either add or not parenthesis to a citation, depending on context.
Indeed, generally it is undesirable to have all citations bracketted.
For instance, if you say "see \cite{foobar}", you probably want "see (Foobar 1999)". But in a phrase like "(\cite{foobar} also has interesting examples)", you do not want parenthesis, as "((Foobar 1999) also ...)" looks ugly and is not advised in standard typographic rules. Probably "(Foobar 1999 also has ...)" is prefered.
For this reason, in vanilla bibtex, you have \cite (without parenthesis) and \citep (with parenthesis).
In biblatex, you can do the same. Instead of using \cite, use \parencite to get citations with parenthesis.
Another approach to add parenthesis around the citations is to change the definition of the \cite macro:
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
#book{knuth,
author = {Knuth, Donald E.},
title = {The {\TeX} book},
date = 1984,
maintitle = {Computers \& Typesetting},
volume = {A},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
langid = {english},
langidopts = {variant=american},
sortyear = {1984-1},
sorttitle = {Computers & Typesetting A},
indexsorttitle= {The TeXbook},
indextitle = {\protect\TeX book, The},
shorttitle = {\TeX book}
}
#article{einstein,
author = {Einstein, A.},
title = {Die Grundlage der allgemeinen Relativitätstheorie},
journal = {Annalen der Physik},
volume = {354},
number = {7},
doi = {10.1002/andp.19163540702},
pages = {769--822},
year = {1916}
}
\end{filecontents*}
\usepackage[backend=bibtex,style=authoryear]{biblatex}
\addbibresource{\jobname.bib}
\DeclareCiteCommand{\cite}[\mkbibparens]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{cite}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareCiteCommand*{\cite}[\mkbibparens]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{citeyear}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\begin{document}
\cite{einstein}
\printbibliography
\end{document}