Hacker News new | ask | show | jobs
by jonathanstrange 1432 days ago
I've become productive in LaTeX once I stopped doing any typesetting in it until there was a real need for it due to publisher requirements. LaTeX looks great out of the box, I just finished a book that I had to deliver camera-ready and the publisher (not a LaTeX shop) was very impressed with the quality. It was the standard Memoir book template with almost no changes. Ironically, many documentations for special typesetting packages in LaTeX look very bad. Generally, the less you change, the better.

LaTeX really fails at "register-true" typesetting, though. You have to allow it to extend pages here or there by a line or be willing to fix many orphans and widows by hand. AFAIK, this has to do with the text flow algorithms which are paragraph-based and cannot do some global optimizations. (Correct me if I'm wrong, I'm not an expert.)

Btw, I cannot confirm the compile-time criticisms. A whole book takes just a few seconds on my machine for one run. I wonder what people are doing who get slow compile times.

2 comments

There are some packages that slow LaTeX down, I think... Tikz is one I think.

My masters thesis was written on an old netbook with an Atom processor, plenty of graphics, the compile times got pretty ugly. But I did different files for each section, and set it up so the latex process would automatically kick off and run in the background after writing to the file in vim. Working within constraints like that is sort of fun, it forces you to get the slow operations off the critical path.

Currently I use a script like:

  inotifywait -e close_write,moved_to,create -m . |
  while read -r directory events filename; do
    if [ "$filename" = "$1" ]; then
      latexmk -interaction=nonstopmode -f -pdf $1 2> $1.errlog
    fi  
  done
to just re-compile the .tex whenever it changes. I'm not really a bash programmer though so I guess this will probably be ripped apart by somebody here, haha (the top couple lines were probably taken from some post on the internet somewhere).
FWIW, `latexmk` has a "Watch the sources for this document and rebuild if they change" mode builtin. It gets activated if you pass it the command line flag `-pvc`.
Suggesting things on this site is such an easy way to get better solutions. Thanks!
Memoir has options like \sloppy bottom. But honestly, the reason it doesn't is that it's virtually impossible to have an algorithm that gives you the best layout 100% of the time. Sometimes it's physically impossible not to have orphans or awkward spacing with the text you've given. You can never remove the human from the equation.
Yes, that's my point. \sloppybottom can look fine but it violates the requirement of real register-true typesetting where each typeblock has the same size on every page and the lines on a double page match exactly. Some publishers have this requirement and it's hard to work around it. This could in principle be improved by some subtle tradeoffs between line breaks in previous paragraphs, paragraph breaks, and page breaks. It's a kind of global optimization that is not possible in TeX due to principal limitations of the engine. See Section 4 of [1].

[1] https://tug.org/TUGboat/tb11-3/tb29mitt.pdf

Simon Cozens spent some time writing a new typesetter called SILE:

  https://sile-typesetter.org/
On of the design goals was to be able to achieve exactly that kind of line matching. IIRC it can ensure that lines on the front & back of a page line up exactly too; apparently this is important for bibles?

Worth taking a look at. It recently acquired TeX style mathematics typesetting ability & has a small but active developer group.