Re: Lua/LaTeX assistance
On 06.11.2013 09:34, Urs Liska wrote: Am 06.11.2013 07:05, schrieb Joshua Nichols: I guess in the end I didn't understand anything at all, and my hard head saw LaTeX and didn't see preprocessed with lilypond-book. Maybe this is a good opportunity to hook in. If there is anybody out there experienced with LaTeX and Lua I'd be glad he/she would get in touch with me. I have written a LaTeX package 'musicexamples' (http://www.openlilylib.org/musicexamples) which is currently useful but not spectacularly unique. I'm using it for managing music examples in my LaTeX documents. It's on my agenda however to extend this package through Lua (although the new functionality would of course be restricted to LuaLaTeX) in order to accept embedded LilyPond code like lilypond-book does. For bigger projects I prefer separate files, but maybe the attached file is useful for your project. It demonstrates how to include a lilypond file in a lualatex document. lualatex --shell-escape lilyinluatex.tex will generate a lilypond file, call lillypond and pdfcrop to generate a proper pdf and include it in lilyinluatex.pdf Lilypond lyrics font and size exactly match the default TeX font. It's not the explicit intention to make a verbatim copy of lilypond-book, but moving the functionality _inside_ the LaTeX compilation process would offer at least the following fixes for problems that have so far led me not to use lilypond-book: - You can compile the document at any time directly, no need for preprocessing and intermediate .tex files - You don't have to chose between cluttering your working directory with intermediate files or causing relative-path problems by using the -out option - You have reliable access to the _currently effective_ text width, e.g. in multicolumn context I know that even without any prior Lua experience I would be able to dive into that and somehow manage to come up with something. lualatex is a good engine as it has native utf8 support. I don't think that you do need lua, TeX is enough cu, Knut \NeedsTeXFormat{LaTeX2e} \documentclass[10pt,twoside]{letter} \usepackage{geometry} \geometry{a4paper,noheadfoot,nomarginpar,left=1.5cm,right=1.5cm,top=1.5cm,bottom=1.5cm,} \usepackage{fontspec} \defaultfontfeatures{Ligatures=TeX} \usepackage{polyglossia} \setdefaultlanguage[spelling=old]{german} \setmainfont{CMU Serif} \setsansfont{CMU Sans Serif} \setmonofont{CMU Typewriter Text} \usepackage{graphicx} \usepackage{luatex} \pdfcompresslevel=9 % lualatex and lilypond mixed in one file % % tex, lilypond headers and lyrics use the same fonts. % % lyrics fontsize matches the fontsize of the TeX \normalsize. % % Use lualatex --shell-escape lilyinluatex to generate pdf. % % lualatex will % write tmplily.ly, % call lilypond to generate tmplily.pdf % call pdfcrop to remove extra white space % \def\tmplilyname{tmplily.ly } \def\tmppdfname{tmplily.pdf } \def\lilycommand{lilypond } \newwrite\tmplilyfile { \catcode`|=0 \catcode`[=1 \catcode`]=2 \catcode`\{=12 \catcode`\}=12 \catcode`\\=12 |gdef|eolily[\end{lilypage}] ] \obeylines \def\doline#1 { \def\oneline{#1} \ifx\oneline\eolily \def\next{\end{lilypage}} \else \immediate\write\tmplilyfile{\oneline} \let\next\doline \fi \next% } \makeatletter \newenvironment{lilypage}[1]{ \gdef\lilypdf{#1} \immediate\openout\tmplilyfile=\tmplilyname \let\do=\@makeother\dospecials\obeylines\doline }{ \immediate\closeout\tmplilyfile \immediate\write18{\lilycommand \tmplilyname}% \immediate\write18{pdfcrop \tmppdfname \lilypdf}% } \makeatother \begin{document} \pagestyle{empty} Remember to use \verb+lualtex --shell-escape example.tex+ \begin{lilypage}{example1.pdf} \version 2.18.2 \include deutsch.ly #(set! paper-alist (cons '(mySize . (cons (* 10 cm) (* 4.5 cm))) paper-alist)) \paper { #(set-paper-size mySize) left-margin = 0\cm top-margin = 0\cm bottom-margin = 0\cm line-width = \paper-width indent = 0 page-count = #1 ragged-bottom = ##f ragged-last-bottom = ##f annotate-spacing=##f } \header { title = \markup { \override #'(font-name . CMU Serif Bold) Macht hoch die Tür } subtitle = \markup { \override #'(font-name . CMU Serif Bold) Only an example } tagline = ##f } #(set-global-staff-size 17) allowGrobCallback = #(define-scheme-function (parser location syms) (symbol-list?) (let ((interface (car syms)) (sym (cadr syms))) #{ \with { \consists #(lambda (context) `((acknowledgers . ((,interface . ,(lambda (engraver grob source-engraver) (let ((prop (ly:grob-property grob sym))) (if (procedure? prop) (ly:grob-set-property! grob sym (prop grob))}#})) absFontSize = #(define-scheme-function (parser location pt)(number?) (lambda (grob) (let* ((layout (ly:grob-layout grob)) (ref-size (ly:output-def-lookup (ly:grob-layout grob) 'text-font-size 12))) (magnification-font-size (/ pt ref-size) \score { \new Voice = Melody \relative g'{ \key es \major
Re: Lua/LaTeX assistance
Hello Knut, thank you for that, I'll look into it ASAP. Am 01.12.2014 10:33, schrieb Knut Petersen: On 06.11.2013 09:34, Urs Liska wrote: Am 06.11.2013 07:05, schrieb Joshua Nichols: I guess in the end I didn't understand anything at all, and my hard head saw LaTeX and didn't see preprocessed with lilypond-book. Maybe this is a good opportunity to hook in. If there is anybody out there experienced with LaTeX and Lua I'd be glad he/she would get in touch with me. I have written a LaTeX package 'musicexamples' (http://www.openlilylib.org/musicexamples) which is currently useful but not spectacularly unique. I'm using it for managing music examples in my LaTeX documents. It's on my agenda however to extend this package through Lua (although the new functionality would of course be restricted to LuaLaTeX) in order to accept embedded LilyPond code like lilypond-book does. For bigger projects I prefer separate files, well, this is an option too of course. I'd like to copy the functionality of lilypond-book, which can also reference external files. The point is to do it from within the LaTeX run and not to rely on an external preprocessor. but maybe the attached file is useful for your project. It demonstrates how to include a lilypond file in a lualatex document. lualatex --shell-escape lilyinluatex.tex will generate a lilypond file, call lillypond and pdfcrop to generate a proper pdf and include it in lilyinluatex.pdf Lilypond lyrics font and size exactly match the default TeX font. Looking forward to inspecting it :-) It's not the explicit intention to make a verbatim copy of lilypond-book, but moving the functionality _inside_ the LaTeX compilation process would offer at least the following fixes for problems that have so far led me not to use lilypond-book: - You can compile the document at any time directly, no need for preprocessing and intermediate .tex files - You don't have to chose between cluttering your working directory with intermediate files or causing relative-path problems by using the -out option - You have reliable access to the _currently effective_ text width, e.g. in multicolumn context I know that even without any prior Lua experience I would be able to dive into that and somehow manage to come up with something. lualatex is a good engine as it has native utf8 support. I don't think that you do need lua, TeX is enough That would be great of course. Just recently I discovered that there are packages to use Python from within LaTeX. I think I'll have a look at that too. Not only is that a language I already know, but as it's the same as lilypond-book it might be possible to reuse some of that. Best Urs cu, Knut ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
generating small snippets
Hi! I am taking notes of music classes in Markdown. Those notes go through a static web site generator (pandoc), and they use LilyPond textual syntax in code blocks for music notation for simple snippets (think scales, chords, arpeggios, etc.) That works fine, but if there was a way to get minimal output from LilyPond with just the music I would be able to write a preprocessor that replaced the code with a image of the staff (only for display mode, not inline). Is there a built-in way to generate small snippets as images? ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: lilypond-cheatsheets
Since it's a LilyPond cheat sheet, wouldn't it be better to use c' cis' d' etc instead of C3 and so on? I felt that using the so called scientific notation just provides an example to customize further. Using lilypond notation is easy. Just remove this line from cheatsheets.ly: \override NoteName.stencil = \note-name-stencil Also, guitar sounds an octave lower than notated, which is often indicated by a small 8 below the clef. Haven't changed from the default clef because the documentation got me a bit confused. Theoretically treble_8 is the clef we want. And the documentation says that it should transpose one octave lower. But if we set to it, it seems one octave higher. Is it so because we use custom instrument tuning? So, only this works: \clef treble_8 \transpose c c, { \staff-music } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: generating small snippets
Have you looked at the command line option -dpreview ? http://lilypond.org/doc/v2.18/Documentation/usage/command_002dline-usage -- Phil Holmes - Original Message - From: Xavier Noria To: lilypond-user Sent: Monday, December 01, 2014 11:30 AM Subject: generating small snippets Hi! I am taking notes of music classes in Markdown. Those notes go through a static web site generator (pandoc), and they use LilyPond textual syntax in code blocks for music notation for simple snippets (think scales, chords, arpeggios, etc.) That works fine, but if there was a way to get minimal output from LilyPond with just the music I would be able to write a preprocessor that replaced the code with a image of the staff (only for display mode, not inline). Is there a built-in way to generate small snippets as images? -- ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: generating small snippets
Am 01.12.2014 um 12:30 schrieb Xavier Noria: That works fine, but if there was a way to get minimal output from LilyPond with just the music I would be able to write a preprocessor that replaced the code with a image of the staff (only for display mode, not inline). Maybe you should have a look at Wikipedia’s/Mediawiki’s score tag which uses Lilypond: http://www.mediawiki.org/wiki/Extension:Score Is there a built-in way to generate small snippets as images? Phil is right, -dpreview is the command line option you probably want. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Beaming and grace notes
I'm still working on the measure. Keith's solution works well, but when I fit it into my structure I get a beam-slope warning. Below is a minimal example, which is quite large, that prints just the one measure. The warning is written into the code. * Is there a way to keep this structure and get rid of the warning? * The initial e flat in the lower staff is an eighth note, and the stem needs to extend up beyond the 32nd note beams of the grace notes. How can I do that? Thanks for the help so far. %%--- Start \version 2.19.15 \language english staffUp = \change Staff = upper staffDown = \change Staff = lower graceOn = { \teeny \override Stem #'no-stem-extend = ##t \override Stem #'length-fraction = #0.7 } graceOff = { \normalsize \revert Stem #'no-stem-extend \revert Stem #'length-fraction } global = { \key bf \minor \time 2/4 } upperStaffTop = \relative c'' { \clef bass s2 } upperStaffBottom = \relative c' { } lowerStaffTop = \relative c' { \clef bass \staffUp \stemDown af32 [ ( bf af gf \staffDown \stemNeutral { \voiceTwo \stemUp ef8 ) ] ~ ef4 } \new Voice { \voiceOne \scaleDurations 4/14 { \staffDown ef32 [ \( % warning: no viable initial configuration found: % may not find good beam slope \graceOn gf af bf df \staffUp \stemDown \clef treble ef gf af bf df ] \stemUp ef gf af bf \graceOff } \stemNeutral df16^ ( [ bf ] ) \) r8 } } lowerStaffBottom = \relative c { bf2 } %% %% Below is boilerplate %% upperStaff = { \clef treble \global \new Voice { \voiceOne \upperStaffTop } \new Voice { \voiceTwo \upperStaffBottom } } lowerStaff = { \clef bass \global \new Voice { \voiceThree \lowerStaffTop } \new Voice { \voiceFour \lowerStaffBottom } } \score { \new PianoStaff \new Staff = upper \upperStaff \new Staff = lower \lowerStaff \layout{ } } %%--- End Knute Snortum (via Gmail) On Sun, Nov 30, 2014 at 2:04 PM, Keith OHara k-ohara5...@oco.net wrote: On Sat, 29 Nov 2014 07:44:39 -0800, Knute Snortum ksnor...@gmail.com wrote: I've attached a picture of the measure. [Debussy Prelude #2, Voiles] This piece uses a whole-tone scale (not in the part with the cross-staff grace notes of Knute's example, but most of the rest of the piece) so I would be tempted to print a version of this with wholeTone = #`( (0 . ,NATURAL) (1 . ,NATURAL) (2 . ,NATURAL) (3 . ,SHARP) (4 . ,SHARP) (5 . ,FLAT) (6 . ,FLAT)) \key c\wholeTone and see if it is easier to read with all the accidentals moved into a key signature. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: lilypond-cheatsheets
On Mon, 01 Dec 2014 14:42:43 +0300 sg2002 sg2...@gmx.com wrote: Also, guitar sounds an octave lower than notated, which is often indicated by a small 8 below the clef. Haven't changed from the default clef because the documentation got me a bit confused. Theoretically treble_8 is the clef we want. And the documentation says that it should transpose one octave lower. But if we set to it, it seems one octave higher. Is it so because we use custom instrument tuning? So, only this works: \clef treble_8 \transpose c c, { \staff-music } AFAIK, this is the correct clef and tuning: { \clef treble_8 e, a, d g b e' 2 } -- Johan cheatsheets.pdf Description: Adobe PDF document ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
m above beam in guitar notation
Hi, in the following example, the m is printed above the beam whereas all other right hand fingerings are notated below the beam. Is this related to the larger size of the letter m? Can someone shed a light on this and how this could be avoided? -- Orm %- \version 2.18.2 RH = #rightHandFinger upper = \relative c' { \set fingeringOrientations = #'(left) \set strokeFingerOrientations = #'(up) \set stringNumberOrientations = #'(down) \override StringNumber.transparent = ##t e-1 \2 \RH #2 8 fis-3 \2 \RH #3 g-4 \2 \RH #2 a-1 \1 \RH #4 } lower = \relative c { \set fingeringOrientations = #'(left) \set strokeFingerOrientations = #'(down) \set stringNumberOrientations = #'(up) \override StringNumber.transparent = ##t e,-0 \6 \RH#1 2 } \new StaffGroup \new Staff { \clef G_8 \key e \minor \upper \\ \lower } \new TabStaff \upper \\ \lower %- ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: scheme problem: colored background, layers
Hi Pierre, thanks for taking the time to think about it. Meanwhile, after some sleepless nights ;-) I've found another way to get some results: % --- \version 2.18.0 colorSpan = #(define-music-function (parser location y-lower y-upper color) (number? number? color?) #{ \override Staff.HorizontalBracket #'stencil = $(lambda (grob) (let* ( (area (ly:horizontal-bracket::print grob)) (X-ext (ly:stencil-extent area X)) (Y-ext (ly:stencil-extent area Y)) ) (set! Y-ext (cons y-lower y-upper) ) (ly:grob-set-property! grob 'layer -10) (ly:make-stencil (list 'color color (ly:stencil-expr (ly:round-filled-box X-ext Y-ext 0)) X-ext Y-ext)) )) #}) { { R1 \colorSpan #-5 #5 #(rgb-color 1.0 0.9 0.5) c'2\startGroup g' c' \stopGroup \colorSpan #0 #5 #(rgb-color 0.5 1.0 0.5) r4\startGroup r \stopGroup \colorSpan #-5 #0 #(rgb-color 0.9 1.0 0.5) r\startGroup r\stopGroup } \\ { \override Voice.ClusterSpanner.color = #(rgb-color 0.5 0.6 1) \override Voice.ClusterSpanner.layer = #-1 \makeClusters { s1 c'2 g' c' s s1 } } } \layout { \context { \Voice \consists Horizontal_bracket_engraver \override HorizontalBracket #'thickness = #0 \override HorizontalBracket #'bracket-flare = #'(0 . 0) \override HorizontalBracket #'Y-extent = #'(0 . 0) \override HorizontalBracket #'edge-height = #'(0 . 0) \override HorizontalBracket #'Y-offset = #0 \override HorizontalBracket #'shorten-pair = #'(-1 . -0.75) } } % --- Result: http://4.bp.blogspot.com/-THmAQWfqDaw/VHztoaE6N2I/ACs/9Sqgl4ViMBc/s1600/ly-ex3.gif This time, I abused the Horizontal_bracket_engraver that is used for \startGroup and \stopGroup and replaced it's stencil by a rectangle. Because it's not attached to the StaffSymbol, it can be placed in a different layer, so the blue cluster and the staff lines both stay visible. Anyway, LilyPond does the horizontal spacing without the need for manual work. This might make life easier for doing crazy things like this: http://4.bp.blogspot.com/-kEXoxAx6HG0/VHzvH9GW9KI/AC8/48vNguVdp2A/s1600/ly-ex4.gif http://4.bp.blogspot.com/-ChtL4-lGKoE/VHzvHuNU76I/AC4/Do8L81Al19I/s1600/ly-ex5.gif Cheers, Klaus Blum Am 29.11.2014 um 10:43 schrieb Pierre Perol-Schneider: Hi Klaus, 2014-11-29 10:30 GMT+01:00 Big Noise benbigno...@gmx.de mailto:benbigno...@gmx.de: thanks for your reply. Unfortunately, changing the layer value from -10 to -2 doesn't help. The problem is that the function places the staff lines and the colored rectangle into the *same* layer, whereas I need to leave the staff lines in layer 0 and put the rectangle into layer -2 (or even less). This would allow me to put other clusters *between* them like in the first example. Right ! Now I see the problem, 'seems that I've replied without thinking... I have already found another interesting snippet: http://lsr.di.unimi.it/LSR/Item?id=953 But in that case, I would have to find the dimensions for the rectangle by trial-and-error, whereas overriding the StaffSymbol seems to be a very easy way... Actually I've made this one (which is more or less a draft). I'll try to see what I can do with it. No promise though :( Cheers, Pierre ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: m above beam in guitar notation
Il giorno lun 1 dic 2014 alle 23:20, Orm Finnendahl orm.finnend...@selma.hfmdk-frankfurt.de ha scritto: Hi, in the following example, the m is printed above the beam whereas all other right hand fingerings are notated below the beam. Is this related to the larger size of the letter m? Can someone shed a light on this and how this could be avoided? Known problem, there's an open issue: https://code.google.com/p/lilypond/issues/detail?id=3435 I used the workaround suggested there in the attached file (I've also changed a bit your input). \version 2.18.0 global = { \key e \minor \time 4/4 \override StrokeFinger.font-size = #-6 } RH = #rightHandFinger upper = \relative c' { \global \set fingeringOrientations = #'(left) \set strokeFingerOrientations = #'(up) \set stringNumberOrientations = #'(down) e-1 \2 \RH #2 8 fis-3 \2 \RH #3 g-4 \2 \RH #2 a-1 \1 \RH #4 } lower = \relative c { \global \set fingeringOrientations = #'(left) \set strokeFingerOrientations = #'(down) \set stringNumberOrientations = #'(up) e,-0 \6 \RH#1 2 } \score { \new StaffGroup \new Staff { \clef treble_8 \upper \\ \lower } \new TabStaff \with { stringTunings = #guitar-tuning } \new TabVoice { \voiceOne \upper } \new TabVoice { \voiceTwo \lower } \layout { \omit Voice.StringNumber } } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
center-aligning TimeSignatures
Hello all, 1. When different staves have different TimeSignatures, is there a standard as to the alignment? (n.b. Lilypond’s default is left-aligned, as seen in the snippet below.) 2. If my preference would be to center-align them (see manually-tweaked version in the snippet), is there an easy way to accomplish this globally/automagically? Thanks, Kieren. \version 2.19 thinSigMusic = { \set Staff.timeSignatureFraction = 3/4 c''1 } thickSigMusic = { \set Staff.timeSignatureFraction = 4899/222 c''1 } \score { \new Staff \thinSigMusic \new Staff \thickSigMusic } \score { \new Staff \with { \override TimeSignature.extra-offset = #'(2 . 0) } \thinSigMusic \new Staff \thickSigMusic } ___ Kieren MacMillan, composer www: http://www.kierenmacmillan.info email: i...@kierenmacmillan.info ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Beaming and grace notes
On Mon, 01 Dec 2014 12:28:54 -0800, Knute Snortum ksnor...@gmail.com wrote: * Is there a way to keep this structure and get rid of the warning? The warning is about being unable to fit the beam between the notes, because you forced the stem directions in such a way to force the beam between the staves LilyPond usually sets the staff spacing based on everything that doesn't cross staves, and then decides whether to 'knee' the cross-staff beam depending on how far apart the staves are. In this case it does look nicer with the knee, and once the rest of the music is in place the staves will be spaced apart, anyway. You'll want the dynamics to clear the beam, for example, and adding this spreads the staves. upperStaffTop = \relative c'' { \clef bass s8. \once\override DynamicLineSpanner.staff-padding = #4 s16\ s8\ff s } http://lilypond.org/doc/v2.18/Documentation/notation/common-notation-for-keyboards#changing-staff-manually * The initial e flat in the lower staff is an eighth note, and the stem needs to extend up beyond the 32nd note beams of the grace notes. Why? The beam slope changes there, so the notation is clear in any case. When you open up the staves it might look like you want. Otherwise, it involves looking up 'beam-positions' in the manual, and tweaking. If you tweak the layout before all the notes are in, you and LilyPond are going to be second-guessing each other for a long time. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: m above beam in guitar notation
Hi Orm, hi Federico, Try : fis-3 \2 -\tweak X-offset #-.5 \RH #3 Cheers, Pierre ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: scheme problem: colored background, layers
Hum, interesting Klaus! I'll take a closer look today. Cheers, Pierre ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: m above beam in guitar notation
Oups, space's missing. So, again, try fis-3 \2 -\tweak X-offset #-.5 \RH #3 2014-12-02 7:21 GMT+01:00 Pierre Perol-Schneider pierre.schneider.pa...@gmail.com: Hi Orm, hi Federico, Try : fis-3 \2 -\tweak X-offset #-.5 \RH #3 Cheers, Pierre ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user