Open ayushxx7 opened 2 years ago
I think vimtex is the one that recognizes math mode, so it is not ultisnips fault. Vimtex recognizes math mode with the use of syntax highlighting, you can see this if you set syntax off
in a .tex file.
The file that I want it to be enabled in has .md
extension.
If vimtex cannot provide syntax highlighting for that particular extension, then your python function is not going to work
The file that I want it to be enabled in has
.md
extension.
did you find a solution? struggling with the same problem rn
The file that I want it to be enabled in has
.md
extension.did you find a solution? struggling with the same problem rn
No, I couldn't get it working. Hence, I came up with a "some-what-decent" workaround.
Say I want to type \epsilon
then I assign the shortcut to eee
which is something I would never write in actual text.. similarly bbb
for \beta
.
Meaning I came up with shortcuts that I don't normally end up writing in text, while also making sure that it's not too hard for me to remember. It works for the most part.
@AndreasHolt
If you want the snippet to work while you are editing a markdown file, add it to your markdown.snippets file or to all.snippets. Additionally, make sure g:markdown_fenced_languages
includes "tex"
(to get syntax highlighting). For example:
let g:markdown_fenced_languages = [tex']
When editing latex in markdown, use this syntax to get the correct syntax highlighting:
```tex
$2+2$ \text{hi}
Your example above works for me with these settings.
I think the OP's code just works perfectly in markdown files (even when the file extension is *.md
) if you use, for example, vim-pandoc. No further configuration was needed for me. FYI, I use https://github.com/vim-pandoc/vim-pandoc-syntax, which has embedded tex (math mode) syntax support.
Hello, I've just fixed the problem with the help of lervag's suggestion here.
The key operation for me is to install the vim-markdown and add the following configuration:
let g:vim_markdown_math = 1
Hope this solution fixes your problem too.
@iChunyu When I implemented the plugin, the default syntax highlighting for markdown through nvim was overwritten. Would you know how to undo this? Otherwise I found the plugin perfect for my use case.
@AadiWaghray Hi. I'm facing the same issue. Syntax highlighting (especially through treesitter
) breaks vimtex#syntax#in_mathzone()
and they seem not compatible by now. For me, I choose to disable the highlighting.
Sorry I can't provide any useful information.
Expected behavior: Ultisnips should recognize $text inside dollar symbols for snippet expansion$ when using context math in markdown file
Actual behavior: It doesn't recognize math context
Steps to reproduce
context "math()" snippet sq "\sqrt{}" iA \sqrt{${1:${VISUAL}}} $0 endsnippet