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


I share my latex documents with other collaborators that frequently use these new commands, so I cannot unilaterally decide to drop the use of these new commands in favor of another feature (e.g) ultisnips. Is there any way I can make the conceal feature recognize these new commands as a math environment?

  • 1
    FYI, concealment is defined in vim syntax files. vimtex only extends the syntax file in $VIMRUNTIME and does not provide an alternative syntax file. This means concealment works without vimtex. vimtex only adds a few definitions for environments of amsmath. – Hotschke Jul 9 '19 at 15:59
  • 2
    Personal note: I would not use these commands in any of my documents and would strongly ask my collaborators to stick to default LaTeX with amsmath. They can use personal redefinitions in their documents and should not impose them on other people. I think this is impolite. Sorry that you are in this position. BTW What about search and replace to remove them when you get the document? I also think syntax highlighting in any latex editor will not work correctly when using these definitions. – Hotschke Jul 9 '19 at 16:01
  • @Hotschke gave best answer: such (ab)use of syntax is highly problematic as it breaks functionalities of any advanced editors. And it makes the file harder to read, thus to edit, thus to collaborate. It is probably easiest to search and replace if your collaborators refuse to change that. Before editing a file, run sed -i 's/beq/begin{equation}/g;s/eeq/end{equation}/g' filename.tex; after editing a file, run sed -i 's/begin{equation}/beq/g;s/end{equation}/eeq/g' filename.tex. Create scripts for faster workflow, or convert to a vim command if wished. – Piotr Apr 28 at 8:49
  • Also, you can make the change unilaterally, in a way: if you don't require them to use your syntax but they allow you to use the standard syntax and to change their syntax to the standard one, they probably won't mind. Their goal is to reduce their typing, and they will still achieve that. Your goal is to have usable and clean code, and you'll achieve that. – Piotr Apr 28 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.