Hi all, This patch adds a couple "boundary checks" to the verbatim folding code I contributed earlier. Here's a sample document illustrating what could go wrong: --8<---------------cut here---------------start------------->8--- \documentclass{article} \usepackage{pythontex} \NewDocumentCommand{\pyvm}{ m }{\mbox{\pyv{#1}}} \begin{document} $\pyvm{42}$ \end{document} --8<---------------cut here---------------end--------------->8--- With the previous code, folding would trigger on \pyvm{42} as if it were \pyv with delimiter m. The fix is to require a word boundary in the macro-matching regexp. The other change is a bounds check. I made this change locally a few months ago, and think it was motivated by a parsing error, but unfortunately forgot to save a minimal reproduction. Any feedback welcome. Thanks, best, Paul