Page Layout ⇒ Custom Entry in ToC
Custom Entry in ToC
Greetings,
I would like to enter a custom entry to the ToC of my document, with "TEXT" instead of the page number.
I need to have a special entry in my ToC, where the last appendix is actually added. I need to have the special entry in my ToC even though there is no actual extra appendix in the text. And at the end of the row of dots instead of a page number, I need to have the string "TEXT" at the end. How do I do that?
I would like to enter a custom entry to the ToC of my document, with "TEXT" instead of the page number.
I need to have a special entry in my ToC, where the last appendix is actually added. I need to have the special entry in my ToC even though there is no actual extra appendix in the text. And at the end of the row of dots instead of a page number, I need to have the string "TEXT" at the end. How do I do that?
NEW: TikZ book now 40% off at Amazon.com for a short time.

Re: Custom Entry in ToC
GREETINGS AGAIN!
I have not yet received a response to my inquiry about how to modify the page number of an entry in the table of contents.
How do I change the page number for a forced Appendix entry in the table of contents?
I have not yet received a response to my inquiry about how to modify the page number of an entry in the table of contents.
How do I change the page number for a forced Appendix entry in the table of contents?
- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Custom Entry in ToC
Well, can you show me how?
Re: Custom Entry in ToC
[2 weeks later]
I still don't have an answer.
How do I use either of the \addcontents to change the page number to "TEXT" in the toc?
I still don't have an answer.
How do I use either of the \addcontents to change the page number to "TEXT" in the toc?
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Custom Entry in ToC
Just click on the commands in Stefan's reply and you will get a synopsis of their usage. Furthermore every good LaTeX introduction should explain them.LavaTyper wrote:[…] How do I use either of the \addcontents to change the page number to "TEXT" in the toc?
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Custom Entry in ToC
I did that, and I didn't see anything in any of the comprehensive documentation that said how to replace the actual page number with "TEXT."
Re: Custom Entry in ToC
Guys I need help on this soon. I am trying to write my dissertation and I NEED to have this done in order to get my degree. Can't you guys write some example code?
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Custom Entry in ToC
If you are stuck doing something, ask for help by providing a minimal working example!
Stefan already pushed you down a road, you never told us whats holding you back. But to help you we need more information (MWE).
Best regards
Johannes
Stefan already pushed you down a road, you never told us whats holding you back. But to help you we need more information (MWE).
Best regards
Johannes
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Custom Entry in ToC
I can't do that because I have no idea how to get it to work. I already went down the road twice and it lead to a dead end.
So, how do I modify this script?
So, how do I modify this script?
Code: Select all
\documentclass[12pt]{book}
\usepackage[dotinlabels]{titletoc}
\usepackage[indentafter,newlinetospace]{titlesec}
\usepackage{ifthen}
\renewcommand{\contentsname}{TABLE OF CONTENTS}
\renewcommand{\listtablename}{LIST OF TABLES}
\renewcommand{\appendixname}{Appendix}
% Format the Chapter in the TOC
\titlecontents{chapter}[0in]{\ifthenelse{\equal{\thecontentslabel}{1}}{
\vspace{1.3\baselineskip}Chapter\\ \normalsize}{
\normalsize\vspace{.2\baselineskip}}}
{\contentspush{\thecontentslabel.~}}
{}
{\titlerule*[.3em]{.}\thecontentspage}
{}
\titlecontents{section}[.3in]{}
{\contentspush{\thecontentslabel.~}}{}
{\titlerule*[.3em]{.}\thecontentspage}{}
% Format the Appendix in the TOC
\renewcommand{\appendixname}{Appendix}
\let\oldAppendix\appendix
\renewcommand{\appendix}{
\oldAppendix
\addtocontents{toc}{\protect \setcounter{tocdepth}{0} \par}
\titlecontents{chapter}[0in]{\normalsize\vspace{.2\baselineskip}}
{\contentspush{Appendix~\thecontentslabel.~}}{}
{\titlerule*[.3em]{.}\thecontentspage}{}
}
\linespread{2}
\title{An example with TEXT for a Page Number}
\author{Lava Typer}
\begin{document}
\maketitle
\tableofcontents
\listoftables
\chapter{First Chapter}
\section{First Section}
Here is a table. I have many tables in my project.
\begin{table}[h]
\caption{\label{table:mycaption}Caption goes here}
\begin{tabular}{lcr}
left & center & right \\
\end{tabular}
\end{table}
\section{Second Section of new chapter}
Content
\appendix
\chapter{First Appendix}
\section{Greetings}
I have multiple appendices...
\chapter{Second Appendix}
Here is another appendix.
\section{What I need from LaTeX-Community}
\textbf{After Appendix B in the actual Table of Contents page listing... \\
I need ``Appendix C," dots, and a string of text (say, ``TEXT") instead of a page number.}
But I want the document to end at Appendix B...and not actually have a physical ``Appendix C" in the \LaTeX file.
How do I do that?
\end{document}