2

Is there any way to conditionally highlight syntaxes in minted?

I have the same name for an argument of a function as well as a function itself, messing up the syntax highlighting pretty badly.

A workaround is to differentiate between <function> = and <function>( in their totalities, but this would apply the colour to the equals sign and brace respectively, leading to a pretty ugly output.

Is it possible to still only colour the <function> part, using the equals to sign (=) or brace ()) only as a delimiter, but keeping the colour scheme (for these signs) intact?

1010011010
  • 6,357
  • minted relies on Pygments lexers, which are written in Python. I'm not sure (because you don't specify which minted language you're using) but I'd be tempted to say that the answer is no. However, even if that's not possible with minted, it should be possible with listings. – jub0bs May 22 '14 at 20:49
  • 1
    related: http://tex.stackexchange.com/questions/153819/how-to-embed-special-markers-into-the-code-listing-that-will-mark-certain-parts/153828#153828 – jub0bs May 22 '14 at 20:56
  • Elegant solution, I'm already using listings as compatibility alternative to minted (printing everything in minted takes around a minute and I'm running a serious PC here), but listings doesn't handle functions with dots inside them very well like file.choose or read.table. Heh, everything has pros and cons. – 1010011010 May 22 '14 at 21:02
  • Whatever output you want to produce is likely feasible with listings. You should edit your question to add a MWE and specify exactly what you want to achieve. About minted being slow, note that the new maintainer is working on making it way faster. – jub0bs May 22 '14 at 21:15
  • Without additional details (e.g. the Pygments lexer used or some compilable code), I think that this question remains unclear. – jub0bs May 23 '14 at 15:15

0 Answers0