[Top][All Lists]

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

Re: ANN: Pygments support for LilyPond

From: Jean Abou Samra
Subject: Re: ANN: Pygments support for LilyPond
Date: Mon, 22 Nov 2021 15:52:13 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1

Le 22/11/2021 à 15:22, Werner LEMBERG a écrit :
However, it would be necessary to define a special version of the
`@verbatim` environment (similar to LaTeX's `minted` environment)
that recognizes color changes.  This is certainly doable and
probably not too difficult, but I currently have other things to
do.  Maybe it's best to open an issue.
Well, we usually use @example rather than @verbatim in the
documentation because it is indented in PDF, and much more nicely
formatted in HTML (see
for an ugly page using @verbatim).
`@example` is a verbatim environment, too.

I don't know. You're the specialist :-)

What I know is that we have this in

# Examples should be formatted similar to quotes:
$Texi2HTML::Config::complex_format_map->{'example'} = {
  'begin' => q{"<blockquote>"},
  'end' => q{"</blockquote>\n"},
  'style' => 'code',

So naturally I tried

diff --git a/Documentation/lilypond-texi2html.init b/Documentation/lilypond-texi2html.init
index 15e57854a6..7b94138999 100644
--- a/Documentation/lilypond-texi2html.init
+++ b/Documentation/lilypond-texi2html.init
@@ -181,6 +181,12 @@ $Texi2HTML::Config::complex_format_map->{'example'} = {
   'style' => 'code',

+$Texi2HTML::Config::complex_format_map->{'verbatim'} = {
+  'begin' => q{"<blockquote>"},
+  'end' => q{"</blockquote>\n"},
+  'style' => 'code',
+ };
 %Texi2HTML::config::misc_pages_targets = (
    'Overview' => 'Overview',
    'Contents' => 'Contents',

I doesn't work. As far as I understand the texi2html
documentation, @verbatim is handled a bit differently.
I haven't yet had the time to learn enough of Perl
to understand how to make @verbatim indented inside
a box (with <blockquote>) similarly to @example.

However, trying to use @setcolor or @pdfsetcolor in @example, I fail
to get it to work: using TeX, the color command outright wipes
everything following it in the document, and using XeTeX (with
PDFTEX=xetex texi2pdf ...) it doesn't wipe but doesn't show any
effect either.
Example, please.

Here you go:

\input texinfo

AAA@setcolor{1.0 0.0 0.0}BBB

@setcolor{0.0 1.0 0.0}
@end example

Continued text...


PDFTEX=pdftex texi2pdf file.texi

I get the attached with-pdftex.pdf. Now I see that Firefox
renders it as I would expect it, the color changes to
green at the point of @setcolor in @example. However,
both Evince and Xournal don't show any text after that
point. If I change the command to

PDFTEX=xetex texi2pdf file.texi

I get with-xetex.pdf, which none of the viewers manages
to render at all. If I change @setcolor{0.0 1.0 0.0}
(green) to @setcolor{0.0 0.0 0.0} (black), giving
example input

\input texinfo

AAA@setcolor{1.0 0.0 0.0}BBB

@setcolor{0.0 0.0 0.0}
@end example

Continued text...

and command

PDFTEX=pdftex texi2pdf file.texi

and output third-test.pdf, then Evince and Xournal render
it but stop showing anything after the problematic @setcolor,
while Firefox does render it in a way that seems correct.

In short: weird stuff is going on and I have no idea
how to implement the support reliably.

By the way:

$ texi2pdf --version
texi2pdf (GNU Texinfo 6.7)


Attachment: with-pdftex.pdf
Description: Adobe PDF document

Attachment: with-xetex.pdf
Description: Adobe PDF document

Attachment: third-test.pdf
Description: Adobe PDF document

reply via email to

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