Referring to this tread Section titles alignement with titletoc
I've a further and (I hope) last question. I've a problem to apply this code to subsection to obtain this result:
My (wrong) code it's only a rough and wrong attempt to change the fine code already suggested to me:
\documentclass[a4paper]{report}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{english}
\setmainfont[Ligatures=TeX,Numbers=OldStyle]{EB Garamond}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% TABLE OF CONTENTS SETTINGS
\usepackage{titletoc}
% book -- titletoc patch for \part:
% https://tex.stackexchange.com/a/454553/134574
\usepackage{etoolbox}
\makeatletter
\patchcmd\@part
{\thepart}
{\protect\numberline{\thepart}}
{}{\FAIL}
\makeatother
\makeatletter
\contentsmargin[-1.55em]{1.55em}
\titlecontents{chapter}
[0em]
{\vspace*{\baselineskip}}
{\mdseries
\llap{\hb@xt@\@pnumwidth{\hfil}\quad}\thecontentslabel
\vspace*{0.1\baselineskip}%
\upshape
}
{\mdseries
\llap{\hb@xt@\@pnumwidth{\hfil\thecontentspage}\quad}
}
{}
[]
\titlecontents{section}
[0em]
{\vspace*{\baselineskip}}
{\mdseries
\llap{\hb@xt@\@pnumwidth{\hfil\thecontentspage}\quad}\thecontentslabel}
{\mdseries
\llap{\hb@xt@\@pnumwidth{\hfil\thecontentspage}\quad}
}
{}
[]
\titlecontents*{subsection}
[0em]
{}
{\footnotesize}
{}
{\footnotesize,~\thecontentspage}
[~--~]
[]
\makeatletter\@addtoreset{chapter}{part}\makeatother
% make chapter begin from 1 every part
\renewcommand{\thechapter}{\scshape\roman{chapter}}
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\renewcommand*\contentsname{\hfill\mdseries\huge Contents}
% put ToC title in the right side of the page
\tableofcontents
\chapter{A Very Short History of Rethorics}
\section{The Greek World}
\subsection{Aristoteles}
\subsection{The hellenistic Age}
\subsection{The Latin World}
\subsection{Aristoteles}
\subsection{The hellenistic Age}
\subsection{The Latin World}
\subsection{Aristoteles}
\subsection{The hellenistic Age}
\subsection{The Latin World}
\subsection{Aristoteles}
\subsection{The hellenistic Age}
\subsection{The Latin World}
\chapter{A Very Short History of Rethorics}
\section{The Greek World}
\subsection{Aristoteles}
\subsection{The hellenistic Age}
\subsection{The Latin World}
\subsection{Aristoteles}
\subsection{The hellenistic Age}
\subsection{The Latin World}
\subsection{Aristoteles}
\subsection{The hellenistic Age}
\subsection{The Latin World}
\subsection{Aristoteles}
\subsection{The hellenistic Age}
\subsection{The Latin World}
\end{document}
I was not able to product the correct alignement of chapter and section numbers.
At last, I don't understand why
\renewcommand*\contentsname{\hfill\mdseries\huge Contents}
works only if I put in after \begin{document}, and not into the preamble
thanx!
ADDEDNDUM NOVEMBER 4TH
I've a further, little problem with numberless chapters. Consider the following code:
\begin{filecontents*}{\jobname.bib}
@book{ bottero:1992,
author = "Vickers, Brian.",
title = "In Defence of Rhetorics",
publisher = "Clarendon Press",
location = "Oxford",
year = "1989",
}
\end{filecontents*}
\documentclass[a4paper]{report}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{english}
\setmainfont[Ligatures=TeX,Numbers=OldStyle]{EB Garamond}
\usepackage{titletoc}
\titlecontents{chapter}
[3em]
{\vspace*{\baselineskip}\mdseries}
{\contentslabel[\hfill\thecontentslabel\phantom{.}]{3em}\enspace}
{}
{\hfill\llap{\makebox[\dimexpr\linewidth-1.3pc][l]{\thecontentspage}}}
[]
\titlecontents{section}
[3em]
{\vspace*{\baselineskip}\mdseries}
{\contentslabel[\hfill\thecontentslabel]{3em}\enspace}
{}
{\hfill\llap{\makebox[\dimexpr\linewidth-1.3pc][l]{\thecontentspage}}}
[]
\titlecontents*{subsection}
[3.525em]
{\footnotesize}
{}
{}
{,~\thecontentspage}
[~--~]
[]
\makeatletter\@addtoreset{chapter}{part}\makeatother
% make chapter begin from 1 every part
\renewcommand{\thechapter}{\scshape\roman{chapter}}
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
\usepackage[backend=biber,style=philosophy-verbose,scauthors=all,%
lowscauthors=true,giveninits,classical=true,volnumformat=strings,%
volumeformat=romansc,sorting=nyt,commacit=true,citepages=omit,%
editionformat=superscript,indexing]{biblatex}
\usepackage{filecontents}
\addbibresource{\jobname.bib}
\nocite{*}
\begin{document}
\renewcommand{\thesection}{\arabic{section}.}
\renewcommand*\contentsname{\hfill\mdseries\huge Contents\hspace*{1.2em}}
\tableofcontents
\chapter{A Very Short History of Rhetoric}
\section{The Greek World}
\subsection{Aristoteles}
\subsection{The hellenistic Age}
\subsection{The Latin World}
\subsection{Aristoteles}
\subsection{The hellenistic Age}
\subsection{The Latin World}
\subsection{Aristoteles}
\subsection{The hellenistic Age}
\subsection{The Latin World}
\subsection{Aristoteles}
\subsection{The hellenistic Age}
\subsection{The Latin World}
\chapter{A Very Short History of Rhetoric}
\section{The Greek World}
\subsection{Aristoteles}
\subsection{The hellenistic Age}
\subsection{The Latin World}
\subsection{Aristoteles}
\subsection{The hellenistic Age}
\subsection{The Latin World}
\subsection{Aristoteles}
\subsection{The hellenistic Age}
\subsection{The Latin World}
\subsection{Aristoteles}
\subsection{The hellenistic Age}
\subsection{The Latin World}
\addcontentsline{toc}{chapter}{\bibname}
\printbibliography
\end{document}
You'll realize that the chapter title Bibliography protrudes respect the other titles, as in the attached pic:
How is it possible to aligne it correctly? Thanx


