GeneralWord page before page number in table of contents

LaTeX specific issues not fitting into one of the other forums of this category.
evyn
Posts: 4
Joined: Fri May 04, 2007 11:03 am

Word page before page number in table of contents

Post by evyn »

Hi all,

Is it possible in for the TOC to put the word PAGE above the page numbers?

ALso, in the \listoffigures and \listoftables I have to put the word FIGURE or TABLE before the table or figure number. Is this possible?

TIA
Regards,
Evyn

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
countbela666
Posts: 64
Joined: Thu Apr 26, 2007 2:44 pm

Word page before page number in table of contents

Post by countbela666 »

Hi Evyn,

the [url=http://"http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=tocloft"]tocloft[/url] package allows you to customise the toc, lof and lot layout. For your purposes you could use it as follows:

Code: Select all

\documentclass[demo,english]{article}
\usepackage{babel,blindtext,graphicx,tocloft,calc}
%%% put figure and table name before number in respective list
\renewcommand{\cftfigpresnum}{\figurename~}
\renewcommand{\cfttabpresnum}{\tablename~}
%%% adjust space for formatting figure and table number in respective list
\setlength{\cftfignumwidth}{\widthof{\figurename}+2.3em}
\setlength{\cfttabnumwidth}{\widthof{\tablename}+2.3em}
%%% for demo only %%%%%%%%%%%%%%%%%%%%%
\def\demofig{\begin{figure}\centering\includegraphics{foo}\caption{I'm figure \thefigure}\end{figure}}
\def\demotab{\begin{table}\centering\caption{I'm table \thetable}\begin{tabular}{ll}a&b\\c&d\end{tabular}\end{table}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
  %%% add "page" before first toc entry
  \addtocontents{toc}{\protect\hfill{}page\par}
  \tableofcontents
  \listoffigures
  \listoftables
  %%% demo document
  \Blinddocument
  \demofig\demofig\demofig\demofig\demofig\demofig\demofig\demofig\demofig\demofig\clearpage
  \demotab\demotab\demotab\demotab\demotab\demotab\demotab\demotab\demotab\demotab\clearpage
\end{document}
Regards
Marcel
Listen to me children of the night, beyond the doors of darkness you will find
a thousand worlds for you to see here, take my hand and follow me...
evyn
Posts: 4
Joined: Fri May 04, 2007 11:03 am

Re: \tableofcontents

Post by evyn »

Thanks! I'll give it a try
monglebest
Posts: 6
Joined: Fri Jan 30, 2015 6:43 pm

Re: Word page before page number in table of contents

Post by monglebest »

The method works very well for the first page in the table of content. But it fails to do so at the second page or third page in the toc. I find a package which can help add the word page in the second page, but I cannot do the same thing for the third page of the table of contents. the same problem exists for lof/lot. Appreciate your support about this. (The similar problem reported in uafthesis as well.)



http://tex.stackexchange.com/questions/ ... f-contents
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Word page before page number in table of contents

Post by Johannes_B »

Hi and welcome,

in the linked thread, Herbert suggests to use a manual approach. Did the manual approach work for you?

On the other hand, what meaning do you expect the numbers to have? If not page numbers, like in every other book, what should that be? ;-)
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
monglebest
Posts: 6
Joined: Fri Jan 30, 2015 6:43 pm

Word page before page number in table of contents

Post by monglebest »

Hi, Johannes_B:

Thank you very much for your reply. I refer to the third page of the toc, the method provided by Herbert work fine until the second page of the toc as attached.
page1.PNG
page1.PNG (10.76 KiB) Viewed 9071 times
top page 1 in the toc
page2.PNG
page2.PNG (22.43 KiB) Viewed 9071 times
top page 2 in the toc
page3.PNG
page3.PNG (5.99 KiB) Viewed 9071 times
top page 3 in the toc

As you can see in the figure above "top page 3 in the toc", though I did as what Herbert suggests to me in the other thread, the third word "page" didn't jump to the third page of the toc. That is my problem.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Word page before page number in table of contents

Post by Johannes_B »

Well, the approach is manual ;-)
You have to use the command to put the text after this page once again. And once again if you have a fourth page.

Please click on »Open in writelatex« (which is now known as Overleaf) to see the output.

Code: Select all

\documentclass[a5paper]{article}
\usepackage{afterpage}
\begin{document}

\tableofcontents

\addtocontents{toc}{~\hfill\textbf{Page}\par}
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\addtocontents{toc}{\protect\afterpage{~\hfill\textbf{Page}\par\medskip}}
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\addtocontents{toc}{\protect\afterpage{~\hfill\textbf{Page}\par\medskip}}
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
monglebest
Posts: 6
Joined: Fri Jan 30, 2015 6:43 pm

Re: Word page before page number in table of contents

Post by monglebest »

Thanks, Johannes_B.

It works after I makes a few trials.
monglebest
Posts: 6
Joined: Fri Jan 30, 2015 6:43 pm

Word page before page number in table of contents

Post by monglebest »

Hi, I wonder if that is OK for me to ask a related questions or open a new thread.

I need to do the same thing for lof/lot with additional request to put word figures there. I figure out the code to be

Code: Select all

\addtocontents{lof}{\protect\afterpage{{FIGURE}~\hfill{Page}\par\medskip}} %command to enable second page "PAGE" in
\addtocontents{lof}{\protect\afterpage{~\hfill \par\medskip}} %command to enable second page "PAGE" in toc, together with package{afterpage}, doesn't work well for third page toc
the output is below on the second page:
lof2.PNG
lof2.PNG (43.9 KiB) Viewed 9067 times
How can move the word "Figure" to the most left side? The thesis reviewer has some concern about it. Thanks.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Word page before page number in table of contents

Post by Johannes_B »

Please always post complete example, not just code snippets. That reduces time to provide a working solution to a minimum. My guess to simply use \noindnet could have been tested in 10 seconds. Now i had to spend a few minutes building a new testcase.

Code: Select all

\documentclass[a5paper]{article}
\usepackage{afterpage}
\input{multido}
\usepackage{capt-of}
\begin{document}
\pagestyle{headings}
\tableofcontents
\listoffigures

\addtocontents{lof}{\protect\afterpage{\noindent{FIGURE}~\hfill{Page}\par\medskip}} %command to enable second page "PAGE" in
\addtocontents{lof}{\protect\afterpage{~\hfill \par\medskip}} 
\multido{\i=1+1}{20}{\captionof{figure}{some caption}}
\addtocontents{toc}{~\hfill\textbf{Page}\par}
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\addtocontents{toc}{\protect\afterpage{~\hfill\textbf{Page}\par\medskip}}
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\addtocontents{toc}{\protect\afterpage{~\hfill\textbf{Page}\par\medskip}}
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\section{foo}bar\clearpage
\end{document}
Please be aware, that thesis can have proper headings. Personally, i think it is redundant to have the words figure and page on every page of the lists. What should the reader expect there? Bananas? ;-)

I bet your readers will have a bit of common sense, so i would give this some hard thinking.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply