jbezos/titlesec

feature req: mechanism of formatting \contentsname (i.e., the 'Contents' heading)

Closed this issue · 4 comments

As the title says, it would be nice to have a means, native to this package,
to format \contentsname.

My toc is formatted with a fair amount of \uppercase and \MakeUppercase,
so a vanilla 'Contents' without such formatting is a bit jarring, to say the least.

While I can load tocloft, and use this snippet:

\addto\captionsenglish{\renewcommand{\contentsname}{CONTENTS}}
\renewcommand{\cfttoctitlefont}{\filcenter\bfseries\large}

to achieve mostly what I want, the C of Contents and the C of Chapter x are
vertically aligned with one another (this occurs whether using \centering
or \filcenter in the cfttoctitlefont bit).
While Contents is actually centered on the page, verified by a simple
'open in gimp and use rectangular select', the overall appearance is that its
shifted to the right of 'the center used by Chapter x' and the chapter title
below it.

the code I'm using for chapter headings is below (replicating an old book
as near as one can)

\titlecontents{chapter}
    [0em]
    {\filcenter\normalfont}
    {\MakeUppercase{\chaptertitlename\ \thecontentslabel}\\\addvspace{3pt}\uppercase}
    {}
    {}[\addvspace{3pt}]

result:

  CONTENTS
  CHAPTER XIII
CHAPTER NAME HERE

desired:

    CONTENTS
  CHAPTER XIII
CHAPTER NAME HERE

The actual effect is more jarring, but you get the point.

jbezos commented

The actual effect is more jarring, but you get the point.

🤔 Sorry, I don’t get the point 🙂, and I don’t fully understand what are trying to achieve.

Beh. I'll put together a full MWE when I get some time, but the example text illustrates
the issue quite well. Given the snippet I gave, the string 'Contents' is aligned 'wrong'
and appears off-center relative to the strings 'Chapter XIII' and 'CHAPTER NAME HERE'.

jbezos commented

Feel free to reopen this issue with a MWE.