Skip to main content

Questions tagged [filetype-tex]

For questions on editing TeX documents, either with or without a frontend such as LaTeX.

Filter by
Sorted by
Tagged with
55 votes
2 answers
20k views

What are the differences between LaTeX plugins?

There are a number of Tex plugins for vim (vim-latex, AutomaticLatexPlugin to say a couple). What are the differences in the provided functionalities between these (the ones I named and possibly ...
glS's user avatar
  • 3,919
33 votes
5 answers
648 views

How can I treat LaTeX quotes as a text object?

Quotation marks in LaTeX are different than in normal text, in that they're formatted ``like this'' (or `like this' for single quotes). This makes it difficult to navigate through them in Vim. I ...
Doorknob's user avatar
  • 15.4k
16 votes
6 answers
24k views

How do I get Vim to compile my .tex file when executing :w?

My writing routine is like this: I edit a .tex file using vim I go to the command line and I compile it using pdflatex. I find myself always saving the file with :w and immediately having to switch ...
PhoenixPerson's user avatar
16 votes
2 answers
1k views

Inline English grammar checker for vim-latex?

I am looking for English grammar checker for vim-latex suite that checks the grammar as I type but does not highlight what's inside $$ or \begin{equation} & \end{equation} commands. Is there any ...
Tom's user avatar
  • 379
14 votes
2 answers
3k views

How can I lookup LaTeX symbols in Vim?

Can I integrate some form of symbol completion to Vim? Dedicated TeX editors like TeXMaker provide a list of symbols for completion (for example, \al shows a list with \alpha, \la shows \lambda and \...
muru's user avatar
  • 25k
12 votes
2 answers
2k 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,...
gerrit's user avatar
  • 223
10 votes
2 answers
336 views

Context sensitive insert mode mapping or abbreviation

I'm planning to implement some utility mappings for my LaTeX plugin to simplify typing of mathematics. For instance, I want to create abbreviations similar to `a : \alpha `b : \beta -> : \to => ...
Karl Yngve Lervåg's user avatar
8 votes
2 answers
4k views

How can I fix the auto indentation in LaTeX?

Vim has some fancy pants indentation stuff. When it works right it's a pleasure to have, but sometimes it just drives me nuts. One that I've never been able to solve has to do with LaTeX syntax. Lets ...
Caleb's user avatar
  • 2,245
8 votes
1 answer
146 views

change meaning of "paragraph" for TeX input?

I'm writing LaTeX code which has a lot of sections like this \begin{definition} blah blah blah ... ... \end{definition} In normal text, I'm very fond of gq] to rewrap everything nicely. Inside a ...
user avatar
8 votes
0 answers
126 views

Count only words for which Spell is enabled?

I want to count the words in my buffers, but for TeX files, for instance, a lot of words (e.g., commands) shouldn't be counted. I'm aware that there are scripts that do this specifically for LaTeX, ...
dbmrq's user avatar
  • 857
7 votes
1 answer
5k views

Filetype that LaTeX should be

From :help filetype: If the first line of a *.tex file has the form %&<format> then this determined the file type: plaintex (for plain TeX), context (for ConTeXt), or tex (for ...
baxx's user avatar
  • 1,035
7 votes
3 answers
750 views

Make % jump between identical delimiters

I use Vim to edit LaTeX files frequently. I want to use % to jump between matching $ which can be used to delimit where mathematical expressions are written. I have tried using matchit and, ...
fuzzybear3965's user avatar
7 votes
1 answer
1k views

Why does Vim highlight "in" in tex files and how can I stop it?

I write a lot of LaTeX. In plain text mode, sequences like 123 in are highlighted in red. That is a space, a digit string, a space, and then the specific word in. Such things as a1 in are not ...
Bruce's user avatar
  • 205
7 votes
1 answer
845 views

How can I make quick environment or command changes in LaTeX

I have a large body of LaTeX text (a whole book) which has \textit{} and \textbf{} commands interchanged in some places. In other places they are completely missing. How do I create quick shortcuts in ...
Ketan's user avatar
  • 265
7 votes
1 answer
502 views

Turn off Vim spellcheck in custom region

I have the following definitions in a .tex file preamble: \newcommand{\beq}{\begin{eqnarray}} \newcommand{\eeq}{\end{eqnarray}} If I then use \beq and \eeq to define an equation array region, spell ...
Ben Lindsay's user avatar
7 votes
2 answers
496 views

iskeyword for latex

Context Currently, when I set ft=tex, my set isk? reads iskeyword=@,48-57,_,192-255 that is, the default for vim. My "issue" Currently, in a LaTeX string such as $\abcde_\fgh$ the w jump would ...
marsupilam's user avatar
7 votes
1 answer
300 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 ) ...
B. Mehta's user avatar
  • 201
