Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with ft=tex #104

Open
mreppen opened this issue Aug 14, 2018 · 11 comments
Open

Not working with ft=tex #104

mreppen opened this issue Aug 14, 2018 · 11 comments

Comments

@mreppen
Copy link

mreppen commented Aug 14, 2018

Describe the bug

In TeX documents, the plugin is not working inside

\begin{document}
...
\end{document

To Reproduce

init.vim/vimrc:

call plug#begin('~/.local/share/nvim/plugged')

Plug 'luochen1990/rainbow'

call plug#end()
set nocompatible

let g:rainbow_active = 1
let g:rainbow_conf = {
\	'separately': {
\		'*': {},
\		'tex': {
\			'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/', 'start=/{/ end=/}/'],
\		},
\   },
\}

Example document:

\documentclass[]{article}

{{{{}}}}
((((((()))))))
[[[[[[]]]]]]
\begin{document}
((((()))))
${{{{}}}}$
{{{{}}}}
[[[[[[]]]]]]
\end{document}

Expected behavior

For the colors to appear equally inside and outside the document environment.

Screenshots

screenshot_20180814_174000

Notes

It works for the same document when changing ft: set ft=text

Related issue?
junegunn/rainbow_parentheses.vim#10

@luochen1990
Copy link
Owner

Is there some special reason which makes you specify separately.tex.parentheses by yourself? Because in the default configuration, {} is not included in separately.tex.parentheses.

@mreppen
Copy link
Author

mreppen commented Aug 15, 2018

The curly braces are the most important to me, but the same problem is there without:

Here is an updated version:
init.vim/vimrc:

call plug#begin('~/.local/share/nvim/plugged')

Plug 'luochen1990/rainbow'

call plug#end()
set nocompatible

let g:rainbow_active = 1

screenshot_20180815_094803

@bisraelsen
Copy link

@mreppen did you ever figure this out? I'm experiencing the same problem.

@mreppen
Copy link
Author

mreppen commented Jan 15, 2019

@bisraelsen
Unfortunately not. My understanding of the deeper workings of vim is too shallow to really try anything useful.

luochen1990 added a commit that referenced this issue Jan 16, 2019
@luochen1990
Copy link
Owner

pushed a fixup, anybody help to make sure it is correct ?

@mreppen
Copy link
Author

mreppen commented Jan 16, 2019

Thanks, that gives a bit more color. However, in the "texMathZone?" regions it does not work:

screenshot_20190116_104207

Running echo join(reverse(map(synstack(line('.'), col('.')), 'synIDattr(v:val,"name")')),' ') gives texMathZoneX texDocZone inside $...$ and texMathZoneW texDocZone in \[...\]. There are apparently also versions with V and Y.

Manually adding these (and possibly other) cases works, but it would be more elegant if the containedin=texDocZone were sufficient. Do you think that is possible?

@luochen1990
Copy link
Owner

I'm not very familiar with tex's syntax, can you provide a list of containedin names along with a test file for what you want? or a pull request?

@bisraelsen
Copy link

I guess that the basic idea is that math equations are contained either within single dollar signs $x=y^{z+2}+(z+0.5)$ or in double dollar signs $$x=y^{z+2}+(z+0.5)$$. There is a third way to enclose math that is shown above: \[ x=y^{z+2}+(z+0.5) \]

Basically anything within $ $, $$ $$, or \[ \] is mathematics and should have matching braces matched. For that matter, even the $ $ and \[ \] enclose things and I guess could also theoretically be colored for matches as well.

@mreppen
Copy link
Author

mreppen commented Jan 28, 2019

I will write a pull request with containedins for all delimiters I find relevant in TeX. It will need some testing on different documents, but I should find time one of the coming days.

@mreppen
Copy link
Author

mreppen commented Feb 11, 2019

There are some cases of curly braces that I cannot make work. For instance, in the case of this figure
screenshot_20190211_154209

It seems like the rainbow zones are not loaded for the first case regardless of what containedin=... I enter.

@luochen1990 Do you have any clue?

@luochen1990
Copy link
Owner

Is there a self-contained example which I can use to reproduce your problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants