1

I want to make the word 'Page' centered over page numbers for the following Latex template in the following pages:

  • table of contents
  • table of figures
  • table of tables

I tried this solution, but it's not reliable since I have 'Title/Table/Figure' words on the other side of the page.

The following is a screenshot of the current template ('page' word aligned right): enter image description here

4
  • I am not sure, where the word "Page" should apear, do you want to write it as table heading or do you want to write it above the pagenumber of the page, where the toc/tof/tot is printed to?
    – NelDav
    Aug 27, 2019 at 19:54
  • @Ahrtaler I've updated the question to be more clear Aug 27, 2019 at 20:05
  • I think, I know what you mean. The problem is, that the pagenumbers are aligned right. That means, if you want, that "Page" is centered above the pagenumbers, also the pagenumbers have to be aligned centered. I am not sure, how to align them centered. Setting the alignment of "Page" centered, means, to override the \tableofcontents command of the class. Setting the alignment of "Page" wouldn't effect anything, if you keep this implementation. But I am sorry. My LaTeX skills are not good enougth to set the alignment of toc-pagenumbers and "Page".
    – NelDav
    Aug 27, 2019 at 20:36
  • @Ahrtaler yes that's what I want, thank you anyway,waiting for an answer from latex expert, I think it's not easy Aug 27, 2019 at 21:15

1 Answer 1

1

What do you mean by centered? In your example should Page be centered with respect to the page I, or the page II, or in the middle of II?

Here is some code for you, and others, to try.

\documentclass{book}
\usepackage{lipsum}
\begin{document}
\frontmatter
\pagenumbering{Roman}
\tableofcontents
\addtocontents{toc}{Title \protect\hfill \rlap{\hspace{-1.5em}Page}

\chapter{Dedication}
\lipsum
\chapter{Acknowledgement}
\mainmatter
\chapter{One}
\end{document}

The \addtocontents{file}{text} inserts text into file where file is normally one of toc, lof or lot for the table of contents and the list of... files.

The \rlap effectively makes its argument take zero space and then the `\hspace{-1.5em} moves the zero-spaced text left the given amount. This should be adjusted to your particular document design.

I found one problem with the above code in that an error (missing \item ?) was reported for the Dedication ToC entry. Just ignoring this everything looked well. Hopefully somebody will provide a solution to this.

I have now found a solution as below:

% tocpageprob.tex SE 505981
\documentclass{book}
\usepackage{lipsum}
\begin{document}
\frontmatter
\pagenumbering{Roman}
%\tableofcontents
\addtocontents{toc}{Title \protect\hfill \rlap{\hspace{-1.5em}Page}\par}
\tableofcontents

\chapter{Dedication}
\lipsum
\chapter{Acknowledgement}
\mainmatter
\chapter{One}
\end{document}

I messed up my original code for the \addtocontents{toc}{...}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .