1

how can I modify numberless chapters as Table of contents in book or report class? the following code, f.e., doesn't anthing. Wrong syntax or something else?

\documentclass[a4paper]{report}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{english}
\setmainfont[Ligatures=TeX,Numbers=OldStyle]{EB Garamond}

\usepackage{titlesec,titletoc}
\titleformat{name=\chapter,numberless}{\normalfont\huge}{}{0pt}{}[rightmargin]

\begin{document}

%\renewcommand*\contentsname{\hfill\mdseries\huge Contents\hspace*{1.2em}}

\tableofcontents

\end{document}
user41063
  • 1,967

1 Answers1

2

\titleformat{name=\chapter,numberless}... does nothing if it is not accompanied by a definition of the format for numbered chapters.

Adjust at will.

\documentclass[a4paper]{report}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{titlesec,titletoc}

\setmainlanguage{english}
\setmainfont[Numbers=OldStyle]{EB Garamond}

\titleformat{name=\chapter}[display]
 {\normalfont\huge}
 {\chaptername\ \thechapter}
 {1ex}
 {}

\titleformat{name=\chapter,numberless}[display]
  {\normalfont\huge}
  {}
  {0pt}
  {}

\begin{document}

\tableofcontents

\chapter{xx}

\end{document}
egreg
  • 1,121,712