bug-texinfo
[Top][All Lists]
Advanced

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

generic color support for `texinfo.tex`


From: Werner LEMBERG
Subject: generic color support for `texinfo.tex`
Date: Wed, 24 Nov 2021 15:17:22 +0000 (UTC)

Hello Gavin,


For the LilyPond documentation we are going to use `pygments` to do
automatic colour highlighting of LilyPond snippets.  We also want to
support this feature in the PDF manuals.  To do so I ask you to apply
something like the following patch to make `@setcolor` work in
`@example` environments, too.

It would be nice to have `@setcolor` as an 'official' command that
also works with other output formats (for info, this would probably be
a no-op), but we can live without that since we let `pygments`
directly manipulate the HTML output.


    Werner


======================================================================


--- texinfo.tex.orig    2021-11-01 17:30:03.008396036 +0100
+++ texinfo.tex 2021-11-24 14:33:27.437682335 +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
     \domark
     \pdfsetcolor{#1}%
   }
@@ -1631,8 +1633,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
     \domark
     \pdfsetcolor{#1}%
   }



reply via email to

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