Quantcast
Channel: Active questions tagged starred-version - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 63

Unnumbered centered part: linebreak in table of contents

$
0
0

I am working on a XeLaTeX “book” document, which is separated in two unnumbered parts. These two parts need to be entitled according to a “Title / Subtitle” scheme, with a linebreak as a separator between the title and the subtitle (both being quite short).

Therefore, it's quite logically (I guess?) that I have ended up doing this:

\part*{Title of my part\\Its subtitle}

which is producing what I want.

Then, to make my parts appear in the table of contents, as for every starred sections I have added the appropriate \addcontentsline:

\part*{Title of my part\\Its subtitle}\addcontentsline{toc}{part}{Title of my part}

In my table of contents, I want my parts to appear in a certain manner, which involves no page number and a centered alignment. Here is what I have thus written in my preamble, using titletocs's \titlecontents to redefine the aspect of the titles in the ToC:

\usepackage{titletoc}% Part aspect in ToC: vertical spacing before and after, centering, uppercase, no page number:\titlecontents{part}[0em]{\addvspace{\baselineskip}\begin{center}}{}{\MakeUppercase}{}[\end{center}\addvspace{\baselineskip}]% (Linebreaks after each argument for readibility)

The thing works exactly as I was hoping, except that I don't find the correct way to add my linebreak into the \addcontentsline without causing an error:

\part*{Title of my part\\Its subtitle}\addcontentsline{toc}{part}{Title of my part\\Its subtitle} % Linebreak doesn't work!

I have found several solutions here to make it work for any chapter or section, but my parts appear to function differently… According to what the console seems to say, I believe that the centering used in the redefinition of the aspect of \part in the ToC is involved.

Any ideas how to include a working linebreak in there?

Thanks a lot!

Edit: Here is below a MWE!

% Minimal Working Example\documentclass[12pt, twoside, openright]{book}\usepackage{titletoc}% Part aspect in ToC: vertical spacing before and after, centering, uppercase, no page number:\titlecontents{part}[0em]{\addvspace{\baselineskip}\begin{center}}{}{\MakeUppercase}{}[\end{center}\addvspace{\baselineskip}]\begin{document}\part*{Title of my part\\Its subtitle}\addcontentsline{toc}{part}{Title of my part\\Its subtitle} % Linebreak doesn't work!\tableofcontents\end{document}

Viewing all articles
Browse latest Browse all 63

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>