\renewcommand*\contentsname{\hfill\mdseries\huge Contents}works only if I put in after \begin{document}, and not into the preamble – user41063 Oct 30 '18 at 20:35\AtBeginDocument{...}. I suspect the problem comes from polyglossia, which redefines\contentsname,depending on the language, and does so at the beginning of the document. Anyway, what you did is bad practice:contentsnameis not contents title formatting. You should define its formatting withtitlesec, since you load its companion packagetitletoc. – Bernard Oct 30 '18 at 21:05\contentsname?withnumberless` key. It will reformat all unnumbered chapters, i.e. also the bibliography title, index title, &c.: they'll all be flushright. – Bernard Oct 30 '18 at 21:26\titleformat{name=\?????`Chapter? – user41063 Oct 30 '18 at 22:20\titleformatafter begin{document}. Or you may in `titleformat, but it would be more complex. – Bernard Oct 30 '18 at 22:21tableofcontentsis a\chapter*. – Bernard Oct 30 '18 at 22:22\titlecontents*{subsection} [3.525em]the length of 3.525 em? – user41063 Nov 04 '18 at 23:30\phantom, but or doesn't work or doesn't compile – user41063 Nov 05 '18 at 14:42\titlecontents{chapter}, which was left empty, and is used for the formatting of unnumbered chapters. – Bernard Nov 05 '18 at 18:55