4

I'm trying to use the minted package with bw style for JavaScript code highlighting. Under the document I added

  \usemintedstyle{bw}

and use highlighting like this:

\begin{minted}[fontfamily=courier, fontsize=\footnotesize]{js}
   window.variable = value;
\end{minted}

However, the word window is still green!? The same happens, if I write new Array(), Array is also green! How can I change this?

edit: full example: I'm compiling it with pdflatex

\documentclass{article}
\usepackage{minted}
\begin{document}
  \usemintedstyle{bw}
  \begin{minted}[fontfamily=courier, fontsize=\footnotesize]{js}
    window.variable = value;
  \end{minted}
\end{document}

Seems like it's depending on the JavaScript Lexer and not the bw.py-style. I tried configuring it and setting each element to black, but the word window is still green! How can I avoid the green words?

SOLUTION:

Could figure it out by myself: I had to change the file bw.py in /Library/Python/2.7/site-packages/Pygments-1.6-py2.7.egg/pygments/styles and add further color specifications, like

Name: "#000000",
Text: "#000000",

as described in http://pygments.org/docs/tokens/ and in http://pbelmans.wordpress.com/2011/03/06/how-to-change-pygments-styles-and-a-university-of-antwerp-style/

  • 2
    Welcome to TeX.SE! And thanks for giving an MWE! – Mensch Oct 1 '14 at 7:34
2

This appears to be a bug in minted (which I currently maintain). The development version treats style definitions in a slightly different way from the last release, and it is working correctly.

My guess is that in the old treatment of styles, style definitions could overlap somewhat in limited circumstances. Since the bw style is more minimalistic, it probably doesn't create all of the macros that some styles do. However, those macros would be created by the default style, and this was causing problems. In the development version, each style has its own completely isolated set of macros, so such conflicts aren't possible.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.