Auto-complete latex commands

I write some raw latex codes in Scrivener. I would like to speed up the process by saving some frequently used commands into the auto-completion list. However it seems that the ‘’ at the beginning of those commands is preventing the commands from being recognised by auto-completion. Removing ‘’ from the items in the auto-completion list solves the problem partially, but introduces a new problem because it interferes with writing normal English words.

Has anyone ever done this before? What’s your experience? Huge thanks for any help!

P.S. It would be even greater if there is a way to insert a latex environment snippet into the document being edited.

Scrivener 3.2.3 running on MacOS Monterey 12.0.1.

Punctuation prefixing a term has long been a limitation of the auto-completion system that cannot be easily worked around, at least not without hard-coding the capability (as we have for Scrivener’s own placeholders).

For anything more advanced than some phrases here and there, I highly recommend getting a system-wide text expansion tool. Not only do these tend to be a whole lot more powerful than simple prefix-based typing aids, they also work anywhere you type. In effect you can create expansions that more closely mimic how dedicated LaTeX extensions or text editors would work. For instance, you could create one that generates this, where {^} signifies the cursor position:


I use an open source tool called Espanso for this kind of stuff. It is capable of quite a lot—most of what some of the more expensive alternatives are—though presently at the cost of primarily using plain-text configuration (YAML). Depending on your preferences though, that may not actually be a downside.

1 Like

Just downloaded Espanso. Love the fact that it’s open source. Thanks for the suggestion!

I think you’d like TextExpander for that.

1 Like