]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/snippets/consistently-left-aligned-bar-numbers.ly
Imported Upstream version 2.16.0
[lilypond.git] / Documentation / snippets / consistently-left-aligned-bar-numbers.ly
diff --git a/Documentation/snippets/consistently-left-aligned-bar-numbers.ly b/Documentation/snippets/consistently-left-aligned-bar-numbers.ly
new file mode 100644 (file)
index 0000000..46e8677
--- /dev/null
@@ -0,0 +1,55 @@
+%% DO NOT EDIT this file manually; it is automatically
+%% generated from LSR http://lsr.dsi.unimi.it
+%% Make any changes in LSR itself, or in Documentation/snippets/new/ ,
+%% and then run scripts/auxiliar/makelsr.py
+%%
+%% This file is in the public domain.
+\version "2.16.0"
+
+\header {
+  lsrtags = "rhythms"
+
+  texidoc = "
+When left aligning bar numbers, overlapping problems may occur with
+Staves brackets. The snippet solves this by keeping right aligned the
+first bar number following line breaks.
+
+"
+  doctitle = "Consistently left aligned bar numbers"
+} % begin verbatim
+
+consistentlyLeftAlignedBarNumbers = {
+  \override Score.BarNumber #'break-visibility = #end-of-line-invisible
+  \override Score.BarNumber #'self-alignment-X =
+    #(lambda (grob)
+       (let ((break-dir (ly:item-break-dir grob)))
+         (if (= break-dir RIGHT) RIGHT LEFT)))
+}
+
+\new ChoirStaff <<
+  \new Staff {
+    \relative c' {
+      \set Score.barNumberVisibility = #(every-nth-bar-number-visible 3)
+      \bar ""
+      \consistentlyLeftAlignedBarNumbers
+
+      \set Score.currentBarNumber = #112
+      \repeat unfold 8 { R1 }
+      \break
+      \repeat unfold 9 { R1 }
+      \break
+      \repeat unfold 7 { R1 }
+    }
+  }
+  \new Staff {
+    \relative c' {
+      \repeat unfold 24 { R1 }
+    }
+  }
+>>
+
+\layout {
+  indent = #0
+  ragged-right = ##t
+  ragged-last = ##t
+}