GeneralMaking a fake content

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
EigenGoofy
Posts: 42
Joined: Fri Jul 22, 2011 12:26 am

Making a fake content

Post by EigenGoofy »

Hello, everybody!

I wanna make a fake content as following

Content

Preface ....................... I

Chapter one: Introduction ..................... 1
Section 1: Apple .............................. 2
Section 2: Wine Brew .......................... 19

Chapter two: Industry ......................... 41
Section 1: Wheat .............................. 42
Section 2: Pesticide .......................... 67

etc.

The reason why it is fake is because the actual sections and corresponding page numbers do not exist at all.

How could I do this? Thank you very much!

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
Stefan Kottwitz
Site Admin
Posts: 10323
Joined: Mon Mar 10, 2008 9:44 pm

Making a fake content

Post by Stefan Kottwitz »

You could use \addtocontents and \contentsline, such as

Code: Select all

\addtocontents{toc}{\protect\contentsline{chapter}{Industry}{41}}
\addtocontents{toc}{\protect\contentsline{section}{Wheat}{42}}
Stefan
LaTeX.org admin
EigenGoofy
Posts: 42
Joined: Fri Jul 22, 2011 12:26 am

Making a fake content

Post by EigenGoofy »

Hello, Stefan_K!

Thank you for your help!

Your code does not work very well in LyX. It partially fail to generate content and chapter or section number, and it returns an error message:
Paragraph ended before \contentsline was complete.
Now I am using the following code:

Code: Select all

\tableofcontents
\protect \contentsline {chapter}{\protect \numberline Preface {}}{IV}
\protect \contentsline {chapter}{\protect \numberline Chapter {1}: Preliminary}{1}
\protect \contentsline {section}{\protect \numberline {1.1}Mathmetical Background}{1}
This code can generate everything for me, I am quite satisfied. But it also returns an error message:
Paragraph ended before \contentsline was complete.
So everytime I have to ignore this error message.
Post Reply