What should should PTXprint be able to put a fancy border around?

I’ve been (slowly) working on drawing borders for sidebars based on repeating or stretching, (or repeating and stretching) ‘ornaments’. It applies any stretch before the ornaments are drawn, so the line thickness remains constant even when the user has chosen to allow an ornament to be grossly pulled out of shape.

This week, the code has been extended to add (possibly distorted) glyphs from fonts to the list of things that can be used, (though in this case there is line-thickness distortion, of course.)

If repeating elements are used, the ornamental borders (assuming they’re defined properly) are truly ‘made-to-measure’ for each box they surround, rather than distorted.

The next step will be to make it possible to put these ornamental borders around a page. At present, if a (PDF) border is added to a page, it is the entire page page that gets the border (footnotes and cross-references included), but I see from the SAB page that there have been requests to border just the scripture text, excluding footnotes.

I also understand that in some parts of the world there’d be a cultural preference for a diglot including the original Greek/Hebrew to have the original language being be ‘framed’ and the vernacular translation not be.

Thus I presume there are three options for page-borders that there is some desire for:

  • Whole page
  • Scripture text only
  • One side of a diglot only.

But there are potentially other options that I can think of:

  • Scripture portion of both sides of a diglot in a single border
  • Scripture portion of both sides of a diglot, in separate borders
  • Scripture and footnotes / x-references, but not figures

And eventually there may be a desire for:

  • Borders around section headings
  • Borders around pictures??

Have I missed anything out? Which of these is the most urgent?

Oh, I forgot, fancy rules are also working:


I’m trying to figure out a way to either put a border around a section title or shade behind the title. I know I can do this from the Tabs+Borders tab but it only allows for a border of a fixed size that fills the column. I want to shade just behind the text based on the size of the text.

I am trying to shade the background and put a box around section titles. Malachi supplied the initial code and I modified it to suit my situation:

‘\s (.+?)$’ > ‘\s_border \1 end\n’

\def\s_border #1 end{
\esb \cat boxedtext\cat*
\s #1

\Category boxedtext
\Border All
\BgColor xFDFDFD# grey
\Alpha 16
\Position h
\Scale 0.4
\Marker s
\RightMargin .125
\LeftMargin -.9
\SpaceBefore 0
\SpaceAfter 0
#\Color xff0000 #Red text colour
\FirstLineIndent 0

This almost works but for two-column the placement of the box is too high and the last line of the previous paragraph ends up below the title. The other problem is that for the first title in the book, the first line shows up outside of the box but in its right place but the second line is in a box but sprawls across both columns.

If you want to apply a background colour to just the characters of some text, that can be done. It’s currently only applied to character styles, however, not whole paragraphs. (you can set it for a paragraph, but confusingly it’ll only get applied to char-styles within the paragraph).


\Marker zgry
\StyleType Character
\Background xc0c0c0

USFM (e.g. after printmods):

\s \zgry This is a really excessively long title that breaks across two lines\zgry*


Sidebars at the start of a book don’t know if they are supposed to be in body-text or intro-text. Without testing it, I expect that this might work better:

‘\\s (.+?)$’ > ‘\\p\\s_border \1 end\n’

as the \p ought to tell TeX that you’re not in the introduction any more.

Oh… by the way, reading your custom.sty:

  1. Alpha takes a value 0…1

  2. doublecolumns isn’t a style-sheet entry. It’s the internal ‘switch to 2-column mode NOW’ command, that doesn’t end the current paragraph or do various other useful things. (i.e. expect strange results if you ever use it anywhere).

  3. You might want some \SpaceBefore and \SpaceAfter for the esb.