Moontex is a Neovim plugin that provides basic features to work with LaTex files. This is a personal project and does NOT aim to be a complete and feature-rich plugin. You should use this only if you need a basic latex plugin that integrates with other lua plugins (TreeSitter, LSP, LuaSnips). Most users should definetely opt for Vimtex instead
Moontex provides basic features such as
- Continuous compilation using latexmk
- Forward/inverse search with skim
- Treesitter based conceal and hilighting
- Support for multi-file projects
- Treesitter based context detection (for context specific snippets with LuaSnips or UltiSnips)
In order for compilation to work, latexmk should be installed. It very likely comes by default with your latex distribution. Check if it's installed by running:
latexmk -version
Install with any plugin manager, e.g. Packer:
use 'mattia-marini/MoonTex'
Note that the context detection and conceal features relie on Treesitter, hence you should install it togheter with a latex parser
Not much to do here. Configure like any other plugin. Below are listed the default settings:
require("MoonTex").config({
workspace_folder_name = "latex_workspace",
mainfile_name = "main.tex",
max_search_depth = 5,
server_name = "tex_server"
})
workspace_folder_name
: when trying to detect the main file, moontex searches in the partent folders of the current buffer. When a folder matches this name though, it stops.mainfile_name
: simplest way to efficiently detect the main file is to explicitly set its name. Other ways of detecting the mainfile will be implemented in the near futuremax_search_depth
: the max number of recursions to do in order to set the main file path.server_name
: the name of moontex's socket. The socket is created in the same directory as the main file
By far, document syncing is supported only on Skim. Forward search should work out of the box, whereas you should setup skim in order for backward search to work properly.
- Open a .tex file with moontex installed and run
MTPrintSkimCommand
- Open
skim -> Preferences -> Sync
and paste the otput of the previous command in the corresponding sections. Your command should look something like this:
command: nvim
args: --headless --noplugin -u /Users/<your-name>/.local/share/nvim/site/pack/packer/start/MoonTex/lua/MoonTex/search.lua -c "InverseSearch \"%file\" %line"
In order for moontex to work properly, your workspace folder should look something like this:
latex_workspace
├── project1
│ ├── images
│ │ ├── image1.jpg
│ │ └── image2.pdf
│ ├── main.tex
│ └── sections
│ ├── sec1.tex
│ └── sec2.tex
└── project2
├── images
│ ├── image1.jpg
│ └── image2.pdf
├── main.tex
└── sections
├── sec1.tex
└── sec2.tex
- Navigation (Table of Contents/labels)
- Forward/inverse search in pdf viewers other that skim
- Support for fallback main-file detection methods