-
Notifications
You must be signed in to change notification settings - Fork 407
Syntax highlighting issue when using custom environments that should print verbatim #2789
Description
Description
I am using minted in LaTex to provide syntax highlighting to text inside the code block below. The language I am trying to highlight has functions of the form $function_name. The issue here is that $ by itself is considered the beginning of a mathematical expression. As a result, everything else that follows is considered part of the mathematical expression until a closing $ is found, which could be at the end of the document. In short, I lose proper syntax highlighting within vim and this messes up all my snippets since they are context-specific.
\begin{verilog}{}
$strobe("Average period = %g measured from %d periods.", period, total);
\end{verilog}
One half-solution is to augment a \ before every $ sign. However, because minted prints out verbatim, the \ also gets printed, which is not supposed to.
I've noticed that vimtex does recognize some specific environments like minted and and highlights the block accordingly. How can we make our custom environments behave in the same way?
Steps to reproduce
Use an environment with a custom name:
\begin{verilog}{}
$strobe("Average period = %g measured from %d periods.", period, total);
\end{verilog}
Expected behavior
The content of the environment should be considered verbatim, not LaTex code.
Actual behavior
The content is considered LaTex code.
Do you use a latexmkrc file?
No
VimtexInfo
System info:
OS: Manjaro Linux
Vim version: NVIM v0.9.1
Has clientserver: true
Servername: /run/user/1000/nvim.346500.0
VimTeX project: verilog-a
base: verilog-a.tex
root: /home/medwatt/Writing/LatexDocuments/beamer/verilog-a
tex: /home/medwatt/Writing/LatexDocuments/beamer/verilog-a/verilog-a.tex
main parser: current file verified
document class: beamer
packages: amsbsy amsfonts amsgen amsmath amsopn amssymb amstext amsthm atbegshi atbegshi-ltx atveryend atveryend-ltx auxhook beamerbaseauxtemplates beamerbaseboxes beamerbasecolor beamerbasecompatibility beamerbasedecode beamerbasefont beamerbaseframe beamerbaseframecomponents beamerbaseframesize beamerbaselocalstructure beamerbasemisc beamerbasemodes beamerbasenavigation beamerbasenotes beamerbaseoptions beamerbaseoverlay beamerbaserequires beamerbasesection beamerbasetemplates beamerbasethemes beamerbasetheorems beamerbasetitle beamerbasetoc beamerbasetranslator beamerbasetwoscreens beamerbaseverbatim beamercolorthemedefault beamercolorthemeorchid beamercolorthemewhale beamerfontthemedefault beamerinnerthemedefault beamerinnerthemerounded beamerouterthemedefault beamerouterthemeinfolines beamerthemeMadrid beamerthemedefault bigintcalc bitset calc catchfile enumerate enumitem environ etexcmds etoolbox expl3 fancyvrb float fontenc fontspec fontspec-xetex framed fvextra geometry gettitlestring graphics graphicx hycolor hyperref ifluatex ifplatform iftex ifthen ifvtex infwarerr intcalc keyval kvdefinekeys kvoptions kvsetkeys letltxmacro lineno listings lstmisc ltxcmds minted nameref pdfcol pdfescape pdftexcmds pgf pgfcomp-version-0-65 pgfcomp-version-1-18 pgfcore pgffor pgfkeys pgfmath pgfrcs pgfsys refcount rerunfilecheck shellesc stringenc tcolorbox textcomp tikz tikzfill-common tikzfill.image translator trig trimspaces uniquecounter upquote url verbatim xcolor xparse xstring xxcolor
source files:
verilog-a.tex
settings/packages.tex
settings/macros.tex
compiler: latexmk
engine: -xelatex
options:
-xelatex
-verbose
-shell-escape
-file-line-error
-synctex=1
-interaction=nonstopmode
callback: 1
continuous: 1
executable: latexmk
viewer: Zathura
xwin id: 0
qf method: LaTeX logfile