# texorpdfstring with two arguments

The space between the first and the second chapter is different. I know the issue is with the newcommand \chapterAndAuthor with the texorpfdstring command. I added the command texorpfdstring to get no format settings in the bookmarks. Without the texorpfdstring the format setting working fine. So I read the texorpfdstring comes with two arguments, but anyway I can't handle it. Please have a look at the img.(I know KOMA, titlesec and titletoc is not a good way). \parbox[t] is not a good solution for me, because the page number is not behind the dots...

\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}
\usepackage[hyphens]{url}
\usepackage{multicol}
\usepackage[colorlinks=false, pdfborder={0 0 0}]{hyperref}
\urlstyle{same}

% section itshape
\titleformat*{\section}{\itshape}
\titleformat*{\subsection}{\itshape}
\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.42cm}
%%% Chapter style
\titleformat{\chapter}[display]
{\normalfont}{\chaptertitlename\ \thechapter}{12pt}{\Large}

\titlecontents{chapter}
[0pt]% Left margin, optional
{}% Code insertet above
{\mdseries}% Numbered-entryformat
{\mdseries}% Numberless-format
{\contentspage} % 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%
% Minipage to keep the author and chaptertitle on same page
\noindent\begin{minipage}{\textwidth}
% Set the author style
{\selectfont\fontsize{12}{14} \itshape{#1}}
% Bring the chaptertitle closer to the authortitle
\vspace{-3\baselineskip}
% Add an entry to the Table of Contents, with the name of the author in emph and the chapter title
% For long chapter titles using a \parbox
\hspace*{1em}\protect\parbox[b]{\textwidth}{#2 \dotfill}}{#2}}
% Print the chapter
\chapter*{#2}
\end{minipage}
}

\setlength\cftparskip{0.21cm}
\setlength\cftbeforesecskip{10pt}
\setlength\cftaftertoctitleskip{10pt}
%pagestyle%
\pagestyle{plain}

\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}
\lipsum[1-4]
\vspace{0.84cm}
\lipsum[1-4]
\lipsum[1-2]
\lipsum[1-2]
\chapterAndAuthor{The name of the second author}{Test Chapter Two}
\lipsum[1-5]

\end{document}


• I deleted my answer -- I can't help you here.
– user31729
Jun 26 '16 at 9:17
• The moment i got confused was \chapterAndAuthor having the author as the first argument and chapter as the second, whereas the name implies something different. Jun 26 '16 at 9:54

You should enclose everything in a \parbox, not just the chapter title.

By the way, you should not load both titletoc and tocloft. The -15pt bit should correspond to some parameter in titletoc, find out which one.

Add also a better separation between titles in the TOC.

I removed most of the unnecessary package for the example. Changing \contentsname into Contents for the German language is dubious: if the document is in English, with parts in German, switch the position of the languages in the declaration: \usepackage[ngerman,english]{babel}.

\documentclass[10pt,draft]{scrbook}

\usepackage{titlesec}
\usepackage{titletoc} % modify toc title
\usepackage{lipsum} % dummy text
\usepackage[colorlinks=false, pdfborder={0 0 0}]{hyperref}
\urlstyle{same}

% section itshape
\titleformat*{\section}{\itshape}
\titleformat*{\subsection}{\itshape}
\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.42cm}
%%% Chapter style
\titleformat{\chapter}[display]
{\normalfont}{\chaptertitlename\ \thechapter}{12pt}{\Large}

\titlecontents{chapter}
[0pt]% Left margin, optional
{}% Code insertet above
{\mdseries}% Numbered-entryformat
{\mdseries}% Numberless-format
{\contentspage} % 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
\cleardoublepage
% 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{-3\baselineskip}
% the author in emph and the chapter title
\texorpdfstring{%
\protect\parbox[b]{\dimexpr\textwidth-15.5pt}{
\normalfont #1%
\endgraf\vspace{1ex}
\leftskip=1em #2 \dotfill
}%
}{#2}%
}
% Print the chapter
\chapter*{#2}
\endgroup
}

%pagestyle%
\usepackage[
paperheight=21.0cm,
paperwidth=13.5cm,
twoside,
textwidth=10.3cm,
textheight=16.3cm,
showframe, % <---- Just for the example
]{geometry}
\pagestyle{plain}

\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}
\lipsum[1-4]
\vspace{0.84cm}