Home Explore Blog CI



neovim

42th chunk of `runtime/doc/syntax.txt`
b6a61666132ee2771d691b9044663220e8b586e72ca0eafe0000000100000fa1
 allow superscript/subscript regions
    S : allow texStyle syntax
    v : allow verbatim syntax
    V : allow texNewEnv and texNewCmd syntax
<
As an example, let g:tex_fast= "M" will allow math-associated highlighting
but suppress all the other region-based syntax highlighting.
(also see: |g:tex_conceal| and |tex-supersub|)

					*tex-morecommands* *tex-package*
 Tex: Want To Highlight More Commands? ~

LaTeX is a programmable language, and so there are thousands of packages full
of specialized LaTeX commands, syntax, and fonts.  If you're using such a
package you'll often wish that the distributed syntax/tex.vim would support
it.  However, clearly this is impractical.  So please consider using the
techniques in |mysyntaxfile-add| to extend or modify the highlighting provided
by syntax/tex.vim.

I've included some support for various popular packages on my website: >

	https://www.drchip.org/astronaut/vim/index.html#LATEXPKGS
<
The syntax files there go into your .../after/syntax/tex/ directory.

					*tex-error* *g:tex_no_error*
 Tex: Excessive Error Highlighting? ~

The <tex.vim> supports lexical error checking of various sorts.  Thus,
although the error checking is ofttimes very useful, it can indicate
errors where none actually are.  If this proves to be a problem for you,
you may put in your vimrc the following statement: >
	let g:tex_no_error=1
and all error checking by <syntax/tex.vim> will be suppressed.

								*tex-math*
 Tex: Need a new Math Group? ~

If you want to include a new math group in your LaTeX, the following
code shows you an example as to how you might do so: >
	call TexNewMathZone(sfx,mathzone,starform)
You'll want to provide the new math group with a unique suffix
(currently, A-L and V-Z are taken by <syntax/tex.vim> itself).
As an example, consider how eqnarray is set up by <syntax/tex.vim>: >
	call TexNewMathZone("D","eqnarray",1)
You'll need to change "mathzone" to the name of your new math group,
and then to the call to it in .vim/after/syntax/tex.vim.
The "starform" variable, if true, implies that your new math group
has a starred form (ie. eqnarray*).

					*tex-style* *b:tex_stylish*
 Tex: Starting a New Style? ~

One may use "\makeatletter" in `*.tex` files, thereby making the use of "@" in
commands available.  However, since the `*.tex` file doesn't have one of the
following suffices: sty cls clo dtx ltx, the syntax highlighting will flag
such use of @ as an error.  To solve this: >

	:let b:tex_stylish = 1
	:set ft=tex

Putting "let g:tex_stylish=1" into your vimrc will make <syntax/tex.vim>
always accept such use of @.

					*tex-cchar* *tex-cole* *tex-conceal*
 Tex: Taking Advantage of Conceal Mode~

If you have |'conceallevel'| set to 2 and if your encoding is utf-8, then a
number of character sequences can be translated into appropriate utf-8 glyphs,
including various accented characters, Greek characters in MathZones, and
superscripts and subscripts in MathZones.  Not all characters can be made into
superscripts or subscripts; the constraint is due to what utf-8 supports.
In fact, only a few characters are supported as subscripts.

One way to use this is to have vertically split windows (see |CTRL-W_v|); one
with |'conceallevel'| at 0 and the other at 2; and both using |'scrollbind'|.

					*g:tex_conceal*
 Tex: Selective Conceal Mode~

You may selectively use conceal mode by setting g:tex_conceal in your
vimrc.  By default, g:tex_conceal is set to "admgs" to enable concealment
for the following sets of characters: >

	a = accents/ligatures
	b = bold and italic
	d = delimiters
	m = math symbols
	g = Greek
	s = superscripts/subscripts
<
By leaving one or more of these out, the associated conceal-character
substitution will not be made.

						*g:tex_isk* *g:tex_stylish*
 Tex: Controlling iskeyword~

Normally, LaTeX keywords support 0-9, a-z, A-z, and 192-255 only. Latex
keywords don't support the underscore - except when in `*.sty` files.  The
syntax highlighting script handles this with

Title: TEX Syntax: Highlighting Extensions, Error Handling, Math Groups, Conceal Mode, and Keyword Control
Summary
This section details advanced customization options for TEX syntax highlighting in Vim. It explains how to add highlighting for commands from custom LaTeX packages, suppress excessive error highlighting, define new math groups, enable conceal mode for character substitutions (like accents and Greek letters), and control which characters are considered keywords for syntax highlighting.