6 votes
1 answer
364 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} , \...
Dr Krishnakumar Gopalakrishnan's user avatar
6 votes
1 answer
490 views

How do I spellcheck TeX files using vim-lexical, skipping some command arguments but not others?

I use the vimtex plugin for TeX editing and vim-lexical for spell-checking. This works generally fine, but there are several commands vim-lexical tries to spellcheck. For example, in \includepdf{...
Jonas's user avatar
  • 243
6 votes
2 answers
747 views

Fix syntax highlighting after unmatched parentheses

I have a parenthesis in my LaTeX document that is intentionally unmatched. This breaks syntax highlighting for all of the following text. Is there some way to reset syntax highlighting after this ...
walkie's user avatar
  • 163
6 votes
1 answer
318 views

Mathematical expressions in TeX files are displayed in a human-readable way

When I type some mathematical expressions in Tex files using Vim, e.g. a_{2} = a_{1} + a_{0}, it is displayed in a human readable way like a2 = a1 + a0. (Actually the numbers are of a smaller font, ...
hitochan's user avatar
  • 215
6 votes
1 answer
768 views

Insert a newline after punctuations

I'm writing a report in LaTeX that I keep in a Git repository. In order to make the most out of Git, I would like to keep each sentence on its own line. I.e. for each dot, exclamation mark and ...
lklun's user avatar
  • 63
6 votes
1 answer
138 views

Autoformatting LaTeX: how to add characters in front of a wrapped line

When writing LaTeX, I like a newline between every sentence as it helps me jump around more easily. Additionally, I put two spaces at the start of lines where sentences don't start. For example: This ...
Espressofa's user avatar
5 votes
2 answers
1k views

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

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 ...
danilofreire's user avatar
5 votes
2 answers
2k 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 ...
Paul Roever's user avatar
5 votes
1 answer
2k views

Folding slow with vimtex

Automatic folding with the vimtex plugin is unbearably slow. Is there anything I can do to speed this up? I tried installing the fastfold plugin but that did nothing I could notice.
Toothrot's user avatar
  • 3,139
5 votes
5 answers
1k views

Delete text between two $ symbols in gvim

I understand that we can use da{ to delete a whole {} block in vim. I am wondering if there is a corresponding version with { replaced by $ (similarly for di{) as this would be very useful for people ...
weirdo's user avatar
  • 153
5 votes
1 answer
1k views

TeX/LaTeX vim fold markers options

In complex files, especially when writing packages with basic TeX-LaTeX code, the standard definition of foldmarker, namely {{{,}}}, is unfortunate — in effect is quite common to have pieces of code ...
Rmano's user avatar
  • 758
5 votes
1 answer
883 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 ...
evencoil's user avatar
  • 245
5 votes
2 answers
189 views

Remove eqnarray from Vim LaTeX

The Vim LaTeX-suite includes a number of predefined LaTeX environments, including the obsolete¹ eqnarray and eqnarray* environments. I want to get rid of every last shadow of these environments in the ...
Earthliŋ's user avatar
  • 313
5 votes
1 answer
620 views

Make autoformating insert a line break instead of two spaces after full stop

I noticed that vi's auto format adds two spaces after a full stop. I wonder how this can be changed, i.e., insert just one space after a full stop, or even a line break. The application is in using a ...
Yossi Gil's user avatar
  • 755
5 votes
1 answer
214 views

Text formatting CVS-friendly

I have seen this very interesting article: http://dustycloud.org/blog/vcs-friendly-patchable-document-line-wrapping/ --- basically it is a suggestion for hard-breaking lines of text (for example, in ...
Rmano's user avatar
  • 758
5 votes
0 answers
513 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}} \...
Tatl-Tael's user avatar
5 votes
0 answers
203 views

How to align a Latex table that uses \multicolumn?

I want to align a Latex table the way it appears in the final document. There are various Vim plugins for aligning tables (2, 3, 4), but none of them handle the spanning cell correctly. The code ...
Nova's user avatar
  • 151
5 votes
0 answers
116 views

Latex plugin for Vim that supports files organized in multiple directories

I have a multiple file/folder project that looks like the following. ├── 0_Preamble │   ├── 01_TitlePage.tex │   ├── 02_TitleBack.tex │   ├── 03_Dedication.tex │   ├── 0_Preamble.tex ├── 1_Theory │  ...
tomasyany's user avatar
  • 444
4 votes
2 answers
260 views

Use search matches as parameters in external command

I want to define a Vim command that will install all LaTeX packages used in a .tex file. To install packages I can do sudo tlmgr install package1 package2 package3 etc. in the command line. So now I ...
dbmrq's user avatar
  • 857
4 votes
1 answer
226 views

How is filetype tex and plaintex set in vanilla Vim?

I noticed that when I create a .tex from within Vim itself, in a later session that file is detected as plaintex, while already existing files are detected with the tex filetype (note: both of them ...
mEm's user avatar
  • 155
4 votes
2 answers
2k 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/...
Theova's user avatar
  • 53
4 votes
1 answer
295 views

How to turn off auto indenting while editing a LaTeX file?

I edit a LaTeX file, and for some commands Vim does auto indenting. I would like to switch it off. Consulting: https://www.serverwatch.com/guides/automatic-indenting-vim/ I tried: :filetype indent off ...
Gergely's user avatar
  • 293
4 votes
2 answers
211 views

Apply formating with a script, or have ftplugin format particular text based on syntax

When I am writting a Latex document I generally like to keep an 80 column line width to keep things easy to read. However I don't like to use text wrapping because it can get in the way of typing ...
Ajay's user avatar
  • 219
4 votes
1 answer
229 views

LaTeX dollar signs confuse syntax highlighting

I am editing LaTeX code such as: \documentclass{article} \usepackage{booktabs,tabularx} \begin{document} Blah blah Blah blah \begin{table}\centering \begin{tabular}{>{$}l<{$}p{4in}} %...
user2153235's user avatar
4 votes
2 answers
2k 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 ...
Jason Zamel's user avatar
4 votes
1 answer
661 views

Syntax highlighting for custom LaTeX commands

I have a few custom LaTeX commands like this one, for instance: \newcommand{\oeuvre}[1]{\textit{#1}} I use this for titles of books and other works. Sometimes I want them to be italicized, sometimes ...
dbmrq's user avatar
  • 857
4 votes
1 answer
568 views

Check if current line ends in a comment

I added something like this to my tex.vim ftplugin (I tried to simplify it because there are other plugins involved, but hopefully it makes sense): set comments+=b:\\item inoremap <expr> <...
dbmrq's user avatar
  • 857
4 votes
0 answers
694 views

How to control and filter warnings in vim-latex?

While vim-latex is great, I've been having a bit of trouble using some of its features. Controlling the warning system (and hotfix window) has been particularly difficult for me. Today I'm trying to ...
Clay Thomas's user avatar
4 votes
0 answers
54 views

More intelligent automatic formatting

I use vim to edit latex files and the automatic formatting option (formatoptions+=a) works very well, since you can enter text anywhere in the paragraph and vim will reformat the entire paragraph. The ...
Frostbitten's user avatar
4 votes
0 answers
170 views

How does expression folding actually work?

The following is a stripped down version of my folding function for LaTeX documents: setlocal foldmethod=expr setlocal foldexpr=LaTeXFoldsExpr(v:lnum) " Sections to be folded let g:...
noibe's user avatar
  • 189
3 votes
2 answers
410 views

Call PDF viewer on the compiled tex file

Suppose I am editing a file.tex. How would I open file.pdf in zathura (or any pdf viewer) from vim? I understand how to reference file.tex using '%' but I'm not sure how to reference file.pdf.
Kevin's user avatar
  • 33
3 votes
3 answers
91 views

How to insert LaTeX commands and matching braces repeatedly?

I sometimes have to insert again and again commands such as: \onslide<->{ SOME TEXT } when I create beamer presentations and I wonder if the vim-surround plugin could facilitate (a lot!) the ...
user22744's user avatar
3 votes
1 answer
150 views

Why is my # mapping behaving oddly in TeX files?

I recently made the following key-map in my .vimrc file: inoremap # \ inoremap \ # since I just want to switch those two key on my keyboard, everything works just fine until I notice this: Only in ....
Yuanhao JIANG's user avatar

1
2 3 4 5