Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #198055

Re: Formatting

Date 2026-09-23 20:08 +0800
Subject Re: Formatting
Newsgroups comp.lang.python
References <nhcb19FjpohU1@mid.individual.net> <nhg4lgF7nmhU1@mid.individual.net> <nnd$00ad2c5a$613e2476@d140bd1880d0a0a7> <formatting-20260923091605@ram.dialup.fu-berlin.de>
From Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid>
Organization Watcom Pro Ltd.
Message-ID <nnd$4ca00753$14137697@ed7836aeb5eb4d5a> (permalink)

Show all headers | View raw


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 ( ;; ) _:;

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Best practise for managing Conda environments? Martin Schöön <martin.schoon@gmail.com> - 2026-09-21 09:17 +0000
  Re: Best practise for managing Conda environments? Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-21 17:32 +0800
    Re: Best practise for managing Conda environments? Martin Schöön <martin.schoon@gmail.com> - 2026-09-21 20:33 +0000
      Re: Best practise for managing Conda environments? Jon Ribbens <jon+usenet@unequivocal.eu> - 2026-09-21 22:05 +0000
        Re: Best practise for managing Conda environments? Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-22 14:37 +0800
          Re: Best practise for managing Conda environments? ram@zedat.fu-berlin.de (Stefan Ram) - 2026-09-22 07:33 +0000
          Re: Best practise for managing Conda environments? Jon Ribbens <jon+usenet@unequivocal.eu> - 2026-09-22 09:08 +0000
            Re: Best practise for managing Conda environments? Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-22 22:53 +0800
  Re: Best practise for managing Conda environments? Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-22 15:08 +0800
  Re: Best practise for managing Conda environments? Lawrence D’Oliveiro <ldo@nz.invalid> - 2026-09-22 07:44 +0000
    Re: Best practise for managing Conda environments? "Loris Bennett" <loris.bennett@fu-berlin.de> - 2026-09-22 10:14 +0200
  Re: Best practise for managing Conda environments? Martin Schöön <martin.schoon@gmail.com> - 2026-09-22 19:53 +0000
    Re: Best practise for managing Conda environments? Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-23 04:57 +0800
      Formatting (was: Best practise for managing Conda environments?) ram@zedat.fu-berlin.de (Stefan Ram) - 2026-09-23 08:17 +0000
        Re: Formatting Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2026-09-23 20:08 +0800
          Re: Formatting ram@zedat.fu-berlin.de (Stefan Ram) - 2026-09-23 12:42 +0000
            Re: Formatting ram@zedat.fu-berlin.de (Stefan Ram) - 2026-09-23 14:43 +0000
              Re: Formatting ram@zedat.fu-berlin.de (Stefan Ram) - 2026-09-23 15:01 +0000
          Re: Formatting ram@zedat.fu-berlin.de (Stefan Ram) - 2026-09-23 13:38 +0000
        Re: Formatting (was: Best practise for managing Conda environments?) Martin Schöön <martin.schoon@gmail.com> - 2026-09-24 08:31 +0000
          Re: Formatting (was: Best practise for managing Conda environments?) Martin Schöön <martin.schoon@gmail.com> - 2026-09-25 08:53 +0000

csiph-web