In a Leanpub book, you can distinguish between "frontmatter" text files, which will appear with Roman numerals in the Table of Contents, and "mainmatter" text files, which will appear with ordinary numbers in the Table of Contents.
To indicate the beginning of a sequence of files that you want to be "frontmatter", type this on a line by itself at the top of the first file in the sequence:
{frontmatter}
Then, to indicate the beginning of a sequence of files that you want to be "mainmatter", type this on a line by itself at the top of the first file in the sequence:
{mainmatter}
For example, you would do this at the top of the first file you wanted to appear in the Table of Contents with Roman numerals, at the beginning of a book:
{frontmatter}
# Foreword
It was the best of times
Then, you would do this at the top of the first file that you wanted to appear in the Table of Contents with ordinary numbers:
{mainmatter}
# Chapter One
It was the worst of times.
The next time you create a preview, you will see how this looks in the book. Here's the table of contents from the example book we created for this article:
To be clear, {frontmatter} and {mainmatter} do not go in the Book.txt file (or the Sample.txt file, if you're using Leanpub-Flavored Markdown instead of Markua).
So, you should not do this in the Book.txt file:
{frontmatter}
Foreword.txt
{mainmatter}
chapter1.txt
chapter2.txt
chapter3.txt
You can also add a {backmatter} directive in a text file, like this:
{backmatter}
If you have selected automatic chapter numbering for your Table of Contents, then page numbers will not be added to any frontmatter chapters, or any chapters after the backmatter directive.
Here's an example, showing a fronttmatter chapter with no numbering, a mainmater chapter with the automatic number applied, and a backmatter chapter with no numbering:
If you have any feedback or questions about this article, please email the Leanpub team about it at hello@leanpub.com!
If you have any questions or thoughts on writing and self-publishing with Leanpub, please join our global community of authors in our Authors Forum here!
Are you interested in self-publishing, and creating your first Leanpub book? Here are some quick tutorials for our most popular writing modes: http://help.leanpub.com/en/articles/3088382-quick-walkthroughs-for-getting-started-on-a-leanpub-book
Are you looking for great deals on Leanpub ebooks, ebook bundles, and courses? Sign up for our Weekly and Monthly newsletter sales here!
Subscribe to our YouTube channel here: https://www.youtube.com/leanpub
Please subscribe to our YouTube channel here: https://www.youtube.com/leanpub
You can also follow Leanpub in lots of other places!