Aaargh! It still doesn't work right; I should have tested with more than one LilyPond snippet. \lily!figures is the "image" counter; if I use it in the definition of the command, it stays 1. If I use it like below, I get "! Use of \LP doesn't match its definition." --- code --- \def\LP#1{texmfstart --exec bin:lilypond -b eps -dno-gs-load-fonts - dinclude-eps-fonts \bufferprefix lilypond-#1.tmp} \def\PDF#1{texmfstart --ifchanged=\bufferprefix lilypond-#1.eps pstopdf \bufferprefix lilypond-#1.eps} \ifeof18 \installprogram{\LP{\the\lily!figures}}% \doif\jobsuffix{pdf}{% \installprogram{\PDF{\the\lily!figures}}% }% \else \executesystemcommand{\LP{\the\lily!figures}}% \doif\jobsuffix{pdf}{% \executesystemcommand{\PDF{\the\lily!figures}}% }% \fi --- error --- ! Use of \LP doesn't match its definition. <write> e p {\LP { \the \lily!figures }} <inserted text> }\endwrite \installprogram ...mmediatewriteutility {e p {#1}} \dodostartlilypond ... {\LP {\the \lily!figures }} \doif \jobsuffix {pdf}{\in... l.71 \stoplilypond --- end --- Maybe the problem has nothing to do with this section. Would you please have a look at the file I posted before? Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://contextgarden.net http://www.cacert.org (I'm an assurer)