Right-justify some text in a list?

I’m working on the lists in Ezra (1:9-10, etc.) What is the best way to get the numbers to be right-justified? I’d like to avoid tables, but is there an alternative?

Are the numbers marked up with litl?
If so you can put a hook into ptxprint-mods.tex

Add a line:


Which will put an infinitely stretchy bit of space at the start of the character class.
If you want that space to be a row of dots, it’s more complex:

\sethook{start}{litl}{\leaders\hbox to 0.5em{\hfill.\hfill}\hskip 0pt plus 1fill\relax}

Ah, I had started with \lik and \liv, but I’ll change them over.

Thanks for answering this and my other query. I understand the process enough to generate questions, but not answers! And I’m not done yet…

That is working nicely except for lines where the text prior to the total already fills the line. Then the total doesn’t shift to the right. Would this need to be fixed line-by-line, and if so, what code do I use?

Sorry if I implied there was something magic with litl… what was really important was that the bits that needed to be offset needed to have their own markup (but then you change the hook to be before whatever the relevant marker is.

Now, \hfill (and \leaders) getting discarded if there’s a line-break is a very useful feature, not a bug - it stops there being a space at the start/end of a broken line. There’s no need to treat things as exceptions, we just need to educate TeX…

The question that needs to be answered, though, is what would you like to happen?

  1. Never ever break the line before the number (even if the result is horrible): change the end of the sethook to be:
  2. A whole blank line / line of dots before the number:

In both of these, if you are using the \leaders, put the extra bit in front of that instead.


What these are doing is giving the line-breaking algorithm some extra instructions.
I’ve also added \unskip which removes a preceding space if there is one - that’s more useful for the \leaders-based code, and stops there being a space between the dots and the preceding word.
The \penalty 500 means the line can be broken there, but it’s a long way from ideal. and \hbox{} is just a zero-width thing that it can’t discard. \penalty10000 says the cost of breaking the line here is ‘infinite’. Thus for both of these versions, TeX is not allowed to break the line at (just before) the fill, and thus it cannot be discarded by the normal process.

Thanks for that information, and I managed to do the same for Scripture references in book outlines ALL BY MYSELF!

1 Like