I am trying to add a preface section to the table of contents, by using
\addcontentsline{toc}{chapter}{Preface}
This partially works. the preface is added, but without the page number for it (in roman letters, it should be, because it is in the frontmatter section).
In addition, the Preface line (which doesn't appear with a page number) is not aligned with the rest of the text for the chapters, since I use chapter* for it, and therefore, there is no number before it.
So it appears as:
Preface
1 Introduction
instead of
Preface
1 Introduction
When I look into the .toc file, I see:
\contentsline {chapter}{Preface}{x}{chapter*.1}
\contentsline {chapter}{\numberline {1}{Introduction}}{1}{chapter.1}
so obviously I can hack it to add a line number, I guess, but I would like to avoid it. I am not sure how to fix the alignment problem, though, through the .toc file (though, again, I wouldn't want to touch the .toc files).
Best Answer
Just a wild guess, but you could use package
unnumberedtotoc
with optionindentunnumbered
found in https://tex.stackexchange.com/a/199086/37907.As you didn't provide any useful code, this is just guesswork.