This video introduces a new Emacs feature that extends live LaTeX preview capabilities beyond its native integration in Org mode to a wide range of other major modes. The "Artic preview" system is showcased demonstrating its ability to render LaTeX fragments directly within various Emacs buffers, including code comments in Julia and MATLAB, complex mathematical outputs from the Emacs built-in calculator (Cal), and content within RSS readers (L-feed) and read-it-later clients. The feature aims to provide faster, non-blocking, theme-integrated, and automatically updating previews, significantly enhancing the experience of editing technical and mathematical documents within Emacs. The underlying mechanism relies on major modes providing rudimentary parsers to feed LaTeX fragments to a central preview generator. The video concludes by discussing the current development status, future potential for integration with modern typesetting systems like Typst, and the overall benefit of pervasive LaTeX rendering across Emacs.
Enhancing Emacs: Live LaTeX Previews Across Major Modes
0:00:03 - Introduction to Universal LaTeX Previews: The video's core focus is on integrating LaTeX previews directly inside Emacs documents across various modes, rather than just using Emacs to write LaTeX documents or relying solely on Org mode's existing capabilities.
0:01:07 - Org Mode Preview Enhancements: Planned improvements for Org mode's LaTeX previews include "live updates" as text is typed, increased speed, non-blocking operation, seamless integration with Emacs themes, automatic updates, and accurate numbering, all requiring a standard LaTeX installation.
0:02:42 - Extending Previews Beyond Org Mode: The key innovation is the ability to invoke Org mode's "Artic preview" command in other Emacs major modes, providing LaTeX rendering outside of Org mode.
0:03:19 - LaTeX in Code Comments: The feature is demonstrated in code buffers for Julia (0:03:30) and MATLAB (0:04:05), where LaTeX markup within comments or strings is live-previewed directly in the editor, updating as the user types.
0:04:30 - LaTeX Output in Emacs Calculator (Cal): A substantial portion of the video highlights the Emacs calculator's extensive capabilities—ranging from matrix algebra (LU factorization, inversion, integration) to Taylor series, determinants, polynomial factoring, and error propagation with ranges and complex numbers. Crucially, Cal can now render its complex mathematical output directly in LaTeX.
0:09:41 - Live Previews in LaTeX Mode: While existing Octc tools already offer in-buffer previews, the new system provides live-updating LaTeX previews within LaTeX mode itself, which is particularly beneficial for editing complex multi-line math environments.
0:10:31 - Broadening Emacs's Technical Content Handling: Unexpectedly useful applications include displaying LaTeX fragments in academic abstracts within L-feed (Emacs RSS reader, 0:10:55) and technical articles in a read-it-later client (0:11:11), further reducing the need to leave Emacs for technical content.
0:11:33 - Technical Implementation: The system achieves its universality by having each major mode provide a simple parser to collect LaTeX fragments and metadata, which are then processed by a central LaTeX preview generator. An example shows this can be achieved with only about 20 lines of code for a new major mode.
0:12:29 - Development Status and Future Plans: The feature is approximately "80% there" for Org mode, with a development branch available for community testing. Future work includes implementing similar preview capabilities for modern typesetting systems like Typst, which is expected to be easier due to its robust interprocess communication support.
0:13:53 - Key Takeaway: Providing consistent, live LaTeX rendering across diverse Emacs environments significantly enhances productivity and user experience for anyone working with scientific, engineering, or mathematical documents.