Path: ...!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail From: ram@zedat.fu-berlin.de (Stefan Ram) Newsgroups: comp.text.tex Subject: Re: TeX's line breaking in the grub sesh Date: 31 Jan 2025 22:08:14 GMT Organization: Stefan Ram Lines: 67 Expires: 1 Jan 2026 11:59:58 GMT Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de BU+aO5gbOmWgpPOnbCojqwXmlfXTRmQrk0JQRAkXVp+azv Cancel-Lock: sha1:LIxJZEpkkzZHZgA0aWGtRs7mRto= sha256:Wqz1AHP3dX1JNLzGmjGCQmikmy62wUurLmsCtCqi2Fs= X-Copyright: (C) Copyright 2025 Stefan Ram. All rights reserved. Distribution through any means other than regular usenet channels is forbidden. It is forbidden to publish this article in the Web, to change URIs of this article into links, and to transfer the body without this notice, but quotations of parts in other Usenet posts are allowed. X-No-Archive: Yes Archive: no X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some services to mirror the article in the web. But the article may be kept on a Usenet archive server with only NNTP access. X-No-Html: yes Content-Language: en-US Bytes: 4355 ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted: >new_active_list.append( active ) >this_line_quality = -adjustment**2 In August 2024, I posted an implementation of TeX's paragraph algorithm for plain text in Python intended to be used to generate ragged-right output. I'm still working on this code and intend to publish the new version of the code once it's finished. Here is a preliminary report: This is an output of the algorithm: Ich will das natürlich nicht überbewerten, aber eine gewisse Be- schäftigung mit dem neuen/unbekannten Code vor Ausführung desselben fände ich nicht schlecht, und sei es nur, die Zitatzeichen zu ent- fernen und dabei mal einen Blick auf den Inhalt zu werfen ... Now, I set "wrapper.adjdemerits = 1000": Ich will das natürlich nicht überbewerten, aber eine gewisse Be- schäftigung mit dem neuen/unbekannten Code vor Ausführung dessel- ben fände ich nicht schlecht, und sei es nur, die Zitatzeichen zu entfernen und dabei mal einen Blick auf den Inhalt zu werfen ... Above, we see that the program now tries harder to make the ragged right border less ragged. But we now have two consecutive discretionary hyphens! wrapper.adjdemerits = 1000 wrapper.doublehyphendemerits = 10000 Ich will das natürlich nicht überbewerten, aber eine gewisse Be- schäftigung mit dem neuen/unbekannten Code vor Ausführung desselben fände ich nicht schlecht, und sei es nur, die Zitatzeichen zu ent- fernen und dabei mal einen Blick auf den Inhalt zu werfen ... Now, we have a discretionary break in then penultimate line! wrapper.adjdemerits = 1000 wrapper.doublehyphendemerits = 10000 wrapper.finalhyphendemerits = 100000 Ich will das natürlich nicht überbewerten, aber eine gewisse Be- schäftigung mit dem neuen/unbekannten Code vor Ausführung dessel- ben fände ich nicht schlecht, und sei es nur, die Zitatzeichen zu entfernen und dabei mal einen Blick auf den Inhalt zu werfen ... The price to be paid for the removal of the final hyphen is the reintroduction of the double hyphen. I guess you just can't have everything you wish for! All of the above is actual program output, so these TeX parameters (and some other) are already implemented, albeit with the numeric values possibly not corresponding directly to TeX's values. (So, "1000" in my code might not have the same meaning as in TeX.) Now I plan to add some of my own ideas for parameters and then to clean up the code and add some documentation . . . One final example, wrapper.hyphenpenalty = 1000: Ich will das natürlich nicht überbewerten, aber eine gewisse Beschäftigung mit dem neuen/unbekannten Code vor Ausführung desselben fände ich nicht schlecht, und sei es nur, die Zitatzeichen zu entfernen und dabei mal einen Blick auf den Inhalt zu werfen ...