Questions tagged [filetype-tex]

Questions about editing Tex documents, either with or without a frontend such a LaTeX.

Filter by
Sorted by
Tagged with
2
votes
1answer
47 views

Why does vim still auto-indent LaTeX after I set noai noci nosi?

I want to disable autoindent and smartindent for LaTeX so I did :set noai noci nosi When I open a brand new mwe.tex, filetype=plaintex and there is no auto indent magic. When I then enter some code,...
3
votes
0answers
50 views

Vimtex conceal doesn't recognize new command math environment

I recently added the vimtex plugin which includes a conceal feature which I really like; however, I found it doesn't work in custom math environments such as \newcommand{\beq}{\begin{equation}} \...
1
vote
1answer
57 views

How to set LaTeX syntax to “ConTeXt” in vimrc

TL;DR: How do I permanently and persistently :set syntax=context for *.tex files? I've been using vim for a LaTeX project, with monokai-tasty as the colour scheme. The default syntax highlighting ...
3
votes
1answer
21 views

How can I make $ in LaTeX insert \( and \) automatically? [duplicate]

I'm writing a lot of LaTeX recently, and am used to hitting the $ key for inline math, but have heard that \( and \) is better (apparently it confuses vim less, especially with $$, which I'm also not ...
0
votes
1answer
31 views

Yank both sides of equation

While writing in latex I often want to copy a math equation's right hand side or left hand side. For example I have something like this \begin{gather*} 5 \cdot \left( A A 3 \right) + 50 \cdot \...
0
votes
0answers
30 views

context for multiple snippets

I have a function that determines whether I am in a mathmatical context within latex, using ultisnips. I want to this to be applied to many snippets at once. context "math()" snippet fun "function" ...
1
vote
1answer
38 views

Execute command only for specified filetype

I'm setting up an environment to automatically recompile .tex files on save. I've found solution for this: autocmd BufWritePost *.tex :! latexmk -pdf But is there any better way to do this? It seems ...
1
vote
1answer
28 views

When does the file depending plugin kicks in?

I'm learning to use Vim with vim-latex and I'm wondering when does the plugin actually activates once I open a file. My intuition tells me that any file with the .tex extension should do it, but if I ...
2
votes
2answers
27 views

vimrc and finding errors in latex document

To find errors in a latex document, I open vim on the .log file. Then I type manually /^l\.\|[Ee]rr\|[Ww]ar followed by RETURN This extended regular expression works well. It matches a line starting ...
0
votes
1answer
58 views

How to show all LaTeX code but still have set conceallevel=3 for vim-devicons and NERDTree?

How can I adjust my .vimrc so that set conceallevel=0 is specific to just LaTeX documents? The plugin vim-devicons requires the following conceal level with NERDTree: set conceallevel=3 However, ...
0
votes
1answer
34 views

Run pdflatex in vim without a pop-up window

I currently have this autocommand in my vimrc: autocmd BufWritePost *.tex silent! execute "!pdflatex %" | redraw! It compiles my current LaTeX file whenever I save with :w. However, a terminal ...
0
votes
0answers
91 views

UltiSnips: snippets not expanding

This is a noob question. I just installed UltiSnip to make use of the TeX snippets. Here is the relevant part of my init.vim: " Specify a directory for plugins (powered by vim-plug) call plug#begin('~...
1
vote
2answers
215 views

VIM conceal doesn't work

VIM doesn't conceal text, for example tex. Here's my vimrc: "commands for vim-plug "PlugInstall - installs plugs "PlugUpdate - updates plugs "PlugClean - remove unused directories "PlugUpgrade -...
1
vote
1answer
56 views

Multiline errorformat

