0 votes
266 vues
How do you make sure that all \q2 lines are always on the same page as the prior \q1 line?
PTXprint par (1,4k points) | 266 vues

3 Réponses

0 votes
Meilleure réponse

I actually know one way to do this, but I wanted to post it here so that I can find it next time I need it!

In the ptxprint-mods.tex file (check the box for that file on the Advanced tab and click Edit...) add this line:

\sethook{before}{q2}{\nobreak}
par (1,4k points)
0 votes
Of course if you want to take your question very precisely and only avoid breaking between q1 and q2 (and say allow a break between q2 and q2) then the problem gets a little more interesting:

\catcode`\@=11
\addtoparstylehooks{\xdef\lastmarker{\m@rker}}
\m@kedigitsletters
\def\@qone{q1}
\m@kedigitsother
\sethook{before}{q2}{\ifx\lastmarker\@qone\relax\nobreak\fi}

Here we grab the marker of the previous paragraph at the end of each paragraph, then before a q2 we  test that the last paragraph marker was a q1 and if so insert the nobreak. Notice that to compare the marker against q1, we store q1 as something to compare, but the 1 in q1 is a letter not a digit so we have to recategorise digits as letters while we do that def and then put them back. sethook is clever in that it does the recategorising for us without having to do that kind of thing.
par (656 points)
0 votes

I know there have been other answers, but Martin's is overkill when this exists...
 

\setbetweenhook{q1}{q2}{\nobreak}


par (1,1k points)
I assume if you used this that you would also want:

\setbetweenhook{q2}{q2}{\nobreak}

So that if you had multiple \q2's in a row, that they would also be kept together.

Questions connexes

0 votes
1 réponse 35 vues
Notre poésie est entièrement en sfm \q1 et la plupart des lignes sont assez courtes pour rester dans la marge. Cependant, à ... 'une ligne \q1 occupe plus d'une ligne sur la page.
debbodaneejo 118 posée févr. 4
+1 vote
1 réponse 375 vues
Some translation projects do not want to have periods at the end of their footnotes. Simply leaving them off will ... at the end of footnotes - Helps - Paratext Supporter Site
[Expert]
Jeff_Shrum
2,9k
posée août 30, 2022
0 votes
2 réponses 80 vues
In the reference settings in PTX, is there an option to mark the reference below the verse?
Shivaji 117 posée mars 7, 2025
0 votes
2 réponses 212 vues
Greetings all, We are trying to get the poetry word "Selah" to be right aligned even though it is on the same ... the following... Is there something we are missing? Thanks, GY
gyip 109 posée sept. 4, 2024
Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
May the God who gives endurance and encouragement give you the same attitude of mind toward each other that Christ Jesus had.
Romans 15:5
3,044 questions
6,003 réponses
5,671 commentaires
2,026 utilisateurs