0 votes
347 views

I would like to create a ToC for a Bible Modules. Ideally I’d like the ToC to be automatically generated for each \s marker, so that each section title is a line in the ToC and the corresponding page number shows up.

If PTXprint can’t create that automatically based on \s, then I’d like to be able to add extra tags throughout the modules with information in each to state “add a ToC entry here”. I tried something like \toc1 entry_name but that didn’t work (which isn’t entirely unexpected, since generally you don’t want more than one \toc1 entry in a given book).

The thing is, I could swear I had this working a couple of weeks ago but I can’t recreate my work. Does anyone know how to create such a ToC which isn’t simply based on \toc1/2/3 entries from different books?

PTXprint by (1.9k points) | 347 views

2 Answers

0 votes

Have you received any response to this?

A TOC based on \s would work very well for Song books as well.

Mike

by (1.2k points)

I did not receive a reply.

At that time I was working with a few different modules each of which had around 100 section titles. So the amount of manual labor which would have been necessary to create the contents by hand was massive, and subsequent revisions would have been difficult.

I ended up writing a few Python scripts which allowed me to create or populate the underlying context.xml file manually. It was confusing to work with and required remember when things needed to be updated externally, but at least it was quick.

+1 vote

The easiest way to add an index of songs is to duplicate the contents of the \s Song Titles using a Changes.txt rule like this:

'(\\s )([^\\]+)( ?\r?\n)' > '\\toc1 \2\3\1\2\3'

This says, look for a \s section heading and call that match-group 1.
Then grab the content/text of that heading, calling that match-group 2.
Grab the end of line (which needs at least an \n but might have a space and/or \r before the final \n) and call that match-group 3.

Then, on the replace-with side, put in the new marker \toc1 followed by the contents of 2 and the end of line piece. Then put everything else back as you found it (1,2,3).

These \toc1 fields should now get picked up and used in the Table of Contents.

Note that you can also generate a sorted (table of contents) from these same \toc1 markers for an index at the back of the song book. Just use \ztoc|sorta\* instead of \ztoc|main\*

by (3.2k points)

Argh, sorry about that. I was thinking this question was in reference to SAB (where this is still an open problem).

Yes, this problem was ‘easily’ solved using regex similar to what @mjpenny states above.

One point where you’ll probably want to check things carefully. When I originally used a regex like the one above, in cases where \s markers fell at the top of the page the page numbers in the ToC were off by one (they were for the previous page). You can see the bug report here, along with a solution using a more complicated regex expression.

(post deleted by author)

Related questions

0 votes
1 answer 12 views
Is there a style for the TOC title? I would like to add some blank space before the TOC title, and haven't found a way to do that. Jeff
jeffh 1.4k asked Dec 5, 2025
0 votes
2 answers 21 views
Is there a way to put the TOC at the end of a publication? That is the standard in French publications. Jeff
jeffh 1.4k asked Dec 5, 2025
0 votes
2 answers 300 views
I'm typesetting a single-book Genesis publication. We want to display 7 "Major Section" labels in the TOC, and the ... , adding page numbers to it as the final typesetting step?
KimB 670 asked Jun 26, 2024
0 votes
4 answers 408 views
I'd like to prevent \toc1 content from wrapping within its column. Can I make TOC to fully fit the page margins, and/ ... font size I choose, they seem to be the same size.
beve 128 asked Jun 19, 2023
0 votes
2 answers 183 views
With the new version 1.9.3, the generated TOC is now placed first before the included Front Matter PDFs. With 1.9 ... Matter PDFs. How can we get the previous behavior back again?
rickarellanes 167 asked Aug 31, 2021
Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
Give proper recognition to those widows who are really in need.
1 Timothy 5:3
3,037 questions
5,994 answers
5,661 comments
2,022 users