Hacker News new | past | comments | ask | show | jobs | submit login

This is pretty much the typical way things are done in TeX: having glue or penalties that “cancel out” in the usual case but do the right thing when line breaks are involved. Unlike CSS that has lots of special cases and keeps adding more, TeX has a very simple algorithm for breaking paragraphs into lines, but the box-glue-penalty model is general enough that a lot of things can be achieved with it. (I like the way these are explained in the paper by Knuth and Plass; see e.g. https://tex.stackexchange.com/a/469908 and https://tex.stackexchange.com/a/423578 .)



Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: