Text Formatting ⇒ Center 'Page' over page number in TOC.
Center 'Page' over page number in TOC.
Also, how can I get the word 'Figure' to appear above my figure numbers in my table of figures?
Thanks!
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
Center 'Page' over page number in TOC.
Welcome to the LaTeX community!
Would you please add a

Regards
Center 'Page' over page number in TOC.
Code: Select all
\addtocontents{toc}{~\hfill\textbf{Page}\par}
\addtotoc{Title Page}{\maketitle} % Generate the title page
\doublespacing % Text should be double spaced
\setcounter{page}{2} % Abstract begins on page 2
\addtotoc{Abstract}{\input{abstract.tex}} % Generate the abstract
\singlespacing % Single space the lists
\tableofcontents \clearpage % Generate the Table of Contents
\addtocontents{lof}{~\hfill\textbf{Page}\par}
\addtotoc{List of Figures}{\listoffigures} % Generate the List of Figures
- Stefan Kottwitz
- Site Admin
- Posts: 10324
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Center 'Page' over page number in TOC.
welcome to the board!
Did you see this in good books? Centering "Page" over page numbers of variable width? You have arabic numbers with a single digit and I guess probably also larger numbers, and roman numbers of varying width, such as i and iv which we can see. So, do you want a centered position in relation to some single digit (even i is thinner than 2), or regarding two or three digits or numbers such as viii?
Consequently, all numbers should be centered below "Page", but it results in a ragged right margin.
The simple solution is, to keep it flush right. This is consistent with the full justification of LaTeX in general: a straight left text edge, a straight right edge.
Do you agree, or how exactly do you desire the centering then?
Stefan
Re: Center 'Page' over page number in TOC.
Re: Center 'Page' over page number in TOC.
Center 'Page' over page number in TOC.
You can try this, it does the trick :
Code: Select all
\documentclass[12pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\usepackage{blindtext}
\def\clap#1{\hbox to 0pt{\hss #1\hss}}% like \rlap or \llap, but centered
\newcommand{\mypage}{\clap{Page~~}}% unbreakable spaces are needed to adjust centering of the "Page" word
\addtocontents{toc}{\hfill{\bfseries\mypage}\par\nobreak}
\begin{document}
\tableofcontents
\blinddocument
\end{document}