[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ANN: Pygments support for LilyPond

From: Werner LEMBERG
Subject: Re: ANN: Pygments support for LilyPond
Date: Mon, 22 Nov 2021 16:00:08 +0000 (UTC)

>> `@example` is a verbatim environment, too.

Ah, I was misled.  Indeed, macros are expanded within `@example`,
which is good, since it simplifies colour support – you only have to
convince 'pygments' to insert proper `@setcolor` commands before and
after the coloured tokens.

> As far as I understand the texi2html documentation, @verbatim is
> handled a bit differently.  [...]

I can imagine this.  Note that I have no idea how `texi2html` works...

> @example
> @setcolor{0.0 1.0 0.0}
> @end example

Thanks.  Please apply the attached patch to `texinfo.tex` to make
`@setcolor` work in `@example` environments; it is necessary to
temporarily make a space character behave normally.

If my solution is sufficient I will submit it to texinfo upstream.



--- texinfo.tex.good    2021-11-01 17:30:03.008396036 +0100
+++ texinfo.tex 2021-11-22 16:51:50.364723342 +0100
@@ -1239,8 +1239,10 @@
   % Set color, and create a mark which defines \thiscolor accordingly,
   % so that \makeheadline knows which color to restore.
-  \def\setcolor#1{%
-    \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
+  \def\setcolor{\begingroup \spaceisspace \dosetcolor}
+  \def\dosetcolor#1{%
+      \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
+    \endgroup

reply via email to

[Prev in Thread] Current Thread [Next in Thread]