lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Controlling the very first bit of "preferatory" spacing?


From: Trevor Bača
Subject: Re: Controlling the very first bit of "preferatory" spacing?
Date: Thu, 15 Feb 2007 13:20:59 -0600

On 2/15/07, Maximilian Albert <address@hidden> wrote:
Trevor Bača schrieb:

> Hi Max,
>
> Check chapter 11.4 in the next couple of days for a substantial
> expansion of the proportional docs, which goes into a considerable
> amount of detail on all of these settings, complete with pairs of
> contrasting examples.

Am I correct to suppose that these changes are penned by you? In any
case, I would like to thank you (probably on behalf of a lot of other
users as well) for pointing out so many useful facts in recent mails
(very aptly put at that) and especially for the amount of work you have
recently invested in clearing up and expanding certain parts of the
documentation. Thanks!

Thanks, Max. Yeah, I've just finished up a lot of writing on vertical
spacing and proportional notation (which is really a type of
horizontal spacing).

You're right that I've been on the list a lot recently. I'm between
pieces right now for a couple of days and I figured that maybe
updating the docs and answering some questions would be a good way to
give back to the project a little bit. I've gotten an incredible
amount of help from everybody on the list now for almost two years,
and my last two scores wouldn't be what they are without lots of input
from Mats, Graham, Han-Wen, and everyone.

FWIW, I thought maybe initially I would tackle a rewrite of all of
chapter 11, but I got (kinda) confounded trying to straighten out the
different settings in \paper and \layout, and so I contented myself
with the vertical and horizontal spacing stuff.

But FWIW, I think I can now explain the following question, which had
eluded me for a long time:

Question: The indent setting works in *either* a \layout block or a
\paper block. The horizontal-shift setting works *only* in a \paper
block. Why?