I would like to parse the latex log to extract warnings from the refcheck package. These warnings look like this Package refcheck Warning: Unused label `eq:my_equation_label' on input line 2 28. The ...
1
vote
1answer
115 views

Latex-suite <alt-I> mapping

Last week I reinstalled Ubuntu 18.04 LTS on my laptop. During my last installation of ubuntu (also 18.04) I learned vim and used it in combination with the latex-suite. However on this new ...
0
votes
1answer
58 views

Stop vim-latex from autocompiling on save

I'm not sure if it has always happened or its just recent, but vim auto-compiles on each save (:w). I would like to only manually compile (I use a hot-keyed pdflatex command instead). I've had a ...
1
vote
0answers
41 views

Ignore acronyms as spelling errors in TeX files

My LaTeX files contain lots of acronyms and they are often highlighted as spelling errors. I tried to ignore acronyms by adding syn match AcronymNoSpell '\<\(\u\|\d\)\{3,}s\?\>' contains=@...
1
vote
0answers
34 views

How to stop vim from automatically displaying latex formatting?

I have a latex file I am editing in vim. Something annoying that I'm running into is that vim seems to auto display things that I am typesetting in math mode. Here is an example. Say I write the ...
1
vote
0answers
28 views

custom syntax hilighting lost on single LaTeX file

I use vimtex plugin for writing tex documents in vim8. I added custom hilight for sections in my .vimrc like so: autocmd FileType tex :syntax match texSectioning "\\section.*" The texSectioning is ...
0
votes
1answer
42 views

inoremap inserts unwanted tabs

I recently made myself custom insert mode keybindings to type faster in LaTeX. However, When I use them, Vim adds tabs that weren't part of the original keybinding. Example: Here is my inoremap: ...
2
votes
1answer
250 views

UltiSnips, Context and Tex

For best experience, I want to enable some snippets to be expanded only in Tex Math environments. A wonderful person, lacygoill helped me on GitHub to achieve just this with the following setup: Let ...
0
votes
1answer
38 views

LaTeX indent for \iff error in vim

With the minimal vimrc (with vimtex plugin): set nocp filetype plugin indent on syntax on set st=2 set acd set wildmenu set wildmode=longest,list,full let $USRPLUGD=$HOME.'\vimfiles\myvim\plugged' ...
0
votes
1answer
28 views

fnameescape() : add other characters to be escaped (parenthesis, commas etc)

I looked around for a long time but did not find any solution for that. On my Unix system (Ubuntu), using LaTeX-suite, I need to escape some characters in file names for compilation, say parenthesis (,...
0
votes
1answer
43 views

Make conditional imap to text being enclosed in certain characters

How can I create mappings that work only if the cursor is enclosed by certain characters? As an example, I want to map ja to \alpha if the cursor is enclosed by $$ or by \[\] so as to make This jar ...
2
votes
2answers
200 views

How to force vimtex to display \textbf and \textit in insert/normal mode?

When I add \textbf{} or \textit{} before a word in vimtex the terminal shows the word but strangely hides the commands. I can only see them in the visual mode (see pictures below). Is there a way to ...
0
votes
1answer
33 views

Read the first line of the current file to process it in a command (Emulating %TeX root)

Currently I have the line :nnoremap <leader>c :w<CR>:!arara %<CR><CR> in my $MYVIMRC. If I press <leader>c, it will save the current file and run the command arara on ...
0
votes
1answer
28 views

How to map a call to a system function using the current filename?

I've been using vim for a little while and I'm doing some LaTeX with it, using Tectonic as the engine. What I was doing to generate the pdf (without leaving the editor) :call system("tectonic main....
1
vote
0answers
205 views

How to map <C-Space> to ESC

I am using nnoremap <C-Space> i inoremap <C-Space> <Esc> to map to Esc. It works for all file with any extension but it doesn't work for the files with ".tex" extension ( I am ...
2
votes
1answer
50 views

Unable to set iskeyword for colon ( : ) character

I am using vim to edit LaTeX files. Throughout the text, there are labels to equations, tables etc. for which an accepted convention among TeX writers is the following \label{eq:massenergy} , \...
0
votes
1answer
300 views

Syntax highlight Markdown formulas using LaTeX highlighting

I often write non-trivial mathematical formulas inside Markdown documents, and having them syntax-highlighted would really help. In Markdown, LaTeX math formulae are denoted: $x^2$ and $$x^2$$, and ...
0
votes
1answer
159 views

Trigger reindentation after snippet has expanded to word in 'indentkeys'

The ftplugin vimtex provides the file indent/tex.vim with following line setlocal indentkeys+=[,(,{,),},],\&,=item,=else,=fi 'indentkeys' 'indk' string (default "0{,0},:,0#,!^F,o,O,e") ...
7
votes
1answer
112 views

Matching interval brackets

I'm using vim to edit LaTeX code, and I'm often writing intervals like (a,b] but this messes with other vim features. For instance, Jumping with %: if I have something like \phi((a,b]), the final ) ...
1
vote
0answers
84 views

macvim does not recognize math latex symbols anymore

I am running Macvim 8.0.1633 (146) on macos 10.13.3 Weirdly, even with syntax on, the math highlighting is plain wrong: Here, I didn't search for end{equation} Does anyone know what is going on?
1
vote
0answers
26 views

Do not wrap certain environments [duplicate]

I am using neovim. When editing a .tex file I don't want to wrap the lines within certain environments like equation or align and some others. \begin{equation} % very long line I don't want to ...
1
vote
1answer
84 views

formatoptions for hybrid (short markup + long paragraphs) content

I am trying to write my PhD thesis in vim using LaTeX So the documents will have two distinct types of content - markups that are relatively short, and paragraph text that is rather long. \begin{...
1
vote
1answer
795 views

Syntax of :endif in if-statements

I have the following code in my vimrc to compile my latex documents with <F5>: map <F5> :write <Bar> :if expand("%") == "body.tex" <bar> :exe ':!arara -v "main.tex"' <cr>...
1
vote
0answers
162 views

vim - latex suite compile and view keys does not work

I'm trying to setup vim-LaTeX on a new pc and I'm having problems with compile and view. ( \ll and \lv commands). When I push \ll I get the following error; Error detected while processing function ...
1
vote
2answers
501 views

Syntax highlighting of underscores in LaTeX, even though they only appear in filenames

I'm using nvim and LaTeX together, and for the most part it's been great. However, nvim appears to be incorrectly highlighting underscores that appear in filenames I include as part of the subfiles ...
0
votes
1answer
338 views

Vimtex commands only working on main file

Hi I am trying out vimtex on a multi-file project, and so far I was liking it a lot. However, I just found out that vimtex commands (\lv, \lt, \li, etc) work correctly when used while editing the main ...
3
votes
2answers
122 views

Replace text and move cursor to end of replacement in insert mode

How can I perform a search-and-replace and leave the cursor at the end of the replacement? I want to replace $...$ with \(...\) as I type in insert mode. Notice that I can't use an abbreviation, ...
2
votes
0answers
51 views

New text object for LaTeX subscript or superscript

Suppose in a latex file, I have a line $X_{i_{j}}$ and $Y^{i_{k}}$ My goal is to define a text object in VIM for the subscript, i.e. _{i_{j}}, and superscript, i.e. ^{i_{k}}. I was reading this ...
5
votes
1answer
227 views

Indentation in Latex within a list after an equation

Here is a minimal .tex file: \begin{document} \begin{itemize} \item Here is an equation: \begin{align*} x = y \end{align*} \item Here is another item ...
2
votes
1answer
53 views

Insert text automatically surrounded by other text

For easy typesetting of song sheets using the leadsheets LaTeX package I want to make a shortcut for vim. Using the leadsheets package, chords are inserted into the lyrics like this: ^{Am7}Sunny So ...
1
vote
0answers
169 views

in-line math equation rendering/preview for macvim/vim for filetypes other than RMarkdown

I recently installed vim-rmarkdown package, and found that the package allows me to see the rendered math equation in macvim, and when move cursor over, the line will render back to latex equation ...
1
vote
1answer
449 views

spacevim remapping of plugin keybindings

I am totally new to using Vim, and I have been trying out SpaceVim so far. One issue is with keybindings. So I have the Vimtex and Vim-Latex plugins installed. I want to use the compilation option ...
1
vote
1answer
702 views

LaTeX: Ultisnips

I'm new to Vim and setting up LaTeX with vimtex. Now, I am looking for a Snippet-Manager and decided to give UltiSnips a try. It seems to be very handy. But it doesn't come with a lot snippets (honza/...
1
vote
1answer
24 views

Fields in templates without resorting to commented-out lists (aka are drop-down options possible?)

I do a lot of work in plain TeX and XeTeX, editing the documents in vim, and have a variety of templates which I use to make the process more efficient. As you might expect, these use quite a lot of ...
2
votes
3answers
166 views

How can I show a preview of my LaTeX buffer without stealing focus from Vim?

I'm using Vim to write LaTeX on my Mac. I could make a shortcut to execute pdflatex (it should be possible right?) and see the result on Preview. But it steals the focus when it updates to the new ...
2
votes
0answers
46 views

LaTeX tabu package breaks Vim spell and syntax highlighting

The first line of this section of LaTeX code breaks syntax highlighting and spell check whenever I scroll to the area of the document that contains it: \begin{tabu} {*3{X[l$]}} col1 & col2 ...
1
vote
1answer
688 views

Using Text Objects with vimtex

I am having trouble figuring out how to use the text objects with the vimtex plugin. The mappings with leaders and the commands in normal and insert mode are fine. But to get environments, sections, ...