### Start dbus with launchctl Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt If 'brew services start dbus' fails, try starting dbus manually with launchctl. This may need to be done after each system restart. ```shell launchctl start org.freedesktop.dbus-session ``` -------------------------------- ### LaTeX Example Environment Source: https://github.com/lervag/vimtex/blob/master/test/test-syntax/test-minted.tex A simple LaTeX example environment. ```tex \begin{example} Hello world \end{example} ``` -------------------------------- ### Start Vim Clientserver Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Ensures Vim starts with a clientserver if possible. This is required for inverse search from PDF viewers. ```vim if empty(v:servername) && exists('*remote_startserver') call remote_startserver('VIM') endif ``` -------------------------------- ### Install coc.nvim Plugin Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Installs the coc.nvim plugin using vim-plug. ```vim Plug 'neoclide/coc.nvim' ``` -------------------------------- ### Start with Local File for Subfiles Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Specify whether to start with the local file instead of the main project file for subfile'd documents. ```vim let g:vimtex_subfile_start_local = 1 ``` -------------------------------- ### Install Zathura with Synctex and Poppler Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Install Zathura with Synctex support and the Poppler PDF renderer using Homebrew. This involves tapping a repository, installing packages, and creating a symbolic link. ```shell brew tap zegervdv/zathura brew install girara brew install zathura --with-synctex brew install zathura-pdf-poppler mkdir -p $(brew --prefix zathura)/lib/zathura ln -s $(brew --prefix zathura-pdf-poppler)/libpdf-poppler.dylib $(brew --prefix zathura)/lib/zathura/libpdf-poppler.dylib ``` -------------------------------- ### GFM Scheme Example Visualization Source: https://github.com/lervag/vimtex/blob/master/test/test-indentation-timing/thesis.tex This LaTeX code visualizes a one-dimensional grid with an interface, illustrating the setup for the GFM scheme. ```latex \fill[black!2] (-0.9,0) rectangle (0.45,1); \draw[dotted] (-0.9,0) grid (2.5,1); \draw[thick] (0.45,0) -- (0.45,1) node[above] {$\Gamma$}; \fill (0.0,0.5) circle(1pt) node[above left] {$k-1$}; \fill (1.0,0.5) circle(1pt) node[above left] {$k$}; \fill (2.0,0.5) circle(1pt) node[above left] {$k+1$}; ``` -------------------------------- ### Install VimTeX with vim-plug (specific tag) Source: https://github.com/lervag/vimtex/blob/master/README.md Use this configuration with vim-plug to pin the installation to a specific release tag, ensuring stability. ```vim Plug 'lervag/vimtex', { 'tag': 'v2.15' } ``` -------------------------------- ### Basic LaTeX Commands Source: https://github.com/lervag/vimtex/blob/master/test/test-syntax/test-conceal.tex Examples of basic LaTeX commands for text formatting and structure. ```latex test( a) = 1 f = g ``` ```latex _i=1^n a_i = 0 ``` -------------------------------- ### Shell Session Example Source: https://github.com/lervag/vimtex/blob/master/test/test-syntax/test-minted.tex A sample shell session showing the 'ls -l' command. ```shell-session $ ls -l $ ls -l ``` -------------------------------- ### Example .latexmain Specifier Usage Source: https://github.com/lervag/vimtex/wiki/Introduction Demonstrates how to use an empty .latexmain file to indicate the main LaTeX file for other files in the project. ```text path/file.tex path/file.tex.latexmain path/sections/file1.tex path/sections/file2.tex ``` -------------------------------- ### nvim-compe Setup for TeX Omni-completion Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Enables the omni-completion source for TeX files in nvim-compe. ```lua require('compe').setup({ source = { omni = { filetypes = {'tex'}, }, }, -- the rest of your compe config... }) ``` -------------------------------- ### Install YaLafi with pip Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Installs the YaLafi Python package using pip for user-level installation. ```sh pip install --user yalafi ``` -------------------------------- ### Install coc-vimtex Extension Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Installs the coc-vimtex extension for coc.nvim. ```vim :CocInstall coc-vimtex ``` -------------------------------- ### Install VimTeX with vim-plug (latest) Source: https://github.com/lervag/vimtex/blob/master/README.md Add this line to your vim-plug configuration to install the latest version from the master branch. ```vim Plug 'lervag/vimtex' ``` -------------------------------- ### LaTeX Array Example Source: https://github.com/lervag/vimtex/blob/master/test/test-syntax/test-array.tex Illustrates a basic LaTeX array with specified column formatting. ```latex \[ \mathrm{a} = \begin{array}{l*{4}{m{1cm}}}r} \mathrm{b} & bar & baz & a & b & 2\\ foo & bar & baz & a & b & 2\\ \end{array} \] ``` -------------------------------- ### Query TEXMFHOME Variable Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Queries the TEXMFHOME variable to find the default TeX Live installation directory. ```bash kpsewhich --var-value TEXMFHOME ``` -------------------------------- ### NCM2 Setup for VimTeX Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Basic NCM2 configuration to enable completion for VimTeX in TeX files. Includes plugin recommendations and autocommand setup. ```vim " include the following plugins (here using junnegun/vim-plug) Plug 'roxma/nvim-yarp' Plug 'ncm2/ncm2' set completeopt=noinsert,menuone,noselect augroup my_cm_setup autocmd! autocmd BufEnter * call ncm2#enable_for_buffer() autocmd Filetype tex call ncm2#register_source({ \ 'name': 'vimtex', \ 'priority': 8, \ 'scope': ['tex'], \ 'mark': 'tex', \ 'word_pattern': '\w+', \ 'complete_pattern': g:vimtex#re#ncm2, \ 'on_complete': ['ncm2#on_complete#omni', 'vimtex#complete#omnifunc'], \ }) augroup END ``` -------------------------------- ### Bash Script Example Source: https://github.com/lervag/vimtex/blob/master/test/test-indentation/test_verbatim_reference.tex A simple bash script that echoes a test string. This demonstrates basic script execution. ```bash #!/bin/bash echo "test" ``` -------------------------------- ### Custom VimTeX Documentation Handler Example Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Example of a custom VimTeX documentation handler function. It uses vimtex#doc#make_selection to allow user selection and then calls an external command. ```vim let g:vimtex_doc_handlers = ['MyHandler'] function! MyHandler(context) call vimtex#doc#make_selection(a:context) if empty(a:context.selected) | return 0 | endif execute '!myhandler' a:context.selected '&' return 1 endfunction ``` -------------------------------- ### Alignment with sl Environment Source: https://github.com/lervag/vimtex/blob/master/test/test-syntax/test-ieeetrantools.tex Provides an example of using the `sl` environment for alignment, often used within boxing environments. ```tex sl text & math ``` -------------------------------- ### nvim-compe Setup for TeX Omni-completion (Vimscript) Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Enables the omni-completion source for TeX files in nvim-compe using Vimscript. ```vim let g:compe.source = { \ 'omni': { \ 'filetypes': ['tex'], \ } \ } ``` -------------------------------- ### nvim-cmp Setup with cmp-vimtex Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Configures nvim-cmp to use the dedicated cmp-vimtex source for TeX files, enabling enhanced completion features. ```lua local cmp = require('cmp') cmp.setup { -- global configuration goes here sources = { { name = 'buffer' }, -- other sources (GLOBAL) }, } cmp.setup.filetype("tex", { sources = { { name = 'vimtex' }, { name = 'buffer' }, -- other sources }, }) ``` -------------------------------- ### Configure VimTeX Documentation Handlers Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Set a list of custom documentation handlers for VimTeX. This example shows how to use the local texdoc handler. ```vim let g:vimtex_doc_handlers = ['vimtex#doc#handlers#texdoc'] ``` -------------------------------- ### Simple Beamer Frame Source: https://github.com/lervag/vimtex/blob/master/test/test-motions/test-beamer.tex A basic example of a frame in a beamer presentation. No specific setup is required beyond standard LaTeX and beamer package inclusion. ```latex \documentclass{beamer} \begin{document} Test I Simple frame \begin{frame} Simple frame \end{frame} \end{document} ``` -------------------------------- ### Configure Inverse Search for Skim with Neovim (Homebrew) Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Example of configuring inverse search for Skim with Neovim installed via Homebrew, specifying the executable path. ```bash Command = /opt/homebrew/bin/nvim Arguments = --headless -c "VimtexInverseSearch %line '%file'" ``` -------------------------------- ### Global Asymptote Definitions and Imports Source: https://github.com/lervag/vimtex/blob/master/test/test-syntax/test-asymptote.tex Shows how to include global Asymptote definitions, import the 'three' module for 3D graphics, and use the 'bm' package. This is useful for setting up a project with advanced features. ```asy // Global Asymptote definitions can be put here. import three; usepackage("bm"); texpreamble("#1#1"); // One can globally override the default toolbar settings here: // settings.toolbar=true; ``` -------------------------------- ### Basic Gate Placement Source: https://github.com/lervag/vimtex/blob/master/test/test-syntax/test-quantikz.tex Demonstrates placing a single gate on a specific qubit line. Ensure the QuantikZ package is loaded. ```latex q_{1} & \gate[4]{e^{i t H_C}} & \\ q_{2} & & \\ q_{3} & & \\ q_{4} & & \\ ``` -------------------------------- ### Configure Quickfix Window Behavior Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Set the behavior of the quickfix window when errors or warnings are detected. Options range from never opening it to opening it as the active window. ```vim let g:vimtex_quickfix_mode = 2 ``` -------------------------------- ### Show Document Overview Source: https://github.com/lervag/vimtex/blob/master/test/example-quick-start/main.tex Press lo to display a window with a table of contents, labels, references, and TODOs for the document. ```Vimscript Press lo to show a window with a table of contents for your document. Also shows labels, references and TODOs. Can be used to jump to sections, labels, references and TODOs. ``` -------------------------------- ### Install LanguageTool via Pacman Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Installs LanguageTool using the pacman package manager on Arch Linux. ```sh sudo pacman -S languagetool ``` -------------------------------- ### CFDM: Initial Grid and Interface Point Source: https://github.com/lervag/vimtex/blob/master/test/test-indentation-timing/thesis.tex Illustrates the initial grid and the location of a single point on the closest interface (x3) relative to the target grid point (xi,j). This is the first step in the CFDM process. ```latex \clip (-0.25,-0.25) rectangle (5.5,5.25); \draw[thick] ( 0.80, 8.25) arc (182:257:9.0cm); \draw[thick] (-2.25, 2.35) arc ( 80: 44:9.0cm); \fill[black!2] ( 0.80, 8.25) arc (182:257:9.0cm) -- ( 6, 6) -- cycle; \fill[black!2] (-2.25, 2.35) arc ( 80: 44:9.0cm) -- (-1,-1) -- cycle; \draw[dotted] (-0.25,-0.25) grid (5.25,5.25); \node[below right] at (2,2) {$\vct x_{i,j}$}; \foreach \i in {1,2,3} \foreach \j in {1,2,3} \fill (\i,\j) circle(1pt); \fill (2.83, 2.83) circle(2pt) node[right] {$\vct x_3$}; ``` -------------------------------- ### Fold Fake Sections Example Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Example of how VimTeX recognizes and folds 'fake' sections, which are comments that mimic LaTeX sectioning commands. ```latex % fakepart title % Fakechapter title % Fakesection title % fakesubsection title ``` -------------------------------- ### Configure Compiler Backend Source: https://github.com/lervag/vimtex/blob/master/README.md Changes the default compiler backend from 'latexmk' to 'latexrun'. Consult documentation for supported backends. ```vim " VimTeX uses latexmk as the default compiler backend. If you use it, which is " strongly recommended, you probably don't need to configure anything. If you " want another compiler backend, you can change it as follows. The list of " supported backends and further explanation is provided in the documentation, " see ":help vimtex-compiler". let g:vimtex_compiler_method = 'latexrun' ``` -------------------------------- ### Open Quickfix on Warning Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Control whether the quickfix window should automatically open when there are warning messages but no error messages. ```vim let g:vimtex_quickfix_open_on_warning = 1 ``` -------------------------------- ### Example BibTeX Entry Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt An example of a BibTeX entry used for citation completion. The 'author', 'title', and 'year' fields are commonly used for smart completion matching. ```bibtex @book{knuth1981, author = "Donald E. Knuth", title = "Seminumerical Algorithms", publisher = "Addison-Wesley", year = "1981" } ``` -------------------------------- ### Custom Mapping Example in Vimscript Source: https://github.com/lervag/vimtex/wiki/Usage Example of how to define a custom mapping in Vimscript, overriding a default Vimtex mapping. This ensures the user's preferred mapping takes precedence. ```viml nmap li (vimtex-info) ``` -------------------------------- ### Inline C Code Source: https://github.com/lervag/vimtex/blob/master/test/test-syntax/test-listings.tex Demonstrates inline C code using \lstinline. ```C int x; ``` -------------------------------- ### JSON Object Example Source: https://github.com/lervag/vimtex/blob/master/test/test-syntax/test-minted.tex A simple JSON object. ```json { "test": 1 } ``` -------------------------------- ### C Code Snippet Source: https://github.com/lervag/vimtex/blob/master/test/test-syntax/test-minted.tex A standard C 'hello, world' program. ```c int main() { printf("hello, world"); return 0; } ``` -------------------------------- ### :VimtexCompileSS Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Starts a single shot compilation of the LaTeX document with specified options. ```APIDOC ## :VimtexCompileSS [opts] ### Description Start single shot compilation of the LaTeX document. ### Method Command ### Endpoint :VimtexCompileSS [opts] ### Parameters #### Path Parameters - **opts** (string) - Optional - Arguments passed to the compiler as options. ``` -------------------------------- ### nvim-cmp Setup with cmp-omni Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Configures nvim-cmp to use the general omni-completion source for TeX files, with a custom formatting function to preserve VimTeX's omni completion format. ```lua local cmp = require('cmp') cmp.setup { -- global configuration goes here sources = { { name = 'buffer' }, -- other sources (GLOBAL) }, } cmp.setup.filetype("tex", { formatting = { -- nvim-cmp overrides the standard completion-menu formatting. We use -- a custom format function to preserve the format as provided by -- VimTeX's omni completion function: format = function(entry, vim_item) vim_item.menu = ({ omni = (vim.inspect(vim_item.menu):gsub('%"', "")), buffer = "[Buffer]", -- formatting for other sources })[entry.source.name] return vim_item end, }, sources = { { name = "omni", trigger_characters = { "{", "\\ ``` ```lua name = 'buffer' }, -- other sources }, }) ``` -------------------------------- ### Mathematical Expressions with Text Source: https://github.com/lervag/vimtex/blob/master/test/test-syntax/test-conceal.tex Examples of embedding text and symbols within mathematical expressions. ```latex $P(x | y) =$ ``` ```latex asd $\alpha$ ``` ```latex $\mathrm{Re} = \cdots$ ``` ```latex $f~x$ ``` -------------------------------- ### Rust Hello World Program Source: https://github.com/lervag/vimtex/blob/master/test/test-syntax/test-custom-envs.tex A basic 'Hello World' program in Rust. ```rust fn main() { println!("Hello World!"); } ``` -------------------------------- ### Alias Vim for Clientserver Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Adds an alias to your shell configuration to start Vim with the clientserver option automatically. ```bash alias vim='vim --servername VIM' ``` -------------------------------- ### Python Node Creation Source: https://github.com/lervag/vimtex/blob/master/test/test-syntax/test-pythontex.tex This example demonstrates creating a LaTeX node using Python within a pycode environment. It's useful for dynamically generating TikZ or other node-based structures. ```latex print(r'\node {This is python};') ``` -------------------------------- ### Basic Alignment with srCl Source: https://github.com/lervag/vimtex/blob/master/test/test-syntax/test-ieeetrantools.tex Demonstrates basic alignment using the `srCl` environment for simple equations. ```tex srCl text & 11 &=& 1 text & 1 &=& 11 ``` -------------------------------- ### Basic Python Print Statement Source: https://github.com/lervag/vimtex/blob/master/test/test-syntax/test-tikz-python.tex A simple Python print statement. This is a basic example of Python code. ```python print(r'This is python.') ``` -------------------------------- ### Mathematical Environments Source: https://github.com/lervag/vimtex/blob/master/test/test-syntax/test-conceal.tex Illustrates the display math environment for centered equations. ```latex \begin{equation*} \lVert \mathrm{w} \rVert_2^2 \end{equation*} ``` -------------------------------- ### Python Code Example Source: https://github.com/lervag/vimtex/blob/master/test/test-syntax/test-pyluatex.tex This snippet demonstrates Python code. Vimtex syntax highlighting may not recognize this language. ```python print("I am python but vimtex syntax highlighting does not know me") ``` ```python print("I am python but vimtex syntax highlighting does not know me") ``` ```python print("I am python but vimtex syntax highlighting does not know me") ``` -------------------------------- ### Configure Viewer Method (Specific) Source: https://github.com/lervag/vimtex/blob/master/README.md Sets a specific built-in viewer method for VimTeX. Example uses 'zathura'. ```vim " Viewer options: One may configure the viewer either by specifying a built-in " viewer method: let g:vimtex_view_method = 'zathura' ``` -------------------------------- ### VimTeX Label Completion Example Source: https://github.com/lervag/vimtex/blob/master/doc/vimtex.txt Shows how label completion is triggered for \ref commands. The completion offers a menu with reference values and page numbers, matching against labels. ```vim \ref{sec: ``` -------------------------------- ### TikZ Plot Node and Axis Setup Source: https://github.com/lervag/vimtex/blob/master/test/example-startup-timing/thesis.tex Sets up another plot node and draws its radial and axial axes. ```latex \node[plot] (p3) [right=1.5em of p2] {\includegraphics[width=0.26\textwidth]{locurv_2}}; \draw[axes] (p3.south west) -- (p3.south east) node[right=0pt] {$r$}; ``` ```latex \draw[axes] (p3.south west) -- (p3.north west) node[above=0pt] {$z$}; ```