sillsdev / ptx2pdf

XeTeX based macro package for typesetting USFM formatted (Paratext output) scripture files
23 stars 8 forks source link

Starting a new page before each chapter not working #927

Closed klassenjm closed 10 months ago

klassenjm commented 10 months ago

I am working with a colleague who has enabled the option to "Start 1st chapter on a new page". The option does not seem to have an effect on the layout. Chapter 1 still follows the introduction on the same page.

Also - the option to enable a new chapter before "All Chapters" has been enabled. When it is enabled, PTXprint crashes with an undefined control sequence. I have not been able to work out why, although I have determined the issue to be related to GEN 14.

This is not urgent. I have emailed an archive (BBR17-Gn-BaouleNov2023GhPTXprintArchive.zip)

markpenny commented 10 months ago

@davidg-sil I have confirmed that it crashes when ch 14 is included. It seems to be crashing while trying to clearthenbackup

image

If I remove the \s1 at line 612: \s1 Ablamu i famiɛn nnan mun be kwlalɛ

...then it all works fine. So it is some strange combination that it is hitting at the end of the page which is causing it to crash.

davidg-sil commented 10 months ago

That ifdimen0 should be ifdim \dimen0

davidg-sil commented 10 months ago

It looks like there were some accidental deletions in that line. Not sure how, I guess keystrokes going to the wrong window sometime between relevant bug-fix/tests and the submission. Now fixed, and original bug (#910) is fixed.

markpenny commented 10 months ago

@davidg-sil There is still an issue with Start 1st Chapter on a new page -- which doesn't seem to be working at all. Tracing this through to PBOnBody might give you a clue as to why it might not be working.

image

The option to enable a new chapter before "All Chapters" seems to still be working, but that is happening though a RegEx in the python code rather than through the TeX parameters:

image

@klassenjm I trust that we get this fixed in the next day or so, but if your colleague needs an urgent workaround, then placing this line in the changes.txt file would make it work:

"(\\c 1[\s\r\n]+)" > "\\pb\1"

klassenjm commented 10 months ago

Thanks guys. The fix will be great, but not urgent. It was important to me to report issues I encountered working a few colleagues here, so that they were in the queue.

davidg-sil commented 10 months ago

I've not tested every option, but, these should work (in the most recent code):

  1. Starting a new page before each chapter (tested: monoglot or serial-diglot, untested: parallel diglot).
  2. Starting a new page before the first chapter when the body text is 2 column and the intro is 1 column (monoglot or serial diglot)
  3. Starting a new page before the first chapter when the body text and intro have the same column-count (monoglot or serial diglot)

Parallel diglot gets very confused at the moment if the ordinary code to force a page-break at the start of the body text is enabled. (In my test file, it is cutting up the introductory page into 5 chunks, with each chunk on a new page.)

If someone needs to start the chapter text on a new page the only suggestion I can offer at the moment is to ensure that there is a column-synchronisation occurring at the relevant spot (there should be, but you can use a changes file and \zdiglotsync if not) and then fill the rest of the relevant page with a "picture" of exactly the right size.

davidg-sil commented 10 months ago

OK... latest push seems to have a working 'new page before chapter1' with diglots... but the 'cutting up the intro' bug is still present if you use one of the older merging modes - they add a \p at the end of each chunk, making the intro a series of \ip ... \p so for "Document" every paragraph gets treated as switching from intro to body text, hence its own page. I've tested with the newer "Scored" method, and that doesn't insert the \p, so that works OK.