1 @c -*- coding: us-ascii; mode: texinfo; -*-
2 @node Documentation work
3 @chapter Documentation work
6 * Introduction to documentation work::
7 * Texinfo crash course::
8 * Documentation policy::
9 * Tips for writing docs::
10 * Updating docs with convert-ly::
11 * Translating the documentation::
15 @node Introduction to documentation work
16 @section Introduction to documentation work
18 Our documentation tries to adhere to our @ref{Documentation
19 policy}. This policy contains a few items which may seem odd.
20 One policy in particular is often questioned by potential
21 contributors: we do not repeat material in the Notation Reference,
22 and instead provide links to the @qq{definitive} presentation of
23 that information. Some people point out, with good reason, that
24 this makes the documentation harder to read. If we repeated
25 certain information in relevant places, readers would be less
26 likely to miss that information.
28 That reasoning is sound, but we have two counter-arguments.
29 First, the Notation Reference -- one of @emph{five} manuals for
30 users to read -- is already over 500 pages long. If we repeated
31 material, we could easily exceed 1000 pages! Second, and much
32 more importantly, LilyPond is an evolving project. New features
33 are added, bugs are fixed, and bugs are discovered and documented.
34 If features are discussed in multiple places, the documentation
35 team must find every instance. Since the manual is so large, it
36 is impossible for one person to have the location of every piece
37 of information memorized, so any attempt to update the
38 documentation will invariably omit a few places. This second
39 concern is not at all theoretical; the documentation used to be
40 plagued with inconsistent information.
42 If the documentation were targeted for a specific version -- say,
43 LilyPond 2.10.5 -- and we had unlimited resources to spend on
44 documentation, then we could avoid this second problem. But since
45 LilyPond evolves (and that is a very good thing!), and since we
46 have quite limited resources, this policy remains in place.
48 A few other policies (such as not permitting the use of tweaks in
49 the main portion of NR 1+2) may also seem counter-intuitive, but
50 they also stem from attempting to find the most effective use of
51 limited documentation help.
55 @node Texinfo crash course
56 @section Texinfo crash course
59 * Texinfo introduction::
60 * Sectioning commands::
61 * LilyPond formatting::
64 * Other text concerns::
68 @node Texinfo introduction
69 @subsection Texinfo introduction
71 The language is called texinfo; you can see its manual here:
72 @uref{http://www.gnu.org/software/texinfo/manual/texinfo/}
74 However, you don't need to read those docs. The most important
75 thing to notice is that text is text. If you see a mistake in the
76 text, you can fix it. If you want to change the order of
77 something, you can cut-and-paste that stuff into a new location.
79 @warning{Rule of thumb: follow the examples in the existing docs.
80 You can learn most of what you need to know from this; if you want
81 to do anything fancy, discuss it on @code{lilypond-devel} first.}
84 @node Sectioning commands
85 @subsection Sectioning commands
87 Most of the manual operates at the
95 level. Sections are created with
104 Please leave two blank lines above a @@node; this makes it
105 easier to find sections in texinfo.
108 Sectioning commands (@@node and @@section) must not appear
109 inside an @@ignore. Separate those commands with a space, ie @@n
115 @node LilyPond formatting
116 @subsection LilyPond formatting
121 Use two spaces for indentation in lilypond examples. (no
125 All text strings should be prefaced with #. LilyPond does
126 not strictly require this, but it is helpful to get users
127 accustomed to this scheme construct. ie @code{\set
128 Staff.instrumentName = #"cello"}
131 All engravers should have double-quotes around them:
134 \consists "Spans_arpeggio_engraver"
137 Again, LilyPond does not strictly require this, but it is a useful
141 Examples should end with a complete bar if possible.
144 If possible, only write one bar per line. The notes on each
145 line should be an independent line -- tweaks should occur on their
146 own line if possible. Bad:
149 \override textscript #'padding = #3 c1^"hi"
155 \override textscript #'padding = #3
160 Most LilyPond input should be produced with:
163 @@lilypond[verbatim,quote,relative=2]
170 @@lilypond[verbatim,quote,relative=1]
173 If you want to use \layout@{@} or define variables, use
176 @@lilypond[verbatim,quote]
179 In rare cases, other options may be used (or omitted), but ask first.
182 Inspirational headwords are produced with
185 @@lilypondfile[quote,ragged-right,line-width=16\cm,staffsize=16]
186 @{pitches-headword.ly@}
190 LSR snippets are linked with
193 @@lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
198 excepted in Templates, where `doctitle' may be omitted.
201 Avoid long stretches of input code. Noone is going to read
202 them in print. Please create a smaller example. (the smaller
203 example does not need to be minimal, however)
206 Specify durations for at least the first note of every bar.
209 If possible, end with a complete bar.
212 Comments should go on their own line, and be placed before
213 the line(s) to which they refer.
216 Add extra spaces around @{ @} marks; ie
219 not: \chordmode @{c e g@}
220 but instead: \chordmode @{ c e g @}
224 If you only have one bar per line, omit bar checks. If you
225 put more than one bar per line (not recommended), then include bar
229 If you want to work on an example outside of the manual (for
230 easier/faster processing), use this header:
234 #(define dump-extents #t)
236 line-width = 160\mm - 2.0 * 0.4\in
238 force-assignment = #""
239 line-width = #(- line-width (* mm 3.000000))
246 You may not change any of these values. If you are making an
247 example demonstrating special \paper@{@} values, contact the
248 Documentation Editor.
253 @node Text formatting
254 @subsection Text formatting
259 Lines should be less than 72 characters long. (I personally
260 recommend writing with 66-char lines, but don't bother modifying
267 Do not use spaces at the beginning of a line (except in
268 @@example or @@verbatim environments), and do not use more than a
269 single space between words. `makeinfo' copies the input lines
270 verbatim without removing those spaces.
273 Use two spaces after a period.
276 In examples of syntax, use @@var@{musicexpr@} for a music
280 Don't use @@rinternals@{@} in the main text. If you're
281 tempted to do so, you're probably getting too close to "talking
282 through the code". If you really want to refer to a context, use
283 @@code@{@} in the main text and @@rinternals@{@} in the @@seealso.
286 Variables or numbers which consist of a single character
287 (probably followed by a punctuation mark) should be tied properly,
288 either to the previous or the next word. Example:
291 The variable@@tie@{@}@@var@{a@} ...
295 To get consistent indentation in the DVI output it is better
296 to avoid the @@verbatim environment. Use the @@example
297 environment instead if possible, but without extraneous
298 indentation. For example, this
309 should be replaced with
320 where `@@example' starts the line (without leading spaces).
323 Do not compress the input vertically; this is, do not use
326 Beginning of logical unit
330 continuation of logical unit
337 Beginning of logical unit
344 continuation of logical unit
347 This makes it easier to avoid forgetting the `@@noindent'. Only
348 use @@noindent if the material is discussing the same material;
349 new material should simply begin without anything special on the
353 in @@itemize use @@item
354 on a separate line like this:
365 Do not use @@itemize @@bullet.
368 To get LilyPond version, use @@version@{@} (this does not work
369 inside LilyPond snippets). If you write "@@version@{@}" (enclosed
370 with quotes), or generally if @@version@{@} is not followed by a
371 space, tere will be an ugly line break in PDF output unless you
379 @@w@{"@@version@{@}"@}
386 @subsection Syntax survey
390 @@c - single line comments
391 "@@c NOTE:" is a comment which should remain in the final
392 version. (gp only command ;)
394 @@ignore ... @@end ignore - multi-line comment
397 @@cindex - General index. Please add as many as you can. Don't
398 capitalize the first word.
400 @@funindex - is for a \lilycommand.
403 @@example ... @@end ignore - example text that should be set as a
404 blockquote. Any @{@} must be escaped with @@@{ @}@@
408 B ... @@end itemize - for bulleted lists.
409 Do not compress vertically like this.
412 @@code@{@} - typeset in a tt-font. Use for actual lilypond code or
413 property/context names. If the name contains a space, wrap
414 the entire thing inside @@w@{@@code@{ @}@}.
416 @@notation@{@} - refers to pieces of notation, e.g.
417 "@@notation@{cres.@}". Also use to specific lyrics ("the
418 @@notation@{A - men@} is centered"). Only use once per subsection
421 @@q@{@} - Single quotes. Used for `vague' terms.
423 @@qq@{@} - Double quotes. Used for actual quotes ("he said") or for
424 introducing special input modes.
427 @@tie@{@} - Variables or numbers which consist of a single character
428 (probably followed by a punctuation mark) should be tied
429 properly, either to the previous or the next word. Example:
430 "The letter@@tie@{@}@@q@{I@} is skipped"
433 @@var - Use for variables.
435 @@warning@{@} - produces a "Note: " box. Use for important messages.
438 @@bs - Generates a backslash inside @@warning.
439 Any `\' used inside @@warning (and @@q or @@qq) must be written as `@@bs@{@}'
440 (texinfo would also allow \\, but this breaks with PDF output).
446 @node Other text concerns
447 @subsection Other text concerns
452 References must occur at the end of a sentence, for more
453 information see @@ref@{the texinfo manual@}. Ideally this should
454 also be the final sentence of a paragraph, but this is not
455 required. Any link in a doc section must be duplicated in the
456 @@seealso section at the bottom.
459 Introducing examples must be done with
462 . (ie finish the previous sentence/paragaph)
463 : (ie `in this example:')
464 , (ie `may add foo with the blah construct,')
467 The old "sentence runs directly into the example" method is not
471 Abbrevs in caps, e.g., HTML, DVI, MIDI, etc.
482 When beginning a quote: "So, he said,...".
484 This usage is rarer. Americans often just use a comma.
487 When adding a defining example at the end of a sentence.
492 Non-ASCII characters which are in utf-8 should be directly used;
493 this is, don't say `Ba@@ss@{@}tuba' but `Baßtuba'. This ensures
494 that all such characters appear in all output formats.
501 @node Documentation policy
502 @section Documentation policy
506 * Section organization::
507 * Checking cross-references::
509 * Technical writing style::
515 There are four parts to the documentation: the Learning Manual,
516 the Notation Reference, the Program Reference, and the Music
524 The LM is written in a tutorial style which introduces the most
525 important concepts, structure and syntax of the elements of a
526 LilyPond score in a carefully graded sequence of steps.
527 Explanations of all musical concepts used in the Manual can be
528 found in the Music Glossary, and readers are assumed to have no
529 prior knowledge of LilyPond. The objective is to take readers to
530 a level where the Notation Reference can be understood and
531 employed to both adapt the templates in the Appendix to their
532 needs and to begin to construct their own scores. Commonly used
533 tweaks are introduced and explained. Examples are provided
534 throughout which, while being focussed on the topic being
535 introduced, are long enough to seem real in order to retain the
536 readers' interest. Each example builds on the previous material,
537 and comments are used liberally. Every new aspect is thoroughly
538 explained before it is used.
540 Users are encouraged to read the complete Learning Manual from
545 Notation Reference: a (hopefully complete) description of LilyPond
546 input notation. Some material from here may be duplicated in the
547 Learning Manual (for teaching), but consider the NR to be the
548 "definitive" description of each notation element, with the LM
549 being an "extra". The goal is _not_ to provide a step-by-step
550 learning environment -- do not avoid using notation that has not
551 be introduced previously in the NR (for example, use \break if
552 appropriate). This section is written in formal technical writing
555 Avoid duplication. Although users are not expected to read this
556 manual from start to finish, they should be familiar with the
557 material in the Learning Manual (particularly ``Fundamental
558 Concepts''), so do not repeat that material in each section of
559 this book. Also watch out for common constructs, like ^ - _ for
560 directions -- those are explained in NR 3. In NR 1, you can
561 write: DYNAMICS may be manually placed above or below the staff,
562 see @@ref@{Controlling direction and placement@}.
564 Most tweaks should be added to LSR and not placed directly in the
565 .itely file. In some cases, tweaks may be placed in the main
566 text, but ask about this first.
568 Finally, you should assume that users know what the notation
569 means; explaining musical concepts happens in the Music Glossary.
573 Application Usage: information about using the program lilypond
574 with other programs (lilypond-book, operating systems, GUIs,
575 convert-ly, etc). This section is written in formal technical
578 Users are not expected to read this manual from start to finish.
582 Music Glossary: information about the music notation itself.
583 Explanations and translations about notation terms go here.
585 Users are not expected to read this manual from start to finish.
588 Internals Reference: not really a documentation book, since it is
589 automagically generated from the source, but this is its name.
594 @node Section organization
595 @subsection Section organization
600 The order of headings inside documentation sections should
613 You @emph{must} include a @@seealso.
617 The order of items inside the @@seealso section is
626 @@rlearning@{foozle@}.
636 @@file@{path/to/dir/blahz@}.
638 Snippets: @@rlsr@{section@}.
641 @@rinternals@{fazzle@},
642 @@rinternals@{booar@}.
646 If there are multiple entries, separate them by commas but do not
650 Always end with a period.
653 Place each link on a new line as above; this makes it much easier
654 to add or remove links. In the output, they appear on a single
657 ("Snippets" is REQUIRED; the others are optional)
660 Any new concepts or links which require an explanation should go
661 as a full sentence(s) in the main text.
664 Don't insert an empty line between @@seealso and the first entry!
665 Otherwise there is excessive vertical space in the PDF output.
670 To create links, use @@ref@{@} if the link is within the same
674 @@predefined ... @@endpredefined is for commands in ly/*-init.ly
678 Do not include any real info in second-level sections (ie 1.1
679 Pitches). A first-level section may have introductory material,
680 but other than that all material goes into third-level sections
681 (ie 1.1.1 Writing Pitches).
686 @node Checking cross-references
687 @subsection Checking cross-references
689 Cross-references between different manuals are heavily used in the
690 documentation, but they are not checked during compilation.
691 However, if you compile the documentation, a script called
692 check_texi_refs can help you with checking and fixing these
693 cross-references; for information on usage, cd into a source tree
694 where documentation has been built, cd into Documentation and look
695 for check-xrefs and fix-xrefs targets in 'make help' output. Note
696 that you have to find yourself the source files to fix
697 cross-references in the generated documentation such as the
698 Internals Reference; e.g. you can grep scm/ and lily/.
701 @node General writing
702 @subsection General writing
707 Do not forget to create @@cindex entries for new sections of text.
708 Enter commands with @@funindex, i.e.
711 @@cindex pitches, writing in different octaves
716 do not bother with the @@code@{@} (they are added automatically).
717 These items are added to both the command index and the unified
720 Both index commands should go in front of the actual material.
722 @@cindex entries should not be capitalized, ie
725 @@cindex time signature
729 is preferred instead of @qq{Time signature}, Only use capital
730 letters for musical terms which demand them, like D.S. al Fine.
732 For scheme functions, only include the final part, i.e.,
735 @@funindex modern-voice-cautionary
737 @@funindex #(set-accidental-style modern-voice-cautionary)
746 In general, use the American spellings. The internal lilypond
747 property names use this spelling.
750 List of specific terms:
754 simultaneous NOT concurrent
755 measure: the unit of music
756 bar line: the symbol delimiting a measure NOT barline
757 note head NOT notehead
758 chord construct NOT chord (when referring to <>)
766 @node Technical writing style
767 @subsection Technical writing style
769 These refer to the NR. The LM uses a more gentle, colloquial
775 Do not refer to LilyPond in the text. The reader knows what the
776 manual is about. If you do, capitalization is LilyPond.
779 If you explicitly refer to @q{lilypond} the program (or any other
780 command to be executed), write @code{@@command@{lilypond@}}.
783 Do not explicitly refer to the reader/user. There is no one else
784 besides the reader and the writer.
787 Avoid contractions (don't, won't, etc.). Spell the words out completely.
790 Avoid abbreviations, except for commonly used abbreviations of foreign
791 language terms such as etc. and i.e.
794 Avoid fluff (@qq{Notice that,} @qq{as you can see,}
798 The use of the word @q{illegal} is inappropriate in most cases.
799 Say @q{invalid} instead.
804 @node Tips for writing docs
805 @section Tips for writing docs
807 In the NR, I highly recommend focusing on one subsection at a
808 time. For each subsection,
813 check the mundane formatting. Are the headings (@@predefined,
814 @@seealso, etc.) in the right order?
817 add any appropriate index entries.
820 check the links in the @@seealso section -- links to music
821 glossary, internal references, and other NR sections are the main
822 concern. Check for potential additions.
825 move LSR-worthy material into LSR. Add the snippet, delete the
826 material from the .itely file, and add a @@lilypondfile command.
829 check the examples and descriptions. Do they still work?
830 @strong{Do not} assume that the existing text is
831 accurate/complete; some of the manual is highly out of date.
834 is the material in the @@knownissues still accurate?
837 can the examples be improved (made more explanatory), or is there
838 any missing info? (feel free to ask specific questions on -user;
839 a couple of people claimed to be interesting in being
840 @qq{consultants} who would help with such questions)
844 In general, I favor short text explanations with good examples --
845 @qq{an example is worth a thousand words}. When I worked on the
846 docs, I spent about half my time just working on those tiny
847 lilypond examples. Making easily-understandable examples is much
848 harder than it looks.
851 @subsubheading TWEAKS
853 In general, any \set or \override commands should go in the
854 @qq{select snippets} section, which means that they should go in
855 LSR and not the .itely file. For some cases, the command
856 obviously belongs in the @qq{main text} (i.e. not inside
857 @@predefined or @@seealso or whatever) -- instrument names are a
858 good example of this.
861 \set Staff.instrumentName = #"foo"
864 On the other side of this,
867 \override Score.Hairpin #'after-line-breaking = ##t
870 clearly belongs in LSR.
872 I'm quite willing to discuss specific cases if you think that a
873 tweaks needs to be in the main text. But items that can go into
874 LSR are easier to maintain, so I'd like to move as much as
878 It would be @qq{nice} if you spent a lot of time crafting nice
879 tweaks for users... but my recommendation is @strong{not} to do
880 this. There's a lot of doc work to do without adding examples of
881 tweaks. Tweak examples can easily be added by normal users by adding
884 One place where a documentation writer can profitably spend time writing
885 or upgrading tweaks is creating tweaks to deal with known issues. It
886 would be ideal if every significant known issue had a workaround to avoid
890 @node Updating docs with convert-ly
891 @section Updating doc with convert-ly
893 cd into Documentation and run
896 find . -name '*.itely' | xargs convert-ly -e
900 (This also updates translated docs.)
905 @node Translating the documentation
906 @section Translating the documentation