-
Notifications
You must be signed in to change notification settings - Fork 127
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
Using $ (dollar) as escapeinside symbol #179
Comments
That's a bug. I'm working on a redesigned for |
Thanks for your help. Alas, it does not work either : the $ symbol is not displayed anymore in the typeset code, but the content between $ is typeset as code and not as math mode. Using control sequences causes a compilation failure :
|
I missed that you were trying to escape to math mode. \documentclass{article}
\usepackage[cache=false]{minted}
\setminted{mathescape, escapeinside=||}
\newminted[lstpython]{python3}{}
\begin{document}
\begin{lstpython}
def toto(x) :
# toto $x$
return |$\sqrt{x}$|
\end{lstpython}
\end{document} |
Oh, sorry, I missed this subtlety in the manual. Being able to escape to non-mathmode LaTeX seems nice. Is it also possible regarding comments --- it seems not. The way Pygments manages escapes seems rather cumbersome, if I understand your post there correctly. |
You can use Yes, the current Pygments escaping has issues...if that is ever fixed, it may be possible to have more escape-related features. |
I think I got a (dirty) way to escape to math mode by default. When a piece of text, say xxxx, is escaped, it is translated to a \def\PYGborland@tok@esc{\let\PYGborland@ff=\ensuremath} I assume the ff construct is originally tasked with changing the font face, so it is not entirely inappropriate to subvert it in this fashion. |
Most of the code I typeset contains metasyntactic elements that should be displayed in math-mode.
I have been using listings for several years and am trying to switch to minted. I thus have lots of code that uses
$\whatever$
to escape to math mode.I understand that minted has several kinds of math escaping depending on whether we are in a comment or not. However I could not set it to accept
$
as a math escape character in normal code.I tried
escapeinside=$$
andescapeinside=\$\$
.The languages I use (Python, SQL and Caml) do not use this symbol as a part of their syntax.
The text was updated successfully, but these errors were encountered: