typ
typesetting
pypi i typesetting
typ

typesetting

A Python library letting you invoke TeX-inspired typesetting algorithms

by Brandon Rhodes

0.1-dev (see all)License:MIT
pypi i typesetting
Readme

A Python Typesetting package

(Note: I plan to add user documentation to the library within the next couple of weeks; simply “watch” this repository here on GitHub if you want to follow along until it appears!)

This prototype library typesets paragraphs using the same approach as TeX and LaTeX, knows how to avoid widow and orphan lines when splitting paragraphs across pages, and produces PDF output:

alt text

Here is an example PDF that is typeset using the library:

examples/steam/book.pdf

The script that produced the above PDF is here in the repository at examples/steam/typeset.py.

The vast difference this library’s approach and that of TeX or LaTeX is that this library leaves you entirely in control — paragraph justification and line breaking are a subroutine that you call from normal Python code that is otherwise free to draw on the page however it wishes! You can draw titles, page numbers, and add media using whatever underlying library calls you want, and the typesetting library stays out of your way. No longer will you be stuck trying to center a title or draw using abstruse configuration piled atop underpowered boxes and glue primitives.

The process of designing this library is described in the 2019 “Typesetting with Python” keynote talk that I delivered at PyLondinium19:

https://www.youtube.com/watch?v=e7RVO0Sqr4s

I am happy that the talk (in the form of the above recording) was also featured at the remote TUG2020 conference in July 2020, which I celebrated by returning to the repository and getting progress underway again!

GitHub Stars

119

LAST COMMIT

10mos ago

MAINTAINERS

1

CONTRIBUTORS

3

OPEN ISSUES

2

OPEN PRs

0
VersionTagPublished
0.1-dev
3yrs ago
No alternatives found
No tutorials found
Add a tutorial