[Top][All Lists]

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

Lilypond and texinfo

From: Alfred M\. Szmidt
Subject: Lilypond and texinfo
Date: Wed, 26 Nov 2008 01:01:43 +0100


Lilypond and texinfo can play along together, but only when generating
HTML, PDF or PNG output.  But, makeinfo can also generate info files
that contain references to pictures, which would allow Info readers
(e.g. Emacs info) to display Lilypond output.

The image syntax for info is describe in the texinfo documentation,
under the chapter `Image Syntax'; I attached the whole chapter at the
end of this message for reference.

Currently, the image files lilypond-book generates when doing
`lilypond-book foo.texi' are just .eps files but no .png files.  Would
it be possible to `lilypond-book foo.texi' to produce .png files as
well, and not only .eps?

The .html that seems to be generated is also wrong, since no .png file
exists, but this is what is written in the generated .teci file (not
the reference to `lily-f9b9bdd5a9.png' which was never created by

| @ifinfo
| @image{lily-f9b9bdd5a9,,,[image of music],}
| @end ifinfo
| @html
| <p>
|  <a href="lily-f9b9bdd5a9.ly">
|   <img align="center" valign="center"
|     border="0" src="lily-f9b9bdd5a9.png" alt="[image of music]">
|  </a>
| </p>
| @end html

| @iftex
| @include lily-f9b9bdd5a9-systems.texi
| @end iftex

I attached my input file (see end of message),  and here is the output of my 

~/t/test $ lilypond-book --output foo foo.texi
lilypond-book (GNU LilyPond) 2.10.33
Reading foo.texi...
Writing snippets...
Running lilypond...GNU LilyPond 2.10.33
Processing `snippet-map.ly'
Processing `foo.texi'
Interpreting music... [2]
Preprocessing graphical objects...
Calculating line breaks... 
Drawing systems... 
Writing lily-f9b9bdd5a9-systems.tex...
Writing lily-f9b9bdd5a9-systems.texi...
Layout output to `lily-f9b9bdd5a9-1.eps'...
Layout output to `lily-f9b9bdd5a9.eps'...

Compiling foo.texi...
Writing `foo.texi'...
lilypond-book: warning: option --psfonts not used
lilypond-book: warning: processing with dvips will have no fonts
~/t/test $ find
~/t/test $ 

>From (texinfo) Image Syntax:

12.2.1 Image Syntax

Here is the basic synopsis of the address@hidden' command:


  The FILENAME argument is mandatory, and must not have an extension,
because the different processors support different formats:

   * TeX reads the file `FILENAME.eps' (Encapsulated PostScript format).

   * pdfTeX reads `FILENAME.png', `FILENAME.jpg', `FILENAME.jpeg', or
     `FILENAME.pdf' (in that order).  The PDF format cannot support EPS
     images, so they must be converted first.

   * `makeinfo' includes `FILENAME.txt' verbatim for Info output (more
     or less as if it was an address@hidden').

   * `makeinfo' uses the optional fifth argument EXTENSION to address@hidden'
     for the filename extension, if it is specified.  For example:


     will cause `makeinfo' to look for `foo.xpm' before any others.

  The WIDTH and HEIGHT arguments are described in the next section.

  For TeX output, if an image is the first thing in a paragraph, for
example if you want two images side-by-side, you must precede it with
address@hidden' (*note address@hidden': noindent.).  Otherwise it will be
displayed on a line by itself, left-justified.  If you want it
centered, use address@hidden' (*note address@hidden @center @sp': titlefont
center sp.).

  For HTML output, `makeinfo' sets the "alt attribute" for inline
images to the optional ALTTEXT (fourth) argument to address@hidden', if
supplied.  If not supplied, `makeinfo' uses the full file name of the
image being displayed.  The ALTTEXT is taken as Texinfo text, so
special characters such as `"' and `<' and `&' are escaped in the HTML
and XML output; also, you can get an empty `alt' string with address@hidden' (a
command that produces no output; *note - and hyphenation::).

  For Info output, the `alt' string is also processed as Texinfo text
and output.  In this case, `\' is escaped as `\\' and `"' as `\"'; no
other escapes are done.

  If you do not supply the optional EXTENSION (fifth) argument,
`makeinfo' first tries `FILENAME.png'; if that does not exist, it tries
`FILENAME.jpg'.  If that does not exist either, it complains.

  In Info output, `makeinfo' writes a reference to the binary image
file (trying FILENAME suffixed with `EXTENSION', `.EXTENSION', `.png',
or `.jpg', in that order) if one exists.  It also literally includes
the `.txt' file if one exists.  This way, Info readers which can
display images (such as the Emacs Info browser, running under X) can do
so, whereas Info readers which can only use text (such as the
standalone Info reader) can display the textual version.

  The implementation of this is to put the following construct into the
Info output:

     address@hidden src="BINARYFILE" text="TXTFILE"
                alt="ALTTEXT ... address@hidden

where `^@' and `^H' stand for the actual null and backspace control
characters.  If one of the files is not present, the corresponding
argument is omitted.

  The reason for mentioning this here is that older Info browsers (this
feature was introduced in Texinfo version 4.6) will display the above
literally, which, although not pretty, should not be harmful.

===File ~/t/test/foo.texi===================================
\input texinfo                  @c -*-texinfo-*-
@c %**start of header
@setfilename test.info
@settitle Test
@paragraphindent 0
@c %**end of header

@node Top

* Other file: (foo).  Test
@end menu

c' d' e' f' g'2 g
@end lilypond


reply via email to

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