Interactive setup for LaTeX LSP development environment
Interactive setup for LaTeX LSP development with Texlab, ChkTeX, and build tools. Installs and configures everything needed for intelligent LaTeX editing with real-time diagnostics and linting.
/plugin marketplace add zircote/latex-lsp/plugin install latex-lsp@zircote-lspThis command will configure your LaTeX development environment with Texlab LSP and essential tools.
First, verify a TeX distribution is installed:
pdflatex --version || xelatex --version || lualatex --version
If not installed, install a TeX distribution:
brew install --cask mactex or brew install --cask basictexsudo apt install texlive-full (Debian/Ubuntu) or sudo dnf install texlive-scheme-full (Fedora)Option 1: Cargo (recommended)
cargo install --locked texlab
Option 2: Package Manager
# macOS
brew install texlab
# Arch Linux
sudo pacman -S texlab
# Fedora
sudo dnf install texlab
# macOS
brew install chktex
# Debian/Ubuntu
sudo apt install chktex
# Fedora
sudo dnf install chktex
# Arch Linux
sudo pacman -S chktex
# Check Texlab
texlab --version
# Check ChkTeX
chktex --version
# Check LaTeX
pdflatex --version
# Usually included with TeX Live
latexmk --version
# If not available, install TeX Live extras
sudo apt install latexmk # Debian/Ubuntu
export ENABLE_LSP_TOOL=1
Create texlab.toml or .texlabrc in your project root:
[build]
executable = "latexmk"
args = ["-pdf", "-interaction=nonstopmode", "-synctex=1", "%f"]
onSave = false
[chktex]
onEdit = true
onOpenAndSave = true
[formatting]
lineLength = 80
Create .chktexrc in your project root to customize warnings:
# Disable specific warnings
-n1 # Command terminated with space
-n2 # Non-breaking space (~) should be used
-n8 # Wrong length of dash
# Set tabsize
TabSize = 2
Test the LSP integration:
# Create a test file
cat > test_lsp.tex << 'EOF'
\documentclass{article}
\begin{document}
Hello, \LaTeX!
\end{document}
EOF
# Run chktex
chktex test_lsp.tex
# Clean up
rm test_lsp.tex
Set the TeX path in texlab.toml:
[build]
executable = "/usr/local/texlive/2023/bin/x86_64-darwin/latexmk"
latexmk is installedtexlab.tomlwhich pdflatexCreate .chktexrc to disable specific warnings (see Configuration section above).
# macOS
brew install texlab chktex && brew install --cask basictex
# Debian/Ubuntu
sudo apt install texlive-latex-base texlive-latex-recommended \
texlive-latex-extra latexmk chktex && \
cargo install --locked texlab
# Fedora
sudo dnf install texlive-scheme-medium latexmk chktex && \
cargo install --locked texlab