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?

closed as unclear what you're asking by jub0bs, Fran, user31729, Thomas F. Sturm, Mico May 23 '14 at 16:00

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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: tex.stackexchange.com/questions/153819/… – 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

Browse other questions tagged or ask your own question.