{"id":111,"date":"2009-01-22T20:07:40","date_gmt":"2009-01-23T00:07:40","guid":{"rendered":"http:\/\/eugenecormier.com\/blog\/2009\/01\/22\/99-revision-12\/"},"modified":"2014-02-04T22:46:14","modified_gmt":"2014-02-05T02:46:14","slug":"99-revision-12","status":"publish","type":"post","link":"https:\/\/eugenecormier.com\/?p=111","title":{"rendered":"Lilypond variables part 2 &#8211; different page layouts for parts and scores"},"content":{"rendered":"<p>&#8220;Necessity is the mother of invention&#8221;<\/p>\n<p>I&#8217;m typesetting a piece for 2 guitars and in the end I want to print off individual parts and a score. This can easily be achieved in Lilypond using the following method:<\/p>\n<ul>\n<li>First I create a file called &#8220;notes.ly&#8221; this is the file which will contain all the music. I make 2 variables called &#8220;classicalguitara&#8221; and &#8220;classicalguitarb&#8221; being the notes for each part<\/li>\n<li>next I make a file called &#8220;classicalguitar1.ly&#8221; and inside this file I include a statement to load the file with the notes in it and then I call for the first guitar part by it&#8217;s variable name:<br \/>\n<blockquote><p>\n\\include &#8220;notes.ly&#8221;<br \/>\n{ \\classicalguitara }\n<\/p><\/blockquote>\n<\/li>\n<li>I then repeat the process for the guitar 2 part with a file name &#8220;classicalguitar2.ly&#8221; containing the following code:<br \/>\n<blockquote><p>\n\\include &#8220;notes.ly&#8221;<br \/>\n{ \\classicalguitarb }\n<\/p><\/blockquote>\n<\/li>\n<li>And finally for the score I create a file called &#8220;score.ly&#8221; containing:<br \/>\n<blockquote><p>\n\\include &#8220;notes.ly&#8221;<br \/>\n{ << \t\\new Staff { \\guitara }\n\\new Staff { \\guitarb } >> }<\/p>\n<\/blockquote>\n<\/li>\n<\/ul>\n<p>Now for the real problem&#8230;.I need to have logical page breaks (which will happen in different places for the 2 guitar parts and the score). Now if I put in a page break into a single guitar part using the command:<\/p>\n<blockquote><p>\n\\pageBreak\n<\/p><\/blockquote>\n<p>then the score will break in the same place&#8230;.this will really be a problem when it comes to different page break locations for each of the parts&#8230;..there has got to be a good way to deal with this without constantly changing code for each individual part! And that&#8217;s when it came to me&#8230;.wonderful variables can save the day&#8230;..here&#8217;s the low down:<\/p>\n<p>Instead of using the page break command in the parts I use a variable called &#8220;partpagebreak&#8221;<br \/>\nthen in the individual guitar files (classicalguitar1.ly and classicalguitar2.ly) I add the following line:<\/p>\n<blockquote><p>partpagebreak = { \\pageBreak }<\/p><\/blockquote>\n<p>And in the score file (score.ly) I add the following line:<\/p>\n<blockquote><p>partpagebreak = { }<\/p><\/blockquote>\n<p>Now when I print the individual parts the command \\partpagebreak will be replaced with the command for a page break and when I print the score the same variable will be converted into an empty space&#8230;problem fixed&#8230;.different page layouts using the same code. Very cool!<\/p>\n<p>Note: If I actually wanted to have specified page breaks in the score I could easily create a variable called &#8220;scorepagebreaks&#8221; and that would do the trick<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;Necessity is the mother of invention&#8221; I&#8217;m typesetting a piece for 2 guitars and in the end I want to print off individual parts and a score. This can easily be achieved in Lilypond using the following method: First I create a file called &#8220;notes.ly&#8221; this is the file which will contain all the music. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":508,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-111","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-lilypond"],"_links":{"self":[{"href":"https:\/\/eugenecormier.com\/index.php?rest_route=\/wp\/v2\/posts\/111","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eugenecormier.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eugenecormier.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eugenecormier.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eugenecormier.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=111"}],"version-history":[{"count":2,"href":"https:\/\/eugenecormier.com\/index.php?rest_route=\/wp\/v2\/posts\/111\/revisions"}],"predecessor-version":[{"id":311,"href":"https:\/\/eugenecormier.com\/index.php?rest_route=\/wp\/v2\/posts\/111\/revisions\/311"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/eugenecormier.com\/index.php?rest_route=\/wp\/v2\/media\/508"}],"wp:attachment":[{"href":"https:\/\/eugenecormier.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eugenecormier.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eugenecormier.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}