From d982c0d6cc6cf42bf2438b2a68b81c3813e82d2d Mon Sep 17 00:00:00 2001 From: Andy Kopra Date: Tue, 18 Aug 2026 00:28:09 +0200 Subject: [PATCH] Improve formatting of lists List layout adjustments in the SKS LaTeX path: list item spacing and the surrounding document style tuned in list.py, latex_util.py, document.sty, and block.k. Assembled from dev commit f34e66a4dbfb. Co-Authored-By: Claude Fable 5 --- README.md | 2 +- sks/block/block.k | 6 ++++++ sks/document/sty/document.sty | 8 ++------ sks/list/list.py | 7 +++++-- sks/target/latex_util.py | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 3fc5995..f1a96e7 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ are regenerated on each release — patches cannot be merged directly. Report problems (or send patches) to the author; accepted changes are applied to the development tree and appear in a following snapshot. -This snapshot was assembled from development commit `071b1b183de4`. +This snapshot was assembled from development commit `f34e66a4dbfb`. ## License diff --git a/sks/block/block.k b/sks/block/block.k index 86f33cf..6b673ac 100644 --- a/sks/block/block.k +++ b/sks/block/block.k @@ -135,3 +135,9 @@ only makes some vertical space. @@ *s* \end{multicols} @@ + +@@left_right.k left | right : Text left- and right- justified on one line @@ + +@@left_right.tex :: + \makebox[\dimexpr\linewidth+\labelindent\relax]{*left*\hfill *right*} +@@ diff --git a/sks/document/sty/document.sty b/sks/document/sty/document.sty index 94bb0cd..beb7062 100644 --- a/sks/document/sty/document.sty +++ b/sks/document/sty/document.sty @@ -2,12 +2,8 @@ \usepackage{titletoc} \usepackage{ifthen} -%% \pretolerance 1000 -%% \tolerance 2000 -%% \exhyphenpenalty 0 -%% \clubpenalty 5000 -%% \widowpenalty 5000 -%% \displaywidowpenalty 5000 +\widowpenalty=10000 +\clubpenalty=10000 \setlength{\hoffset}{-1in} \setlength{\voffset}{-1in} diff --git a/sks/list/list.py b/sks/list/list.py index 56f12fc..b124012 100644 --- a/sks/list/list.py +++ b/sks/list/list.py @@ -81,9 +81,12 @@ class Define(klammer_base.Klammer_base): 'c' : r'\normalfont\ttfamily', 's' : r'\normalfont\sffamily'}[self.font] return f"{font} {s}" - result = "\n\n".join([f"\\item[{fontify(term)}]\\hfill\n\\newline {definition}" + # The "\hfill\newline" was to force the description to the next line even if the item was small: + # result = "\n\n".join([f"\\item[{{{fontify(term)}}}]\\hfill\n\\newline {definition}" + strut = r"\rule[-8pt]{0pt}{8pt}" + result = "\n\n".join([f"\\item[{{{fontify(term)}{strut}}}] {definition}" for term,definition in self.items]) - result = f"\\begin{{description}}[labelindent=12pt,nosep,itemsep=6pt]\n{result}\n\\end{{description}}" + result = f"\\begin{{description}}[labelindent=12pt,nosep,itemsep=6pt,parsep=.5\parskip,style=nextline]\n{result}\n\\end{{description}}" return result # Needs to be implemented: diff --git a/sks/target/latex_util.py b/sks/target/latex_util.py index fe424f1..8d6c2aa 100644 --- a/sks/target/latex_util.py +++ b/sks/target/latex_util.py @@ -90,7 +90,7 @@ def offset_space(offset): length = offset_length(offset) return "" if length == "0pt" else f"\\hspace*{{{length}}}" -def caption_wrapper(element, hpos, bottom_margin=.67, offset=None): +def caption_wrapper(element, hpos, bottom_margin=0, offset=None): # hpos is left, center, right, none (no wrapper), or a length, which # becomes the left margin. The element is a box on a line inside a # full-width minipage; \hfill on the empty side pushes it into place.