]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/output-tex.scm
* scripts/lilypond.py: Remove LaTeX titling kludge. Remove page
[lilypond.git] / scm / output-tex.scm
index 6c529914c4440cbecf7bcc889df9179dec5e7f3b..d9c87df9ca3f79c96195624d22cc8e5a8633744c 100644 (file)
             tuplet
             polygon
             draw-line
-            between-system-string
             define-origin
             no-origin
             start-page
             stop-page
-            )
-  )
+            ))
 
 (use-modules (ice-9 regex)
             (ice-9 string-fun)
   (regexp-substitute/global
    #f "_" (output-tex-string (symbol->string sym)) 'pre "X" 'post) )
 
+(define (string->param string)
+  (string-append "{" string "}"))
+
+(define (number->param number)
+  (string->param (ly:number->string number)))
+
+(define (number-pair->param o)
+  (string-append (number->param (car o)) (number->param (cdr o))))
+
 (define (tex-string-def prefix key str)
   (if (equal? "" (sans-surrounding-whitespace (output-tex-string str)))
       (string-append "\\let\\" prefix (symbol->tex-key key) "\\undefined%\n")
-      (string-append "\\def\\" prefix (symbol->tex-key key) "{"  (output-tex-string str) "}%\n")
-      ))
+      (string-append "\\def\\" prefix (symbol->tex-key key)
+                    "{" (output-tex-string str) "}%\n")))
 
 (define (tex-number-def prefix key number)
-  (string-append "\\def\\" prefix (symbol->tex-key key) "{" number "}%\n"))
+  (string-append
+   "\\def\\" prefix (symbol->tex-key key) (string->param number) "%\n"))
 
 (define (output-paper-def pd)
   (apply
    (ly:number->string x) " \\outputscale "))
 
 (define (placebox x y s) 
-  (string-append "\\lyitem{"
-                (ly:number->string y) "}{"
-                (ly:number->string x) "}{"
-                s "}%\n"))
+  (string-append
+   "\\lyitem" (number->param x) (number->param y) (string->param s) "%\n"))
 
 (define (bezier-sandwich l thick)
   (embedded-ps (list 'bezier-sandwich  `(quote ,l) thick)))
 
-(define (start-system wd ht)
-  (string-append "\\leavevmode\n"
-                "\\scoreshift = " (number->dim (* ht 0.5)) "\n"
-                "\\lilypondifundefined{lilypondscoreshift}%\n"
-                "  {}%\n"
-                "  {\\advance\\scoreshift by -\\lilypondscoreshift}%\n"
-                "\\lybox{"
-                (ly:number->string wd) "}{"
-                (ly:number->string ht) "}{%\n"))
-
-(define (stop-system) 
-  "}%\n%\n\\interscoreline\n%\n")
-(define (stop-last-system)
-  "}%\n")
+(define (start-system origin dim)
+  (string-append
+   "\\leavevmode\n"
+   "\\lybox" (number-pair->param origin) (number-pair->param dim)
+  "{%\n"))
+
+(define (stop-system last?)
+  (if last?
+      "}%\n"
+      ;; FIXME: still used by lilypond.py for --preview
+      "}%\n%\n\\interscoreline\n%\n"))
 
 (define (horizontal-line x1 x2 th)
   (filledbox (- x1)  (- x2 x1) (* .5 th)  (* .5 th )))
   (let*
       ((mapping #f))
 
-      ;; TODO: we'd better do this for PS only
-      ;; LaTeX gets in the way, and we need to remap
-      ;; nonprintable chars.
-
-       ; (assoc-get  'char-mapping (ly:font-encoding-alist font))))
+    ;; TODO: we'd better do this for PS only
+    ;; LaTeX gets in the way, and we need to remap
+    ;; nonprintable chars.
+    
+    ;; (assoc-get  'char-mapping (ly:font-encoding-alist font))))
 
     (string-append "\\hbox{\\" (font-command font) "{}"
                   (output-tex-string
 (define (draw-line thick fx fy tx ty)
   (embedded-ps (list 'draw-line thick fx fy tx ty)))
 
-;; TODO: this should be a default, which is overriden in PS
-(define (between-system-string string)
-  string
-  )
 (define (define-origin file line col)
   (if (procedure? point-and-click)
       (string-append "\\special{src:" ;;; \\string ? 
 (define (no-origin) "")
 
 (define (start-page)
-  "\n%\\vbox{\n")
+  "\n\\vbox to 0pt{\n")
 
 (define (stop-page last?)
   (if last?
-      "\n%}\n"
-      "\n%}\n\\newpage\n"))
+      "\\vss\n}\n\\vfill\n"
+      "\\vss\n}\n\\vfill\\newpage\n"))