2002-05-19 Han-Wen <hanwen@cs.uu.nl>
+ * input/tutorial/sammartini.ly: fix and document autochange
+ weirdness.
+
+ * scm/pdftex.scm: resurrect PDFTeX output. Still doesn't work, but
+ does produce .pdftex files.
+
* lily/note-collision.cc (check_meshing_chords): move file from
collision.cc, implement merged note heads (there you go, Drarn :-)
syntactical details are described at the end of the manual.
@menu
-* Overview::
-* Note entry::
-* Staff notation::
-* Polyphony::
-* Beaming::
-* Expressive marks::
-* Ornaments::
-* Repeats::
-* Rhythmic music::
-* Piano music::
-* Lyrics::
-* Chords::
-* Writing parts::
-* Custodes::
-* Figured bass::
-* Tuning output::
-* Page layout::
-* Output formats::
-* Sound::
-* Music entry::
-* Skipping corrected music::
-* Interpretation context::
-* Syntactic details::
-* Lexical details::
+* Overview::
+* Note entry::
+* Staff notation::
+* Polyphony::
+* Beaming::
+* Expressive marks::
+* Ornaments::
+* Repeats::
+* Rhythmic music::
+* Piano music::
+* Lyrics::
+* Chords::
+* Writing parts::
+* Custodes::
+* Figured bass::
+* Tuning output::
+* Page layout::
+* Output formats::
+* Sound::
+* Music entry::
+* Skipping corrected music::
+* Interpretation context::
+* Syntactic details::
+* Lexical details::
@end menu
@c . {Overview}
@menu
-* Notes::
-* Pitches::
-* Rests::
-* Skips::
-* Durations::
-* Ties::
-* Tuplets::
-* Defining pitch names::
-* Easy Notation note heads ::
+* Notes::
+* Pitches::
+* Rests::
+* Skips::
+* Durations::
+* Ties::
+* Tuplets::
+* Defining pitch names::
+* Easy Notation note heads ::
@end menu
@c . {Notes}
@cindex Staff notation
@menu
-* Key signature::
-* Clef::
-* Time signature::
-* Unmetered music::
-* Bar lines::
+* Key signature::
+* Clef::
+* Time signature::
+* Unmetered music::
+* Bar lines::
@end menu
@c . {Key}
@c . {Slurs}
@menu
-* Slurs ::
-* Phrasing slurs::
-* Breath marks::
-* Tempo::
-* Text spanners::
+* Slurs ::
+* Phrasing slurs::
+* Breath marks::
+* Tempo::
+* Text spanners::
@end menu
@node Slurs
@section Ornaments
@cindex Ornaments
@menu
-* Articulations::
-* Text scripts::
-* Grace notes::
-* Glissando ::
-* Dynamics::
+* Articulations::
+* Text scripts::
+* Grace notes::
+* Glissando ::
+* Dynamics::
@end menu
@c . {Articulation}
@end table
@menu
-* Repeat syntax::
-* Manual repeat commands::
-* Tremolo repeats::
-* Tremolo subdivisions::
-* Measure repeats::
+* Repeat syntax::
+* Manual repeat commands::
+* Tremolo repeats::
+* Tremolo subdivisions::
+* Measure repeats::
@end menu
@node Repeat syntax
}
@end lilypond
-@subsection Unfolding repeats for MIDI output.
+@subsection Repeats and MIDI
+@subsection Repeats and MIDI
@cindex expanding repeats
-See @file{input/test/unfold-all-repeats.ly}.
+For instructions on how to unfoldi repeats for MIDI output, see
+the example file @file{input/test/unfold-all-repeats.ly}.
@refbugs
@menu
-* Rhythmic staves::
+* Rhythmic staves::
@end menu
@node Rhythmic staves
other pianistic peculiarities.
@menu
-* Automatic staff changes::
-* Manual staff switches::
-* Pedals::
-* Arpeggio::
-* Voice follower lines::
+* Automatic staff changes::
+* Manual staff switches::
+* Pedals::
+* Arpeggio::
+* Voice follower lines::
@end menu
Voices can switch automatically between the top and the bottom
staff. The syntax for this is
@example
- \autochange @var{contexttype} @var{musicexp}
-@end example
-This will switch the interpretation context of @var{musicexp} between a
-@var{contexttype} named @code{up} and @code{down}. Typically, you use
-@internalsref{Staff} for @var{contexttype}. The autochanger switches on basis
-of pitch (central C is the turning point), and it looks ahead skipping
-over rests to switch rests in advance.
+ \autochange @var{contexttype} \context @var{childcontexttype}
+ @var{musicexp} @end example This will switch the
+interpretation context of @var{musicexp} between a @var{contexttype}
+named @code{up} and @code{down}. Typically, you use
+@internalsref{Staff} for @var{contexttype}, and @internalsref{Voice}
+for @var{childcontexttype}. The autochanger switches on basis of pitch
+(central C is the turning point), and it looks ahead skipping over
+rests to switch rests in advance.
@lilypond[verbatim,singleline]
\score { \notes \context PianoStaff <
@menu
-* Lyrics mode::
-* Printing lyrics::
+* Lyrics mode::
+* Printing lyrics::
* Automatic syllable durations::
-* More stanzas::
+* More stanzas::
@end menu
@c . {Lyrics mode}
interpret this as an inversion.
@menu
-* Chords mode::
-* Printing named chords::
+* Chords mode::
+* Printing named chords::
@end menu
@c . {Chords mode}
@c . {Transpose}
@menu
-* Rehearsal marks::
-* Bar numbers::
-* Instrument names::
-* Transpose::
+* Rehearsal marks::
+* Bar numbers::
+* Instrument names::
+* Transpose::
* Sound output for transposing instruments::
-* Multi measure rests::
-* Automatic part combining::
-* Hara kiri staves::
+* Multi measure rests::
+* Automatic part combining::
+* Hara kiri staves::
@end menu
@c . {Rehearsal marks}
object, and set a grob property in that object.
@menu
-* Tuning groups of grobs ::
-* Tuning per grob ::
-* What to tune?::
-* Font selection::
-* Text markup::
-* Invisible grobs::
-* Dirty tricks::
+* Tuning groups of grobs ::
+* Tuning per grob ::
+* What to tune?::
+* Font selection::
+* Text markup::
+* Invisible grobs::
+* Dirty tricks::
@end menu
@node Tuning groups of grobs
The part of LilyPond is documented here.
@menu
-* Paper block::
-* Paper variables::
-* Font Size::
-* Paper size::
-* Line break::
-* Page break::
-* Output scaling::
+* Paper block::
+* Paper variables::
+* Font Size::
+* Paper size::
+* Line break::
+* Page break::
+* Output scaling::
@end menu
@c . {Paper block}
LilyPond can output processed music in different output formats.
@menu
-* TeX output::
-* PostScript output::
-* Scheme output::
-* ASCIIScript output::
+* TeX output::
+* PostScript output::
+* Scheme output::
+* ASCIIScript output::
@end menu
@node TeX output
channel 10 of a MIDI file).
@menu
-* MIDI block::
-* MIDI instrument names::
+* MIDI block::
+* MIDI instrument names::
@end menu
@c . {MIDI block}
@section Music entry
@cindex Music entry
@menu
-* Relative::
-* Bar check::
-* Point and click::
+* Relative::
+* Bar check::
+* Point and click::
@end menu
When entering music with LilyPond, it is easy to introduce errors. This
@section Interpretation context
@menu
-* Creating contexts::
-* Default contexts::
-* Context properties::
-* Engravers and performers::
+* Creating contexts::
+* Default contexts::
+* Context properties::
+* Engravers and performers::
* Changing context definitions::
-* Defining new contexts::
+* Defining new contexts::
@end menu
This section describes details that were too boring to be put elsewhere.
@menu
-* Top level::
-* Identifiers::
-* Music expressions::
+* Top level::
+* Identifiers::
+* Music expressions::
* Manipulating music expressions::
-* Assignments::
-* Lexical modes::
-* Ambiguities::
+* Assignments::
+* Lexical modes::
+* Ambiguities::
@end menu
@c . {Top level}
@c . {Span requests}
@menu
-* Span requests::
+* Span requests::
@end menu
@node Span requests
Even more boring details, now on lexical side of the input parser.
@menu
-* Comments::
-* Direct Scheme::
-* Keywords::
-* Integers::
-* Reals::
-* Strings::
-* Main input::
-* File inclusion::
-* Version information::
+* Comments::
+* Direct Scheme::
+* Keywords::
+* Integers::
+* Reals::
+* Strings::
+* Main input::
+* File inclusion::
+* Version information::
@end menu
indicates the type of repeat. In this case, @code{"volta"} means that
prima volta/secunda volta brackets are used for the alternative
endings---if there were any.
+
+A special notation for repeats allows you to get correct repeats in
+MIDI output. However, some extra trickery is needed to get this
+working, See @ref{Repeats and MIDI}.
@separate
@example
@node A piano excerpt
@section A piano excerpt
-Our fourth subject is a piece of piano music. The fragment in the input
-file is a piano reduction of the G major Sinfonia by Giovanni Battista
-Sammartini. It was composed around 1740. It's in the source package
-under the name @file{sammartini.ly}.
+Our fourth subject is a piece of piano music. The fragment in the
+input file is a piano reduction of the G major Sinfonia by Giovanni
+Battista Sammartini. It was composed around 1740. It's in the source
+package under the name @file{sammartini.ly}.
@lilypond[verbatim]
\include "paper16.ly"
}
hoomPah = \repeat unfold 8 \notes
- \transpose c' { \stemUp c8 \stemBoth \stemDown c'8 \stemBoth }
+ \transpose c' { \stemUp c8 \stemBoth \stemDown g'8 \stemBoth }
bassvoices = \notes \relative c' {
c4 g8. b,16
- \autochange Staff \hoomPah
+ \autochange Staff \context Voice \hoomPah
\translator Staff = down
\stemDown [c8 c'8] r4
<g d'> r4
@example
bassvoices = \notes \relative c' @{
c4 g8. b,16
-\autochange Staff \hoomPah
+\autochange Staff \hoomPah \context Voice
@end example
@cindex staff switch, automatic
@cindex cross staff voice, automatic
--- /dev/null
+
+
+\score{ \notes {[g'' <e'''8 g> g''] }}
\property Staff.NoteCollision \override #'merge-differently-headed = ##t
c2
- c4. c8
+ c8 c4.
c2
}
\context Voice = VB {
}
hoomPah = \repeat unfold 8 \notes
- \transpose c' { c8 \stemDown c'8 \stemUp }
+ \transpose c' { c8 \stemDown g'8 \stemUp }
bassvoices = \notes \relative c' {
c4 g8. b,16
- \autochange Staff \hoomPah
+ \autochange Staff \context Voice \hoomPah
\translator Staff = down
\stemDown [c8 c'8] r4
<g d'> r4
Relative_octave_music::Relative_octave_music ()
{
- set_mus_property ("type", ly_symbol2scm ("relative-octave-music"));
+ set_mus_property ("type", ly_symbol2scm ("relative-octave-music"));
}
ADD_MUSIC (Relative_octave_music);
(scm pysk)
(scm ascii-script)
(scm sketch)
+ (scm pdftex)
)
(define output-alist
("as" . ,as-output-expression)
("pysk" . ,pysk-output-expression)
("sketch" . ,sketch-output-expression)
+ ("pdftex" . ,pdftex-output-expression)
))
(define (define-origin a b c ) "")
(define (no-origin) "")
+(define my-eval-in-module eval)
+
+(if (or (equal? (minor-version) "4")
+ (equal? (minor-version) "3.4"))
+ (begin
+ (set! my-eval-in-module eval-in-module)
+
+ ))
+
+(define-public (pdf-output-expression expr port)
+ (display (my-eval-in-module expr this-module) port) )
-(define (scm-pdf-output)
- (primitive-eval (pdf-scm 'all-definitions)))
; Local Variables:
; scheme-program-name: "guile"
(define-module (scm pdftex))
+(use-modules (scm pdf)
+ (guile)
+ (ice-9 regex)
+ (ice-9 string-fun)
+ )
+
+(define this-module (current-module))
(define (unknown)
"%\n\\unknown%\n")
))
(define (beam width slope thick)
- (embedded-pdf ((pdf-scm 'beam) width slope thick)))
+ (embedded-pdf (list 'beam width slope thick)))
(define (bracket arch_angle arch_width arch_height height arch_thick thick)
- (embedded-pdf ((pdf-scm 'bracket) arch_angle arch_width arch_height height arch_thick thick)))
+ (embedded-pdf (list 'bracket arch_angle arch_width arch_height height arch_thick thick)))
(define (dashed-slur thick dash l)
- (embedded-pdf ((pdf-scm 'dashed-slur) thick dash l)))
+ (embedded-pdf (list 'dashed-slur thick dash l)))
(define (char i)
(string-append "\\char" (inexact->string i 10) " "))
(define (dashed-line thick on off dx dy)
- (embedded-pdf ((pdf-scm 'dashed-line) thick on off dx dy)))
+ (embedded-pdf (list 'dashed-line thick on off dx dy)))
(define (font-load-command name-mag command)
(string-append
"\n"))
(define (ez-ball c l b)
- (embedded-pdf ((pdf-scm 'ez-ball) c l b)))
+ (embedded-pdf (list 'ez-ball c l b)))
+
+
+
+(if (or (equal? (minor-version) "4")
+ (equal? (minor-version) "3.4"))
+ (define (embedded-pdf expr)
+ (let ((ps-string
+ (with-output-to-string
+ (lambda () (pdf-output-expression expr (current-output-port))))))
+ (string-append "\\embeddedpdf{" ps-string "}")))
+ (define (embedded-pdf expr)
+ (let
+ ((os (open-output-string)))
+ (pdf-output-expression expr os)
+ (string-append "\\embeddedpdf{" (get-output-string os) "}"))))
-(define (embedded-pdf s)
- (string-append "\\embeddedpdf{ " s "}"))
(define (comment s)
- (string-append "% " s))
+ (simple-format #f "% ~a\n" s))
(define (end-output)
(begin
"")
(define (repeat-slash w a t)
- (embedded-pdf ((pdf-scm 'repeat-slash) w a t)))
+ (embedded-pdf (list 'repeat-slash w a t)))
+(define (fontify name-mag-pair exp)
+ (string-append (select-font name-mag-pair)
+ exp))
+
+
+(define (tex-encoded-fontswitch name-mag)
+ (let* ((iname-mag (car name-mag))
+ (ename-mag (cdr name-mag)))
+ (cons iname-mag
+ (cons ename-mag
+ (string-append "magfont"
+ (string-encode-integer
+ (hashq (car ename-mag) 1000000))
+ "m"
+ (string-encode-integer
+ (inexact->exact (* 1000 (cdr ename-mag)))))))))
+(define (define-fonts internal-external-name-mag-pairs)
+ (set! font-name-alist (map tex-encoded-fontswitch
+ internal-external-name-mag-pairs))
+ (apply string-append
+ (map (lambda (x)
+ (font-load-command (car x) (cdr x)))
+ (map cdr font-name-alist))))
+
(define (font-switch i)
(string-append
(number->dim y) "}{" (number->dim x) "}{" s "}\n"))
(define (bezier-sandwich l thick)
- (embedded-pdf ((pdf-scm 'bezier-sandwich) l thick)))
+ (embedded-pdf (list 'bezier-sandwich `(quote ,l) thick)))
(define (start-system ht)
(string-append"\\vbox to " (number->dim ht) "{\\hbox{%\n"))
"height " (number->dim height) " "))
(define (roundfilledbox x width y height blotdiam)
- (embedded-pdf ((pdf-scm 'roundfilledbox) x width y height blotdiam)))
+ (embedded-pdf (list 'roundfilledbox x width y height blotdiam)))
(define (text s)
(string-append "\\hbox{" (output-tex-string s) "}"))
(define (no-origin) "")
-(define (scm-pdftex-output)
- (primitive-eval (pdftex-scm 'all-definitions)))
+
+(define my-eval-in-module eval)
+
+(if (or (equal? (minor-version) "4")
+ (equal? (minor-version) "3.4"))
+ (begin
+ (set! my-eval-in-module eval-in-module)
+
+ ))
+
+(define-public (pdftex-output-expression expr port)
+ (display (my-eval-in-module expr this-module) port) )