I want to get the following output:
In words:
- insert a table of contents for the current part (works fine)
- Be able to put some text before the ToC (doesn't work)
As I understand it, it is partly because the \par is the argument of a non \long macro, and also because I still type text inside the label.
So how do I get out of the label and type whatever text I want below it?
MWE
\documentclass{book}
\usepackage{titlesec,titletoc}
\titleformat{\part}[display]
{}
{\centering\huge\bfseries\partname~\thepart}
{0pt}
{\centering\huge}
[Here is the TOC:\par%
{\normalsize\startcontents[parts]%
\printcontents[parts]{}{0}[2]{}}
]
\begin{document}
\part{Introduction}
\chapter{ch one}
\section{sec one}
\end{document}


latex.ltxsays\let\endgraf=\parbut\show\endgrafgives a much longer definition. Why? – tush May 23 '23 at 11:57\show\parwill give you the same. This is due to the "para hooks" added by LaTeX since October 2020 release. But\paris modified by LaTeX list environments and there the sync with\endgrafis lost. – user691586 May 23 '23 at 12:10\let\foo\bar, then\show\fooshows you the full meaning of\barat time of the\let. In Plain TeX,\paris a primitive sotexdef endgrafwill show you\endgraf:<on next line>\paras it has no meaning like a macro; with LaTeX, the TeX\paris saved as\@@parand\parbecomes a macro, especially since "para hooks" have been added, but already earlier inside lists. – user691586 May 23 '23 at 12:14\endgrafhere:{\centering\huge\endgraf}(at the end of thebegin-code) is not helpful? – tush May 23 '23 at 12:30\endgrafis then executed too early, this\centering\hugeis beforeIntroduction(edited) is typeset. To be honest ask someone who actually is willing to read titleformat source code... (I have little experience with packagetitlesecand none withtitletoc) – user691586 May 23 '23 at 12:35