I got a problem with one page number in the toc: the one of the 'References' generated by biblatex. I am always using the command \addcontentsline{toc}{chapter}{title}
to add stuff to the TOC, and in all other cases it worked fine (list of tables etc.).
Problem description: The page number in the toc is always the last page of the References. This means if the References are from page 80 to page 84, then in the TOC page 84 is used (instead of page 80 where the References begin).
edit: KOMA script provides bibliography=totoc
which solves the issue. However, if anyone could explain why \addcontentsline{toc}{chapter}{title}
works for other lists but not for the library, I would be thankful.
I cannot hand out my lib-file (named Lib1 in the code), but you could simply import one of yours which is a few pages long to see the problem.
Here is my preamble. As I don't know what the reason is, I have kept most of the definitions and macros generated from helpful users of these forums in. I only removed stuff which I was certain that it is harmless (e.g. table definitions etc.). The appendices have been made by @karlkoeller. But I don't think they are the problem because they start after the bibliography.
Thanks for any help!
\documentclass[a4paper, 12pt, headsepline, headings=small, numbers=noendperiod]{scrreprt}
\usepackage{float}
\usepackage[onehalfspacing]{setspace}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathptmx}
\usepackage[a4paper,showframe]{geometry}
\geometry{left=2cm,right=5cm,top=2cm,bottom=2cm,foot=1.5cm}
\usepackage{csquotes}
\usepackage{environ}
\usepackage[backend=bibtex8,
style=authoryear-icomp,
dashed=false,
autocite=footnote,
maxcitenames=3,
mincitenames=1,
maxbibnames=100,
firstinits=true,
sorting=nyvt
]{biblatex}
\bibliography{Lib1}
\usepackage{chngcntr}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
\counterwithout{equation}{chapter}
\counterwithout{footnote}{chapter}
\renewcommand{\floatpagefraction}{0.85}
\renewcommand\bottomfraction{0.65}
\setcounter{topnumber}{1}
\newcommand\appendicesname{Appendix}
\newcommand\listofloaname{List of Appendices}
\newcommand*{\listofappendices}{\listoftoc{loa}}
\setuptoc{loa}{totoc}
\makeatletter
\g@addto@macro\appendix{%
\counterwithin{table}{chapter}
\renewcommand*{\tableformat}{\tablename~\thetable}
\let\oldaddcontentsline\addcontentsline
\newcommand\hackedaddcontentsline[3]{\oldaddcontentsline{loa}{#2}{#3}}
%
%\newcommand\hackedtableaddcontentsline[3]{\oldaddcontentsline{loa}{#2}{\tableformat}}
%
\newcommand\hackedtableaddcontentsline[3]{\oldaddcontentsline{loa}{#2}{#3}}
%
\let\oldpart\part
\renewcommand*\part[1]{%
\let\addcontentsline\hackedaddcontentsline%
\oldpart{#1}%
\let\addcontentsline\oldaddcontentsline%
}
\let\oldchapter\chapter
\renewcommand*\chapter[1]{%
\let\addcontentsline\hackedaddcontentsline%
\oldchapter{#1}%
\let\addcontentsline\oldaddcontentsline%
}
\let\oldsection\section
\renewcommand*\section[1]{%
\let\addcontentsline\hackedaddcontentsline%
\oldsection{#1}%
\let\addcontentsline\oldaddcontentsline%
}
\let\oldsubsection\subsection
\renewcommand*\subsection[1]{%
\let\addcontentsline\hackedaddcontentsline%
\oldsubsection{#1}%
\let\addcontentsline\oldaddcontentsline%
}
\let\oldsubsubsection\subsubsection
\renewcommand*\subsubsection[1]{%
\let\addcontentsline\hackedaddcontentsline%
\oldsubsubsection{#1}%
\let\addcontentsline\oldaddcontentsline%
}
\let\oldtable\table
\renewcommand*\table{%
\let\addcontentsline\hackedtableaddcontentsline%
\oldtable%
}
\let\oldendtable\endtable
\renewcommand*\endtable{%
\oldendtable%
\let\addcontentsline\oldaddcontentsline%
}
}
\makeatother
\newlength\myindention
\setlength\myindention{1em}
\let\oldcaption\caption
\renewcommand*\caption[2][]{%
\oldcaption[#1]{#1\\\hspace*{\myindention}#2}%
}
% Biblatex:
\DeclareNameAlias{sortname}{last-first}
\DeclareNameAlias{default}{last-first}
\DeclareFieldFormat{title}{#1}
\DeclareFieldFormat
[article,inbook,incollection,inproceedings,patent,thesis,unpublished]
{title}{#1}
\DeclareFieldFormat{journaltitle}{#1}
\renewbibmacro*{cite:labelyear+extrayear}{%
\iffieldundef{labelyear}
{}
{\printtext[bibhyperref]{%
\printtext[parens]{%
\printfield{labelyear}%
\printfield{extrayear}}}}}
\renewbibmacro*{date+extrayear}{%
\iffieldundef{\thefield{datelabelsource}year}
{}
{%\printtext[parens]{%
\setunit{\addcomma\space}%
\iffieldsequal{year}{\thefield{datelabelsource}year}
{\printdateextralabel}%
{\printfield{labelyear}%
\printfield{extrayear}}}}%}%
\renewbibmacro*{publisher+location+date}{%
%
\printlist{publisher}%
\setunit*{\addcomma\space}%
%\printlist{publisher}%
%\setunit*{\addperiod\space}%
%
\printlist{location}%
\setunit*{\addcomma\space}
\usebibmacro{date}%
\newunit}
\renewbibmacro*{institution+location+date}{%
\printlist{institution}%
\setunit*{\addcomma\space}%
\printlist{location}%
\setunit*{\addcomma\space}
\usebibmacro{date}%
\newunit}
\renewbibmacro*{organization+location+date}{%
\printlist{organization}%
\setunit*{\addcomma\space}%
\printlist{location}%
\setunit*{\addcomma\space}
\usebibmacro{date}%
\newunit}
\renewbibmacro{in:}{%
\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
\setunit*{\addspace}%
\printfield[parens]{number}%
\setunit{\addcomma\space}%
\printfield{eid}}
\begin{document}
\tableofcontents
\listoftables
\addcontentsline{toc}{chapter}{List of tables}
\nocite{*}
\printbibliography[title={References}]
\addcontentsline{toc}{chapter}{References}
\listofappendices
\begin{appendix}
\setlength{\abovecaptionskip}{-8pt}
\chapter{Appendix Chapter}
\end{appendix}
\end{document}