I have checked several other questions addressing similar issues as this one, but I am still not able to tweak my document the way I want.
I have this 2-line chapter title:
which looks awful in the TOC, spanning 3 lines:
I tried using \\ whichs partially does the trick in the TOC (I still need to find out how to place the first word in line 2 right under the first word from line 1), but adds an aditional line in the chapter title, which I do not want.
I am aware of the optional argument for \chapter[text in TOC]{Chapter title}, but I do not want to use 2 names for the same chapter.
I tried \chapter[Control Strategies for Wave Energy Converters: \\ State-of-the-Art]{Control Strategies for Wave Energy Converters: State-of-the-Art} which does the linebreak in the TOC where I want and fixes having the aditional line in the chapter title (I still need to find out how to place the first word in line 2 right under the first word from line 1). With the downside I get a warning "Package hyperref Warning: Token not allowed in a PDF string (Unicode): removing `\' on input line 180"
I tried also \texorpdfstring{}{} given by Gonzalo:
\chapter{ \texorpdfstring{Control Strategies for Wave Energy Converters:\\ State-of-the-Art}{Control Strategies for Wave Energy Converters: State-of-the-Art} }
but I get the same result as just using \\.
Any guidance?
Cheer!
Here is the whole "MWE" (sorry, maybe no so minimum):
\documentclass[twoside,12pt,openright]{scrbook}
\usepackage[a4paper,left=2.5cm,right=2.5cm,top=3cm,bottom=3cm,
bindingoffset=0cm,includefoot=false,twoside]{geometry}
\usepackage[dvipsnames]{xcolor}
\usepackage[pdftex]{graphicx}
\usepackage{titletoc}
\usepackage{hyperref}
\hypersetup{plainpages=false, colorlinks=true,citecolor=blue!80, linkcolor=black, filecolor=red, urlcolor=violet,
pdfpagemode=FullScreen,pdfborder={0 0 0}, breaklinks=true, bookmarksnumbered=true, bookmarksopen=true}
\usepackage{lipsum}
\usepackage{scrlayer-scrpage}
\usepackage{xhfill}
\usepackage[sfdefault]{universalis}
\usepackage{tikz}
\usetikzlibrary{decorations, decorations.pathmorphing, decorations.pathreplacing}
\definecolor{maincolor}{cmyk}{1, .50, .10, .01}
%% Define some format spacing---------------------------------------------------------
\setlength{\parindent}{1em}\selectfont
\setlength{\parskip}{1em}\selectfont
\renewcommand{\baselinestretch}{1.25}\selectfont
%% Title format for Chapters -------------------------------------------------------
\newcommand{\ssfont}{\fontfamily{bch}\selectfont}
\newcommand{\thesischapterfont}{\color{maincolor}\normalfont\huge\ssfont}
\newcommand{\thesissectionfont}{\color{maincolor}\normalfont\Large\ssfont}
\newcommand{\thesissubsectionfont}{\color{maincolor}\normalfont\large\ssfont}
\newcommand{\fontfootertext}{\color{blue}\normalfont\footnotesize}
\newcommand{\fontfooterpagenumber}{\color{red}\normalfont\normalsize\bfseries}
% headings
\setkomafont{chapter}{\thesischapterfont}
\setkomafont{section}{\thesissectionfont}
\setkomafont{subsection}{\thesissubsectionfont}
%% Header and Footer ----------------------------------------------------------------------
\automark[section]{chapter}
\setlength{\headheight}{19pt}
\setlength{\footheight}{160pt}
\setlength{\footskip}{185pt}
\KOMAoption{footwidth}{foot:53pt}
\setkomafont{pagefoot}{\fontfootertext}
\setkomafont{pagenumber}{\fontfooterpagenumber}
%% command to print the TOC ---------------------------------------------
\titlecontents{chapter}[0pc]{\addvspace{1pc}}
{\begin{tikzpicture}[remember picture, overlay]
\draw[fill=maincolor!90,draw=maincolor!90,rounded corners=5pt] (-2.8,-.2) rectangle (1,.7) node[align=center,font=\color{white}\large\scshape\bfseries, xshift=-1.8cm,yshift=-0.5cm]{Chapter\ \thecontentslabel};
\end{tikzpicture}\hspace{1.5cm}\color{maincolor!90}\large\scshape\bfseries}
{\hspace{1.5cm}\color{maincolor!90}\large\scshape\bfseries}
{\color{maincolor!90};\dotfill\quad\large\scshape\bfseries\thecontentspage}[\addvspace{0pc}]
%*****************************************************
\titlecontents{section}[2.4pc]{\addvspace{0pc}}
{\hspace{1.6cm}\contentslabel[\thecontentslabel]{2.4pc}}{}
{;\dotfill;\normalsize \thecontentspage} [\addvspace{-0.5pc}]
%*****************************************************
\titlecontents{subsection}[5pc]{\addvspace{0pc}}
{\hspace{1.6cm}\contentslabel[\thecontentslabel]{2.4pc}}{}
{;\dotfill;\normalsize\thecontentspage} [\addvspace{-0.5pc}]
%*****************************************************
\makeatletter
\renewcommand{\tableofcontents}{
\chapter{
\vspace{-1cm}
\begin{tikzpicture}[remember picture, overlay]
% Output the chapter image
\clip (current page.north west) rectangle ([yshift=-8cm]current page.north east);
\node[anchor=north west,inner sep=0pt] at (current page.north west) {\includegraphics[width=\paperwidth]{example-image-a}};
% Box with the chapter title
\draw[anchor=west] (current page.north west) node [
anchor=north west, xshift=3cm, yshift=-3.5cm,
line width=2pt, rounded corners=10pt,
draw=maincolor, fill=black!5,
fill opacity=0.1, text opacity=1,
inner ysep=12.5pt, inner xsep=20pt,
align=flush left, text width=1.2\linewidth,
font=\Huge\sffamily\scshape\bfseries\color{maincolor}] { \contentsname };
\end{tikzpicture}}
@starttoc{toc}}
\makeatother
% Begin document ---------------------------------------------
\begin{document}
\frontmatter
\pagenumbering{roman}
\pagestyle{empty}
\setcounter{tocdepth}{2}
\tableofcontents
\cleardoublepage
\mainmatter
\pagenumbering{arabic}
\setcounter{page}{1}
\pagestyle{headings}
% Chapter 1 -----------------------------------
\chapter{Introduction}
\lipsum[1-3]
\section{Section 1}
\lipsum[1-5]
\subsection{Subsection 1}
\lipsum[1-3]
\subsection{Subsection 2}
\lipsum[1-3]
\section{Section 2}
\lipsum[1-3]
% Chapter 2 -----------------------------------
\chapter{Control Strategies for Wave Energy Converters: State-of-the-Art}
\lipsum[1-3]
\section{Section 1}
\lipsum[1-5]
\subsection{Subsection 1}
\lipsum[1-3]
\subsection{Subsection 2}
\lipsum[1-3]
\section{Section 2}
\lipsum[1-3]
% Chapter 3 -----------------------------------
\chapter{Optimal Control for Wave Energy Converters: Contributions}
\section{Manuscript 2: Model Predictive Control for Wave Energy Converters: A Moving Window Blocking Approach}
\lipsum[1-3]
\section{Section 1}
\lipsum[1-3]
\section{Section 2}
\lipsum[1-3]
\section{Manuscript 2: Efficiency-aware nonlinear model-predictive control with real-time iteration scheme for wave energy converters}
\lipsum[1-3]
\section{Section 1}
\lipsum[1-3]
\section{Section 2}
\lipsum[1-3]
\section{Manuscript 3: Nonlinear Model Predictive Control based on Real-Time Iteration Scheme for Wave Energy Converters using WEC-Sim}
\lipsum[1-3]
\section{Section 1}
\lipsum[1-3]
\section{Section 2}
\lipsum[1-3]
\end{document}
Edited version:
I tried @Jasper proposal, but still with no avail:
using the "normal" \chapter{Control Strategies for Wave Energy Converters: State-of-the-Art} and \chapter{Optimal Control for Wave Energy Converters: Contributions}










chapterto 1.5 cm generally (\titlecontents{chapter}[1.5cm]...) and shift thetikzpicture1.5 cm to the left. This way, multiple lines will align properly and there is no need for manual line breaks any more. – Jasper Habicht Jul 30 '22 at 09:56