Re: [TeX-music] TeX programming

2002-09-26 Thread Rainer Dunker

Hello Stefan!

On Tue, Sep 24, 2002 at 02:56:34PM +0200, Stefan Svensson wrote:
 I would like to simplify this with a macro that iterates over a string 
 with all notes in the scale ({cd_efg'_ab}) and adds the corresponding 
 numbers below, perhaps from a string like {12{\flt3}45{\flt6}{\flt7}}.

Sorry, but I can't refrain from making the following proposal: :-)

8---
\documentclass{article}
\usepackage{musixtex}
\input musixlyr

\font\ChordSymbolSmall=musix13
\def\flt{\raise 1.7pt\hbox{\ChordSymbolSmall\char50}}

\begin{document}
\begin{music}
  \setlyrics1{\lyrlayout\smalltype 1 2 \flt3 4 5 \flt6 \flt7}
  \assignlyrics11
  \startextract
\Notes\nq{cd_efg'_ab}\lpar c\rpar c\nolyr\nq c\en
  \endextract
\end{music}
\end{document}
8---

But if you insist on doing the job without musixlyr: I don't quite
understand whether you intend to give the text line explicitly, like:

\doit{cd_efg'_ab}{12{\flt3}45{\flt6}{\flt7}}

.. or whether the scale digits shall be deduced automatically from the
notes sequence. Depending on this decision, the difficulty of
finding a solution may vary very much.

Regards,

Rainer
___
TeX-music mailing list
[EMAIL PROTECTED]
http://sunsite.dk/mailman/listinfo/tex-music



Re: [TeX-music] TeX programming

2002-09-26 Thread Stefan Svensson

Rainer,

 Sorry, but I can't refrain from making the following proposal: :-)

Du bist ein Genie! :-)

Vielnen Dank!

Stefan


___
TeX-music mailing list
[EMAIL PROTECTED]
http://sunsite.dk/mailman/listinfo/tex-music



Re: [TeX-music] TeX programming

2002-09-26 Thread Stefan Svensson

 The second scale does get the numers (the lyrics) gathered to the 
 right of the music extract. What am I doing wrong?

Page 19. \resetlyrics. RTFM!

Sorry for wasting bandwith.:-)

Stefan


___
TeX-music mailing list
[EMAIL PROTECTED]
http://sunsite.dk/mailman/listinfo/tex-music



Re: [TeX-music] TeX programming

2002-09-24 Thread Bernhard Lang

On Tue, 24 Sep 2002, Stefan Svensson wrote:

 I would like to simplify this with a macro that iterates over a string
 with all notes in the scale ({cd_efg'_ab}) and adds the corresponding
 numbers below, perhaps from a string like {12{\flt3}45{\flt6}{\flt7}}.

This looks like beeing a job for \futurelet: \futurelet\a\b... sets \a
to the first token of ... and executes then \b. You may set up a loop
using this control sequence by iteration:

1 append an end character to the string
2 read the first character into a macro
3 if it is not the end character
  - process it
  - set a temporary macro to the operations 2-4
  else
  - drop the end character
  - set the temporary macro to a void action
4 put the temporary macro

this should look like follows (not tested)

\def\processtoken#1{whatever you want to do with the single tokens}
\def\setend#1{#1-}% sets an endmark (`-`) behind the string
\def\check{% checks one token
  \if\temp-\let\next\relax
  \else\processtoken\temp\let\next\iterate
  \fi
  \next
}
\def\iterate{\futurelet\temp\check}
\def\processstring#1{\expandafter\iterate\setend{#1}}


happy hacking
  Bernhard

___
TeX-music mailing list
[EMAIL PROTECTED]
http://sunsite.dk/mailman/listinfo/tex-music