-
Notifications
You must be signed in to change notification settings - Fork 395
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
Syntax highlighting issue when using custom environments that should print verbatim #2789
Comments
Can you provide a full (minimal) example; one that I can compile on my end?
It's easier to answer when I fully understand what you are doing, cf. my above question. |
\documentclass{article}
\usepackage[most, minted]{tcolorbox}
\usepackage{minted}
\setminted{
autogobble=true,
breaklines,
fontsize=\small,
}
\newtcblisting{verilog}[2][]{%
listing engine=minted,
minted language=verilog,
listing only,
breakable,
enhanced,
colframe=gray!75,
title=#2,
coltitle=black,
colbacktitle=gray!50,
fonttitle=\bfseries,
top=0.5mm,
bottom=0.5mm,
% left=0mm,
right=0mm,
boxsep=0.5mm,
minted options = {
linenos,
breaklines=true,
breakbefore=.,
numbersep=2mm,
},
overlay={%
\begin{tcbclipinterior}
\fill[gray!25] (frame.south west) rectangle ([xshift=4mm]frame.north west);
\end{tcbclipinterior}
},
#1
}
\begin{document}
This is the first line.
\begin{verilog}{}
$strobe("Average period = %g measured from %d periods.", period, total);
\end{verilog}
This line will be highlighted as part of a mathematical expression.
\end{document} |
The |
Thanks. I wonder if I could ask you to add support for For example: \newcommand{\mi}[1]{\mintinline{verilog}{#1}} |
There is already support for |
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.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:
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
The text was updated successfully, but these errors were encountered: