I am using
* a language for interactive terminal sessions (like `console` or `psql`)
* `style=bw`
* and the output is tokenized as [Generic.Output](https://pygments.org/docs/tokens/#generic-tokens)
i wanted to make the output tokens from style=bw to appear just like they do in default style, since:
* the output is not differentiated from the CLI in any way in `style=bw`,
* unlike its distinct light grey color in default style.
* this makes it very hard to read.
> If you really want gray comments, you'll have to customize the comment token macro. You'll need something like this in the preamble:
>
> ```
> \makeatletter
> \appto{\minted@patch@PYGZhy}{%
> \def\PYG@tok@c{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.5,0.5,0.5}{##1}}}}
> \makeatother
> ```
>
> _Originally posted by @ gpoore in https://github.com/gpoore/minted/issues/366#issuecomment-1522747851_
Details
So,
i inspected the _minted-* directory of my existing project
I saw these terms at line start of .pygtex files
\PYG{g+gp} for prompt Generic.Prompt, and
\PYG{g+go} before output lines Generic.Output, or
sometimes even this \PYG{l+s+s1} before Bye lol Literal + String + ?
i noticed that \PYGZ*{} is just like x/html character entities, so, gt >, hy -, bs \, sq ' (single quotes)
i created a Minimal working example
actually, it was for asking the question, but it immediately led myself to discover the hack
i inspected the same _minted-* dir of this MWE and
noticed the files bw.pygstyle default.pygstyle *.pygtex
i immediately opened both style files and searched for go and found this following line in default.pygstyle defining the grayscale color (all 3 arguments to color of same value)
I guarded this inside \makeat* and pasted in my preamble. and voilla, it worked :)
I am using * a language for interactive terminal sessions (like `console` or `psql`) * `style=bw` * and the output is tokenized as [Generic.Output](https://pygments.org/docs/tokens/#generic-tokens) i wanted to make the output tokens from style=bw to appear just like they do in default style, since: * the output is not differentiated from the CLI in any way in `style=bw`, * unlike its distinct light grey color in default style. * this makes it very hard to read. > If you really want gray comments, you'll have to customize the comment token macro. You'll need something like this in the preamble: > > ``` > \makeatletter > \appto{\minted@patch@PYGZhy}{% > \def\PYG@tok@c{\let\PYG@it=\textit\def\PYG@tc##1{\textcolor[rgb]{0.5,0.5,0.5}{##1}}}} > \makeatother > ``` > > _Originally posted by @ gpoore in https://github.com/gpoore/minted/issues/366#issuecomment-1522747851_Prelude
Details
So,
_minted-*
directory of my existing project.pygtex
files\PYG{g+gp}
for promptGeneric.Prompt
, and\PYG{g+go}
before output linesGeneric.Output
, or sometimes even this\PYG{l+s+s1}
beforeBye
lolLiteral
+String
+ ?\PYGZ*{}
is just like x/html character entities, so,gt >
,hy -
,bs \
,sq '
(single quotes)_minted-*
dir of this MWE andbw.pygstyle default.pygstyle *.pygtex
go
and found this following line indefault.pygstyle
defining the grayscale color (all 3 arguments to color of same value)\makeat*
and pasted in my preamble. and voilla, it worked :)Cons and Alternates
bw.pygstyle
but it would be very volatile and not very "setup once & forget" methodmakeat
inside the\newmintedfile
's body, but it didn't compilebut anyhow, What better way of doing this would you suggest? 😃
```latex \begin{filecontents}[noheader, overwrite]{./test.mysql} mysql-> select * from firstLine; +--------------------+ | Database | +--------------------+ mysql-> \help contents mysql-> \h contents You asked for help about help category: "Contents" \end{filecontents} \documentclass{article} \usepackage{minted} % \makeatletter % \@namedef{PYG@tok@go}{\def\PYG@tc##1{\textcolor[rgb]{0.44,0.44,0.44}{##1}}} % \makeatother \begin{document} \inputminted[autogobble]{psql}{test.mysql} \inputminted[autogobble, style=bw]{psql}{test.mysql} \end{document} ```MWE source
original screenshotScreenshots
References: