In my tex file I have changed the chapter name from 'Chapter' to 'Day', using:
\renewcommand \chaptername {Day}
But when I generate a table of contents it only shows '1' and not 'Day 1'. How do I get the 'Day' to show up in the contents?
chapterstable of contentstocloft
In my tex file I have changed the chapter name from 'Chapter' to 'Day', using:
\renewcommand \chaptername {Day}
But when I generate a table of contents it only shows '1' and not 'Day 1'. How do I get the 'Day' to show up in the contents?
Best Answer
I recommend using the
tocloft
package, although I suspect thetitletoc
package could also be used quite easily.tocloft
provides many hooks for content to be inserted into the table of contents.Here's an example:
In this case
\cftchappresnum
inserts its argument in thechap
entry,pre
(before) thesnum
(sectioning number).As mentioned by Juan (thanks!), it's also necessary to increase the size of the space allocated for the "chapter number". In this case we calculate how large Day 999 would be (using the calc package) and use that length.