Skip to content

ultronozm/czm-tex-compile.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 

Repository files navigation

czm-tex-compile.el: Convenience functions for compiling LaTeX

Overview

This package provides a minor mode where latexmk continuously compiles the document in the background and the errors/warnings are reported via Flymake.

Configuration

Download this repository, install using M-x package-install-file (or package-vc-install, straight, elpaca, …), and add something like the following to your init file:

(use-package czm-tex-compile
  :bind
  ("C-c k" . czm-tex-compile-toggle))

Replace the keybinding with whatever you prefer (or delete it and just run the command via M-x).

You can tweak the underlying latexmk command via M-x customize-variable czm-tex-compile-command.

The command czm-tex-compile-toggle behaves the way that I prefer – it enables both czm-tex-compile-mode and flymake-mode, restricting the backends for the latter to those coming from the former. Depending upon your preferences, you may wish to write your own “wrapper” for czm-tex-compile-mode akin to czm-tex-compile-toggle.

The way the Flymake backend works, it will update only when the latexmk process reaches a “watching for changes” state and the buffer is unmodified. The workflow is thus to save the file, wait a few seconds for the compilation to complete, and then to use Flymake to navigate the errors. I configure Flymake to use M-n and M-p for navigation, and also use (setq flymake-show-diagnostics-at-end-of-line t), which displays the error/warning messages in the buffer itself rather than just in the minibuffer. Here’s something closer to my complete config (delete the “elpaca” entries if you don’t use that):

(use-package flymake
  :elpaca nil
  :custom
  (flymake-show-diagnostics-at-end-of-line t)
  :bind
  (:map flymake-mode-map
        ("M-n" . flymake-goto-next-error)
        ("M-p" . flymake-goto-prev-error)))

(use-package czm-tex-compile
  :elpaca (:host github :repo "ultronozm/czm-tex-compile.el"
                 :depth nil)
  :bind
  ("C-c k" . czm-tex-compile-toggle))

That’s all. I prefer this workflow to the alternative in which one compiles the document manually via TeX-command-master (C-c C-c) and navigates the warning/error messages using next-error (M-n) and previous-error (M-p). It also gives a handy way to keep the .aux files up-to-date; I take advantage of this feature in the packages czm-preview.el and czm-tex-fold.el to annotate the TeX buffer with label numbers.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published