Place dynamic marking under bar line (move dynamics horizontally) - lilypond

I want to create a crescendo that extends over two measures.
The following code
\relative c'
{
c4\pp\< c4 c4 c4 | c1\ff
}
compiles to
which is almost what I want. However, I would like the ff markings to appear further to the right, directly under the very next bar line, to indicate that the last whole tone should have a gradual increase in volume as well.
How can I achieve this?

You could use spacer rests to "move" the fortissimo to the end of the second bar:
\relative c'
{
c4\pp\< c4 c4 c4 |
<< c1 { s2. s4\ff } >>
}
This results in:

Related

how to show symbols on top of LilyPond scores?

Santa offered a toy keyboard to my 4-year-old. He enjoys the provided scores, but I'd like to add some songs that we sing together and that are not included in the basic set. Every Key has a symbol (circle, triangle, square) and a color (blue, yellow, purple, red, orange) that is displayed on top of the music score, to help him figure out which keys to press.
I'm not a musician, but I do have a basic understanding on how to write music scores. I've never used lilypond, but I'm a developer and I know latex.
I tried searching for a way to add extra symbols, but I'm not sure this is feasible.
You can draw theses symbols by using some of the various graphics commands found on this page:
https://lilypond.org/doc/v2.24/Documentation/notation/graphic
Store these as markup macros at the top of the LilyPond file, and then call them in the score at the appropriate places.
\version "2.24.0"
blueTriangle = \markup {
\left-align
\with-color "blue"
\triangle ##t
}
orangeCircle = \markup {
\left-align
\with-color "orange"
\draw-circle #1 #0 ##t
}
purpleCircle = \markup {
\left-align
\with-color "purple"
\draw-circle #1 #0 ##t
}
greenSquare = \markup {
\left-align
\with-color "green"
\filled-box #'(0 . 2) #'(0 . 2) #0
}
\new Staff {
g4^\blueTriangle
d'^\orangeCircle
b'^\purpleCircle
f''^\greenSquare
}
This will be a bit tedious if you are placing a symbol above every note. But if you know Scheme you can probably devise a function that reads the note letters and octaves and places the correct symbol in automatically.

Lilypond: Variable page break penalty

In my use of Lilypond, I often face the same kind of problems: Say I have four scores (3-4 lines each) that fit in two pages but not necessarily in one.
I refuse to have page breaks within scores. If possible, I want all the scores on the same page. When it's not possible however, I would like the page break to occur between the first and second scores. If that is not possible either, between the second and the third. And only if that's really necessary between the third and the fourth. That is, by order of preference, | representing the page break:
1 2 3 4 |
1 | 2 3 4
1 2 | 3 4
1 2 3 | 4
Is there a way to achieve that without trying and adding the page breaks myself? Maybe by having page-break penalties going in increasing order after each score (but remaining smaller than the penalty for adding a new page)?
Thank you by advance for your help.
You should use ly:page-turn-breaking (see Optimal page turning in the documentation). You'll probably have to play also with \pageTurn, \noPageTurn, \allowPageTurn in order to have the best control.
Here's a minimal example:
\version "2.19.82"
\header {
title = "Page turn breaking"
}
\paper {
% The default page breaking will make Score 1 end at beginning of page 2.
% The following option prevents this and keeps Score 1 all in the first page.
page-breaking = #ly:page-turn-breaking
}
\score {
\header { piece = "Score 1" }
\new Staff {
\clef "treble_8"
\repeat unfold 14 { c'1*4 }
}
\layout {
indent = 0
system-count = 14
}
}
\score {
\header { piece = "Score 2" }
\new Staff {
\clef "treble_8"
\repeat unfold 13 { e'2 f }
}
\layout {
indent = 0
system-count = 13
}
}

Two-axis table layout with css-grid

Resources like complete-guide-to-grid on css-tricks or grid by example are wonderful, yet I cannot figure out how to build a two-axis table layout.
The data for this layout is a simple weekly schedule, where each day has a 0-n categories and each category has 0-n dishes. The data looks something like this (pseudo-code):
DAY: { CATEGORY: [DISH] }
e.g.
monday: { a: [1, 2], b: [6], d: [5] },
tuesday: { b: [25], e: [0] },
...
friday: { a: [10], b: [9] },
The layout should look like this (note the empty top-left corner):
. MO TU WE TH FR
A a1 a10
a2
B b6 b25 b9
D d5
Now, having spent years nesting divs to build layouts, I attempted to design this "layout-in", as is the mantra of css-grid, structuring the html in a way that is decoupled from the target-layout. See this codepen for an example structure.
My first attempt was using grid-areas, like this:
.grid {
grid-template-areas:
". 1 2 3 4 5"
"a a1 a2 a3 a4 a5"
"b b1 b2 b3 b4 b5";
// ...
}
This "works", but now I have to create a class for every single cell in the table, which is silly.
Then I tried to create areas for each axis and one for the center cells:
.grid {
grid-template-areas:
". n n n n n"
"s x x x x x";
}
This does not work. Assigning x to each cell just stacks them on top of each other in the first x column/row, same thing with n up top. Also, the pattern does not repeat, so we end up with only two rows.
Then I thought about nesting grids, adding another grid under n and x. But this defeats the "layout-in" promise, so I decided against it.
I believe I either fundamentally misunderstand areas, or what I am trying to do is not possible without nesting grids. Any input, or an example two-axis layout using css-grid would be greatly appreciated!
Since you're working with tabular data a <table> element might be more appropriate than trying to use css grid.

Multiple dynamic markings under one note

I am working with Lilypond and can't figure out how to place two dynamic markings under a whole note. I want it to start piano and then become forte but I don't want to use a crescendo. I'd also rather not indicate two tied half notes. Just p then f under a whole note. This is common in older notation which I am typesetting. Thank you.
You can add one single markup that contains multiple elements to a single note:
\version "2.18.2"
{
f'1 _\markup { \dynamic { f p } }
}
There's an example in the Notation Reference, where it says: "Spacer rests are needed to engrave multiple marks on one note."
If you adapt it to your case, you might write:
\version "2.18.2"
{
R1 |
<< f'1\p { s1\f } >> |
}
However, this triggers the following warning:
warning: Two simultaneous absolute-dynamic events, junking this one
and only the first dynamic mark is printed.
So you must place the second dynamic mark on a different musical moment:
\version "2.18.2"
{
R1 |
<< f'1\p { s4. s16\f s s2 } >> |
}

How to anchor the first HTML child to the left and the last one - to the right

Please, consider the following trivial example: http://jsfiddle.net/mark69_fnd/vtLrt/
As you can see, it prints:
A1 B1
A2 B2
A3 B3 C3 D3 E3 F3 G3
What I would like to see is:
A1 B1
A2 B2
A3 B3 C3 D3 E3 F3 G3
I.e. the first element is anchored to the left (A1, A2, A3) and the last one - to the right (B1, B2, G3).
Can I do it without JS?
Edit: you said you want B1, B2, B3 to the extreme right, but your example shows something different
Just give float: right; to .anchorToRight
Demo
CSS
.anchorToRight {
float: right;
}
I have seen you have added class anchorToRight. Float this class to right.
.anchorToRight{
float:right;
}
Hi now Define your Class .char.anchortoRight in your css float : right
As like this
.char.anchorToRight{
float:right;
}
Live demo
Add this css into your css file.
.anchorToRight{
float:right;
}