Questions tagged [filetype-tex]
Questions about editing Tex documents, either with or without a frontend such a LaTeX.
111
questions
42
votes
2answers
12k 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 ...
29
votes
4answers
394 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 ...
15
votes
1answer
575 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 ...
12
votes
2answers
2k 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 \...
10
votes
2answers
219 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
=> ...
8
votes
1answer
101 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 ...
7
votes
5answers
5k 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 ...
7
votes
1answer
149 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 ...
7
votes
1answer
129 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 ) ...
6
votes
3answers
267 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, ...
6
votes
1answer
280 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{...
6
votes
2answers
236 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 ...
6
votes
1answer
85 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 ...
6
votes
0answers
87 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, ...
5
votes
1answer
291 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
...
5
votes
2answers
2k 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 ...
5
votes
1answer
192 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 ...
5
votes
2answers
171 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 ...
5
votes
1answer
313 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 ...
5
votes
1answer
133 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 ...
5
votes
2answers
284 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 ...
4
votes
2answers
142 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 ...
4
votes
1answer
239 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 ...
4
votes
0answers
109 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 ...
4
votes
0answers
86 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
│ ...
3
votes
2answers
188 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 ...
3
votes
2answers
162 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.
3
votes
1answer
2k 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 ...
3
votes
2answers
286 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 ...
3
votes
2answers
144 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, ...
3
votes
1answer
25 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 ...
3
votes
1answer
371 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 ...
3
votes
1answer
73 views
Switching back and forth between two text layout conventions of input to LaTeX
While using git and other versioning systems, it is very useful that text lines occupy no more than (say) 80 characters. It is also more comfortable to edit text with vi if lines are note excessively ...
3
votes
1answer
166 views
LaTeX-Box does not define :Latexmk
The LaTeX-Box plugin is supposed to define the command :Latexmk, but it doesn't! Am I missing something obvious?
(The reason I'm trying to run latexmk from vim is that I want to use the quickfix ...
3
votes
1answer
327 views
Underscores don't show up in some colorschemes
Sometimes, when I'm using the torte colorscheme and editing latex files, my latex expressions inside of $ signs show up in yellow. When this happens, my underscores disappear, as the following figure ...
3
votes
1answer
424 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> <...
3
votes
1answer
145 views
Disabling Automatic Latex Plugin (ATP) mappings
I’m trying to use the Automatic LATEX Plugin for Vim (ATP), and found it has quite neat features. However, I do not like input abbreviations, so I tried to disable them using
let g:atp_no_env_maps=1
...
3
votes
0answers
125 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}}
\...
2
votes
3answers
190 views
Compiling whole LaTeX projects
I am looking for a way to easily compile whole latex projects, based in several files through the following set of folders:
.
|- MyProjectsMainFile.tex
|- img/
| |- image1.png
| |- image2.jpg
| `- ...
2
votes
1answer
59 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} , \...
2
votes
1answer
824 views
Folding slow with vimtex
Automatic folding with the vimtex plugin are 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.
2
votes
1answer
367 views
Completion past special characters
When I used vim for programming I used cntrl+n/cntrl+p a lot for keyword completion. I switched from programming to reporting with vim and now I have some new needs, one of which is amazing LaTeX ...
2
votes
2answers
109 views
PDF viewer syncing
The Mac latex editor 'TeXShop' has a great feature -- I can right-click anywhere in my tex and it shows me the corresponding character of the generated PDF. Similarly I can click on PDF and jump to ...
2
votes
1answer
104 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,...
2
votes
3answers
174 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
3answers
4k views
How to Get syntax highlight of LaTeX in Debian's Vim?
I get no syntax highlight now in Debian's Vim by the workflow which works in Ubuntu 16.04: installation of packages and activating syntax
installation apt-get install vim texlive-full
activation in ...
2
votes
1answer
59 views
How do I hide a TeX macro and highlight the arguments?
I have to put a macro in front of Greek text to get correct hyphenation, such that I have, e.g.: possibly \textgreek{κινούμενον} and possibly not. Could I use conceal to conceal the macro and show ...
2
votes
2answers
63 views
Deleting a Latex command multiple times
Indexing a Latex document, I added a lot of \index[]{} commands in \footcite prenotes. It's stupid! Anyway, in my code I have a lot of :
\footcite[blabla blabla\index[n]{something} blabla.][postnote]{...
2
votes
1answer
48 views
Stop Snippet from Triggering Inside Other Snippet
I am using ultisnips with Gilles Castel's subscript snippet along with a snippet I found on SE to create matrices in latex rather quickly. Unfortunately, I can't use the matrices snippet because it ...
2
votes
2answers
987 views
How do I get Vim to correctly highlight Math mode in LaTeX command options?
I adopted the bracket notation, e.g., x[i], for the discrete signal x where i is the time index. The problem occurs in a pgfplots figure but I figured, the syntax highlighting behavior is due to being ...