/emacs-overleaf

Using Emacs to edit and sync Overleaf documents

Primary LanguageEmacs LispGNU General Public License v3.0GPL-3.0

Emacs-Overleaf

Table of Contents

What is this?

Emacs-Overleaf helps you sync a local Overleaf project with its remote.

Who needs this?

Those who want to use Emacs to edit Overleaf documents in a local machine will be interested. If you pay extra dollars to sync Overleaf projects via Dropbox, this is not for you.

Motivation

Collaborators use Overleaf to share LaTeX documents. Rather than using an online Overleaf editor, I choose Emacs to edit the documents. To do so, I need to frequently sync an Overleaf project with a local project using Git. When I fail to do so, there is a high probability that I waste my time resolving merge conflicts.

What does this do?

Upon switching to a local project using projectile, the local will be synced with the Overleaf project. Saving LaTeX or BibTeX buffer will trigger the following actions depending on a value of its buffer-local variable, overleaf-auto-sync

  • nil: Occasionally show you a sync reminder;
  • “always”: Commit and push local changes to Overleaf with auto-generated commit messages;
  • “ask”: Ask if you want to commit and push local changes to Overleaf with auto-generated commit messages; or
  • “never”: Do nothing.

How to use

config.el needs either (require 'emacs-overleaf) or (use-package emacs-overleaf :commands (overleaf-setup)). The project’s origin master should be set as the corresponding Overleaf project. The project’s .dir-local.el needs to contain (eval . (overleaf-setup)) as follows:

((nil . ((eval . (overleaf-setup)))))

Also, add overleaf-auto-sync to file-local-variable to determine what action will be performed after saving.

Caution

A local file that has not been staged won’t be synced!