1

I manually add a entry to the ToC with dots:

\addcontentsline{toc}{chapter}{\itshape{Contributors' Addresses}  \dotfill}

But this generate me a entryin my bookmark with Contributors' Addresses to.44em. Please have a look at the image. I do not know where the to.44em is coming from.

enter image description here

   \documentclass[10pt,final]{scrbook}
\usepackage{titletoc} % modify toc title
\usepackage{lipsum} % dummy text
\usepackage{anyfontsize} % change fontsize  
\usepackage{tocloft} % design toc
\usepackage{framed, xcolor}
\usepackage[english,ngerman]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage{helvet}
\usepackage{endnotes}
\usepackage{titlesec}

%%% Change the title of toc
%%% Change "Contents" size \small, \huge, \Large,... 
\addto\captionsngerman{\renewcommand{\contentsname}{\normalfont\slshape\large{Contents}}}

% section itshape
\titleformat*{\section}{\itshape}
\titleformat*{\subsection}{\itshape}
%\titleformat*{\tableofcontents}{\itshape}

% Spacing between section and text
% Syntax: \titlespacing*{<command>}{<left>}{<before-sep>}{<after-sep>}
\titlespacing*{\subsection}{0cm}{0.84cm}{0.42cm}

\titlespacing*{\section}{0cm}{0.84cm}{0.42cm}

% Spacing between chapter and author 
\titlespacing*{\chapter}{0cm}{0.84cm}{0.84cm}

% Spacing between chapterAndAuthor and section (?)
%\titlespacing*{\chapterAndAuthor}{0cm}{1.5cm}{1cm}

%%% Chapter style
\titleformat{\chapter}[display]
  {\normalfont}{\chaptertitlename\ \thechapter}{12pt}{\Large}

% Display chapters in the Table of Contents
\titlecontents{chapter}
  [0pt]% Left margin, optional
  {}% Code insertet above
  {\mdseries}% Numbered-entryformat
  {\mdseries}% Numberless-format
  {\contentspage\vskip1.5ex} % add dotfill and pagenumber, and some vertical space between entries

% Custom command to keep the author on the same page of chaptertitle, and above it.
\newcommand{\chapterAndAuthor}[2]{%
  % #1: Author
  % #2: Chaptertitle
  \clearpage
  % Keep the author and chaptertitle on same page
  \begingroup\let\cleardoublepage\relax\let\clearpage\relax
  % Set the author style
  {\fontsize{12}{14}\itshape \noindent #1}\par
  % Bring the chaptertitle closer to the authortitle
  \vspace{-0.21cm}
  % Add an entry to the Table of Contents, with the name of 
  % the author in emph and the chapter title
  \addcontentsline{toc}{chapter}{%
    \texorpdfstring{%
      \protect\parbox[b]{\dimexpr\textwidth-15.5pt}{
        {\normalfont\itshape {#1}}%
        \endgraf\vspace{0cm}
        \leftskip=1em #2 \dotfill
      }%
    }{#2}%
  }
  % Print the chapter
  \chapter*{#2}
  \endgroup
}

\pagestyle{plain}

\usepackage[pdftex]{graphicx}
\usepackage[pdftex]{graphics}
\usepackage{supertabular}

%SEITENLAYOUT%
 \usepackage[paperheight=21.0cm,paperwidth=13.5cm,twoside,textwidth=10.3cm,textheight=16.3cm,nohead,pdftex]{geometry}

%SCHRIFTGRÃSSEN%
\usepackage{fix-cm}

\makeatletter
\g@addto@macro\normalsize{\fontsize{10.0pt}{12.0pt}\selectfont} %\fontsize{Fontgröße}{Grundlinienabstand}
\g@addto@macro\footnotesize{\fontsize{9.0pt}{11.0pt}\selectfont} %\fontsize{Fontgröße}{Grundlinienabstand}
\makeatother


\usepackage[hyphens]{url}
\usepackage{multicol}
\usepackage[colorlinks=false, pdfborder={0 0 0}, breaklinks = true]{hyperref}
\urlstyle{same}



%%%%%%%%%%%%%%%%% end preambel %%%%%%%%%%%%%

\begin{document}

\tableofcontents
\clearpage


\chapterAndAuthor{The name of the first author, The name of second author and The name of the third author}{Test Chapter One Test Chapter One Test Chapter One Test Chapter One Test Chapter One Test Chapter One Test Chapter One}

\noindent\lipsum[1]

\chapterAndAuthor{Johanna von Orleans, Charles de Secondat, Baron de MontesquieuMontesquieu, , Albert Einstein}{Test Chapter Two Test Chapter Two Test Chapter Two Test Chapter Two Test Chapter Two Test Chapter Two Test Chapter Two}

\noindent\lipsum[1]

\chapterAndAuthor{The name of the first author, The name of second author and The name of the third author}{Test Chapter Three Test Chapter Three Test Chapter Three Test Chapter Three Test Chapter Three Test Chapter Three Test Chapter Three}

\noindent\lipsum[1]

\pagebreak

\subsection*{Contributors' Addresses}
  \phantomsection

  \addcontentsline{toc}{chapter}{Contributors' Addresses \dotfill}


\end{document}
  • Second, generally you should not add \dotfill to the entry but redefine the format of the entry redefinining \l@chapter. – Schweinebacke Jan 12 '17 at 11:13
  • Third, you can try \texorpdfpdfstring{ \dotfill}{}. – Schweinebacke Jan 12 '17 at 11:14
  • I added a MWE, hopefully this helps. \texorpdfpdfstring{ \dotfill}{} do not work – mvp285286 Jan 12 '17 at 12:28
  • Is this really minimal??? – Schweinebacke Jan 12 '17 at 12:34
  • The "to44em" is the amount of space, which is added between the dotted line and the page number. – Jan Jan 12 '17 at 12:37
2

You should always protect non robust macros inside \addcontentsline otherwise their expansion will be written to the .aux- and the .toc-file.

To avoid the to.44em in the bookmarks use \texorpdfstring:

  \addcontentsline{toc}{chapter}{Contributors'
    Addresses\protect\texorpdfstring{ \protect\dotfill}{}}

You need at least two LaTeX runs after the change to get something like:

bookmarks

You may use package bookmark to have immediate bookmark changes in the first LaTeX run.

BTW: Usage of tocloft and titlesec with scrbook is not recommended.

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.