1

I use tex for typing up my paper. It takes about 10 seconds to compile a 30-page paper (with images). While it isn't too bad, I wish it smoother.

I thought it is just the natural limit of compiler. However, recently I saw a colleague using texpad (ads unintended), which compiles and shows the end result on the fly! I wonder what's the technology behind it, and how one can achieve such compilation speed in linux.

Student
  • 205
  • Here is an official blog that talks about the feature a bit: https://www.texpad.com/blog/ – Dr. Manuel Kuehner Jun 07 '22 at 20:10
  • My understanding is that this is a rewrite of TeX that comes with some limitations, see unsupported packages https://www.texpad.com/docs/tutorials/tex/typesetters/texpadtex/package-coverage#2-not-currently-supported. – Dr. Manuel Kuehner Jun 07 '22 at 20:13
  • You can use/test latexmk with option -pvc. – Unknown Jun 07 '22 at 20:26
  • It is not at all the same, but in Linux you can Gummi to compile automatically every x seconds or after y seconds of editor activity, and show the result in a preview pane. For a small documents, x=1 second is almost a true live preview. For large documents that take a long time to compile is better set y >> 1 seconds, or just deactivate the automatic compilation, to avoid compilations after every minimal typing pause. – Fran Jun 07 '22 at 21:26
  • I wrote a plugin for neovim (on linux) that compiles in the background and live updates as you type. It won't be instantaneous for a 30 page paper though. You might try experimenting with settings for your document: pdflatex is faster than xelatex, for example, and if you have images, you can use draftmode, or if you have figures you know won't change you can precompile them and include them as images without rebuilding them every time... – frabjous Jun 08 '22 at 00:54
  • Use mylatexformat. If this isn't fast enough, combine with latexmk. – Keks Dose Jun 08 '22 at 06:20
  • Actually... the question is more specific than I thought. But since there's some good content there, why don't you move the answer to the target questions. – user202729 Jun 08 '22 at 12:03

1 Answers1

2

The following answer is taken from the official blog post shared by Dr. Manuel Kuehner in the comment.


Besides the following improvements

  1. remove the need to have the data flow through disks
  2. write the compiler in C++
  3. use Apple’s Metal framework to write the characters and shapes of the output directly into graphics memory (rather than creating this intermediate representation)

The game changer is that they manage to do incremental typesetting, as seen in the following quote

Even more excitingly the deeper editor/typesetter integration allowed us to move from the traditional typeset model to “Live typeset” in Texpad 1.8. Rather than starting at the beginning of a document, and working all the way to the end with each typeset, TexpadTeX could consult with the editor and the viewer, and typeset only the part of the document between a user’s cursor, and the end of what is visible in the output viewer. By typesetting just what the user needs to preview their work, this incremental model greatly reduces the time required for a typeset. This allowed us to run a typeset with each keystroke, which in most cases gives the user an almost realtime preview of the output. The downside of moving from a typeset once every few minutes, to more than one a second, is that the extra computation made Texpad thirsty for battery power.

Student
  • 205