(And the at-home audience is invited to try answering this question
before reading on. This is an excellent check to see if you understand
this particular part of the program's structure.)



< scroll down for spoiler >






OK, intuitively would certainly wouldn't think that indent and
horizontal-shift are somehow structurally different. One moves the
first system to the right. The other moves all systems to the right.
But they are structurally different.

The first observation is that ALL of the \layout and \paper settings
that we use (like indent, horizontal-shift, ragged-right,
ragged-bottom, between-system-padding, all that stuff) can go into a
\paper block. Surprised? Try running some tests on sample files. If
you're used to thinking that indent "belongs" in a \layout block, it
can be a surprise to find out that indent can just as happily live in
a \paper block.

(The meanings of indent in \layout versus \paper differ, but we'll get
to that in a moment.)

The second observation is that only a "special subset" of the \layout
and \paper settings that we use can go in a \layout block. An example
of such a \layout-allowable setting is indent.

So this means that \layout is a much more exclusive club that \paper
-- \paper will let almost anybody in, but \layout is really picky.

(Equivalently, \layout settings are a true subset of \paper settings.)

So what makes \layout picky? In order to work in a \layout block, a
setting must be *able to change from one score to the next score to
the next*. Thinking about indent, it is certainly possible to stick
three short scores on a page and have the first one be indented 0, the
second one be indented 50,  and the third one be indented 100.

%%% BEGIN %%%

\version "2.11.18"

\score {
  \repeat unfold 20 { c'4 c'4 c'4 c'4 }
  \layout { indent = #0 }
}

\score {
  \repeat unfold 20 { c'4 c'4 c'4 c'4 }
  \layout { indent = #50 }
}

\score {
  \repeat unfold 20 { c'4 c'4 c'4 c'4 }
  \layout { indent = #100 }
}

%%% END %%%

This intputfile makes perfect sense and renders great. And this makes
our point that indent can vary from one score to the next score to the
next score, even with all three scores sharing a single page.

Now consider horizontal-shift. Can horizontal-shift vary from one
score to the next to the next with all scores sharing a page? No. By
definition, that is impossible because horizontal-shift is defined as
affecting *all systems of music on a page*. If one page of ouput has 6
sytstems, then horizontal-shift will shift all 6 systems no matter
whether all 6 systems belong to one score, to two scores, to three
scores, or to more scores.

Therefore it makes no sense whatsoever to have an input file like this:

%%% BEGIN %%%

\version "2.11.18"

\score {
  \repeat unfold 20 { c'4 c'4 c'4 c'4 }
  \layout { horizontal-shift = #0 }
}

\score {
  \repeat unfold 20 { c'4 c'4 c'4 c'4 }
  \layout { horizontal-shift = #50 }
}

\score {
  \repeat unfold 20 { c'4 c'4 c'4 c'4 }
  \layout { horizontal-shift = #100 }
}

%%% END %%%

This inputfile makes no sense. But -- quite unfortunately -- the file
compiles without issuing a warning. You should try running the file.
Because it compiles but the horizontal-shift settings do absolutely
nothing.

[Comment to Gurus - I think it would be vastly helpful if Lily would
puke book-level settings like horizontal-shift being put in
score-level \layout blocks. I think this would help the learnability
of what can go into \layout and what can't considerably.

Same for mis-typed engraver names, BTW. The silent-fail on \remove
Seperating_line_group_engraver is lethally dangerous.]

So how do you get horizontal-shift to do something? Put it in a \paper block.

%%% BEGIN %%%

\version "2.11.18"

\paper { horizontal-shift = #50 }

\score {
  \repeat unfold 20 { c'4 c'4 c'4 c'4 }
  \layout { }
}

\score {
  \repeat unfold 20 { c'4 c'4 c'4 c'4 }
  \layout { }
}

\score {
  \repeat unfold 20 { c'4 c'4 c'4 c'4 }
  \layout { }
}

%%% END %%%

Now the file both compiles without a warning *and*, crucially, makes sense.

Probably the best way, in the end, to describe why indent works in a
\layout block while horizontal-shift doesn't is to describe indent as
a "score-level" setting and instead describe horizontal-shift as a
"book-level" setting. This makes even more sense when we remember that
every LilyPond inputfile has at least one \book block, at least
implicitly. This means that the example immediately above is really
shorthand for this:

%%% BEGIN %%%

\version "2.11.18"

\book {

  \paper { horizontal-shift = #50 }

  \score {
     \repeat unfold 20 { c'4 c'4 c'4 c'4 }
     \layout { }
  }

  \score {
     \repeat unfold 20 { c'4 c'4 c'4 c'4 }
     \layout { }
  }

  \score {
     \repeat unfold 20 { c'4 c'4 c'4 c'4 }
     \layout { }
  }

}

%%% END %%%

Now it's quite clear that horizontal-shift is a "book-level" setting.
And it's also quite clear that indent is a "score-level" setting.

And probably the reason a lot of us never realized this is that we've
worked primarily with only one score per inputfile. If you work that
way, such that there's only one score in your inputfile, and I bet a
lot of us do, then, crucially, *all book-level settings are really
just score-level settings anyway*.

This is, after all, what Han-Wen was getting at a couple of days ago
in the labels "inside-of-score stuff" and "outside-of-score stuff".

In the end I think Han-Wen is right that the naming of \layout and
\paper is unfortunate. All the settings in \layout and \paper are very
clearly "page layout" settings, which clashes verbally with both the
reserved words "\layout" and "\paper". Maybe the following two slight
changes would help:

1. Rename \layout and \paper to \score-layout and \book-layout,
respectively. This will force "single-score" users to be aware that
there's this \book construct that they never explicitly use. BUT it
has the tremendous improvement of explaining why some page layout
settings live in one place and not the other.

2. Allow no \book-layout settings in a \score-layout block at all (as
they are ineffectual anyway). This will make clear that there *is* a
distinction between the two blocks, which is hidden now by the silent
pass-overs.

3. Keep the allowable (scoped) positions of the newly renamed
\score-layout and \book-layout exactly the same as they are now. That
is, \score-layout will be able to live at any of three levels of scope
-- inside a single score (affecting only that score), or inside a book
(providing defaults for all scores living inside that book), or at
toplevel (providing defaults for all scores living inside all books
living inside that inputfile). Likewise, \book-layout would be able to
live at any of two levels of scope -- inside a book (affecting just
that one book), or at toplevel (providing defaults for all books
living inside that inputfile).


--
Trevor Bača
address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]