• Re: Formatting

    From Johann 'Myrkraverk' Oskarsson@3:633/10 to All on Wed Sep 23 20:08:51 2026
    On 9/23/2026 4:17 PM, Stefan Ram wrote:
    Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> wrote or quoted:
    If you're wondering how to format text for Usenet, I like Emacs for this
    task. I then paste into Thunderbird for posting, but that's because I'm
    not inclined yet to figure out how to configure GNUS.

    To wrap paragraphs, I wrote a script in Python that uses dynamic
    programming to find the globally best wrap and made it available
    to vim via a key mapping. It was used to wrap this paragraph here.

    I am not always satisfied with the results, and so I also format
    many paragraphs manually and do manual hyphenation painstakingly
    looking up German and English words in hyphenation dictionaries.

    I also have written a Python module that also does hyphenation, and
    which I plan to publish one day, but so far the code has not yet
    been cleaned up. This hyphenation uses TeX's hyphenation patterns.

    Dear Stefan,

    You mean you coded up TeX's line breaking algorithm? Did you do it from
    the book /TeX: The Program/, or /Digital Typesetting/? The latter has a
    code bug in the line breaking algorithm in the first edition, that got
    me a code bug check -- only $0x1 symbolic dollar -- and I have faith
    it's been fixed in the second edition.

    I have alas not coded up TeX's hyphenation patterns, and only thought to
    use something like -- what was it? -- some project or other that went
    into the public domain, and has a database of hyphenated words. It
    should be trivial to run that through SQLite these days. The name of
    the project escapes me at the moment, and it might be hard to find again without the /title/ due to its age and lack of S.E.O.

    The main problem with fixed width text and paragraph line breaks, is the
    usual length of the line on computer screens. I believe it is shorter
    than typically used in books. My memory of checking this is a little
    bit off, as it's been a few decades, but I frequently run into words
    running off the screen in WordPerfect for DOS.

    Now to get perfect line breaks in fixed width text the best method is to construct the text carefully, and change the words with a thesaurus, and
    the word order, and possibly write a completely new sentence. When I do
    this, I usually do this with hyphenation also, and do not care about the official rules, and just wing it. The only paragraph I did this in this followup, is this one.


    Best wishes, and happy line breaking algorithms!
    --
    Johann | email: invalid -> com | http://www.myrkraverk.com/blog/
    I'm not from the Internet, I just work there. | via XS News https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:;

    --- PyGate Linux v1.5.19
    * Origin: Dragon's Lair, PyGate NNTP<>Fido Gate (3:633/10)