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
58 The language is called texinfo; you can see its manual here:
59 @uref{http://www.gnu.org/software/texinfo/manual/texinfo/}
61 However, you don't need to read those docs. The most important
62 thing to notice is that text is text. If you see a mistake in the
63 text, you can fix it. If you want to change the order of
64 something, you can cut-and-paste that stuff into a new location.
66 @warning{Rule of thumb: follow the examples in the existing docs.
67 You can learn most of what you need to know from this; if you want
68 to do anything fancy, discuss it on @code{lilypond-devel} first.}
71 @subsection Sectioning commands
73 Most of the manual operates at the
81 level. Sections are created with
90 Please leave two blank lines above a @@node; this makes it
91 easier to find sections in texinfo.
94 Sectioning commands (@@node and @@section) must not appear
95 inside an @@ignore. Separate those commands with a space, ie @@n
102 @subsection LilyPond formatting
107 Use two spaces for indentation in lilypond examples. (no
111 All text strings should be prefaced with #. LilyPond does
112 not strictly require this, but it is helpful to get users
113 accustomed to this scheme construct. ie @code{\set
114 Staff.instrumentName = #"cello"}
117 All engravers should have double-quotes around them:
120 \consists "Spans_arpeggio_engraver"
123 Again, LilyPond does not strictly require this, but it is a useful
127 Examples should end with a complete bar if possible.
130 If possible, only write one bar per line. The notes on each
131 line should be an independent line -- tweaks should occur on their
132 own line if possible. Bad:
135 \override textscript #'padding = #3 c1^"hi"
141 \override textscript #'padding = #3
146 Most LilyPond input should be produced with:
149 @@lilypond[verbatim,quote,relative=2]
156 @@lilypond[verbatim,quote,relative=1]
159 If you want to use \layout@{@} or define variables, use
162 @@lilypond[verbatim,quote]
165 In rare cases, other options may be used (or omitted), but ask first.
168 Inspirational headwords are produced with
171 @@lilypondfile[quote,ragged-right,line-width=16\cm,staffsize=16]
172 @{pitches-headword.ly@}
176 LSR snippets are linked with
179 @@lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
184 excepted in Templates, where `doctitle' may be omitted.
187 Avoid long stretches of input code. Noone is going to read
188 them in print. Please create a smaller example. (the smaller
189 example does not need to be minimal, however)
192 Specify durations for at least the first note of every bar.
195 If possible, end with a complete bar.
198 Comments should go on their own line, and be placed before
199 the line(s) to which they refer.
202 Add extra spaces around @{ @} marks; ie
205 not: \chordmode @{c e g@}
206 but instead: \chordmode @{ c e g @}
210 If you only have one bar per line, omit bar checks. If you
211 put more than one bar per line (not recommended), then include bar
215 If you want to work on an example outside of the manual (for
216 easier/faster processing), use this header:
220 #(define dump-extents #t)
222 line-width = 160\mm - 2.0 * 0.4\in
224 force-assignment = #""
225 line-width = #(- line-width (* mm 3.000000))
232 You may not change any of these values. If you are making an
233 example demonstrating special \paper@{@} values, contact the
234 Documentation Editor.
239 @subsection Text formatting
244 Lines should be less than 72 characters long. (I personally
245 recommend writing with 66-char lines, but don't bother modifying
252 Do not use spaces at the beginning of a line (except in
253 @@example or @@verbatim environments), and do not use more than a
254 single space between words. `makeinfo' copies the input lines
255 verbatim without removing those spaces.
258 Use two spaces after a period.
261 In examples of syntax, use @@var@{musicexpr@} for a music
265 Don't use @@rinternals@{@} in the main text. If you're
266 tempted to do so, you're probably getting too close to "talking
267 through the code". If you really want to refer to a context, use
268 @@code@{@} in the main text and @@rinternals@{@} in the @@seealso.
271 Variables or numbers which consist of a single character
272 (probably followed by a punctuation mark) should be tied properly,
273 either to the previous or the next word. Example:
276 The variable@@tie@{@}@@var@{a@} ...
280 To get consistent indentation in the DVI output it is better
281 to avoid the @@verbatim environment. Use the @@example
282 environment instead if possible, but without extraneous
283 indentation. For example, this
294 should be replaced with
305 where `@@example' starts the line (without leading spaces).
308 Do not compress the input vertically; this is, do not use
311 Beginning of logical unit
315 continuation of logical unit
322 Beginning of logical unit
329 continuation of logical unit
332 This makes it easier to avoid forgetting the `@@noindent'. Only
333 use @@noindent if the material is discussing the same material;
334 new material should simply begin without anything special on the
338 in @@itemize use @@item
339 on a separate line like this:
350 Do not use @@itemize @@bullet.
353 To get LilyPond version, use @@version@{@} (this does not work
354 inside LilyPond snippets). If you write "@@version@{@}" (enclosed
355 with quotes), or generally if @@version@{@} is not followed by a
356 space, tere will be an ugly line break in PDF output unless you
364 @@w@{"@@version@{@}"@}
370 @subsection Syntax survey
374 @@c - single line comments
375 "@@c NOTE:" is a comment which should remain in the final
376 version. (gp only command ;)
378 @@ignore ... @@end ignore - multi-line comment
381 @@cindex - General index. Please add as many as you can. Don't
382 capitalize the first word.
384 @@funindex - is for a \lilycommand.
387 @@example ... @@end ignore - example text that should be set as a
388 blockquote. Any @{@} must be escaped with @@@{ @}@@
392 B ... @@end itemize - for bulleted lists.
393 Do not compress vertically like this.
396 @@code@{@} - typeset in a tt-font. Use for actual lilypond code or
397 property/context names. If the name contains a space, wrap
398 the entire thing inside @@w@{@@code@{ @}@}.
400 @@notation@{@} - refers to pieces of notation, e.g.
401 "@@notation@{cres.@}". Also use to specific lyrics ("the
402 @@notation@{A - men@} is centered"). Only use once per subsection
405 @@q@{@} - Single quotes. Used for `vague' terms.
407 @@qq@{@} - Double quotes. Used for actual quotes ("he said") or for
408 introducing special input modes.
411 @@tie@{@} - Variables or numbers which consist of a single character
412 (probably followed by a punctuation mark) should be tied
413 properly, either to the previous or the next word. Example:
414 "The letter@@tie@{@}@@q@{I@} is skipped"
417 @@var - Use for variables.
419 @@warning@{@} - produces a "Note: " box. Use for important messages.
422 @@bs - Generates a backslash inside @@warning.
423 Any `\' used inside @@warning (and @@q or @@qq) must be written as `@@bs@{@}'
424 (texinfo would also allow \\, but this breaks with PDF output).
430 @subsection Other text concerns
435 References must occur at the end of a sentence, for more
436 information see @@ref@{the texinfo manual@}. Ideally this should
437 also be the final sentence of a paragraph, but this is not
438 required. Any link in a doc section must be duplicated in the
439 @@seealso section at the bottom.
442 Introducing examples must be done with
445 . (ie finish the previous sentence/paragaph)
446 : (ie `in this example:')
447 , (ie `may add foo with the blah construct,')
450 The old "sentence runs directly into the example" method is not
454 Abbrevs in caps, e.g., HTML, DVI, MIDI, etc.
465 When beginning a quote: "So, he said,...".
467 This usage is rarer. Americans often just use a comma.
470 When adding a defining example at the end of a sentence.
475 Non-ASCII characters which are in utf-8 should be directly used;
476 this is, don't say `Ba@@ss@{@}tuba' but `Baßtuba'. This ensures
477 that all such characters appear in all output formats.
484 @node Documentation policy
485 @section Documentation policy
490 There are four parts to the documentation: the Learning Manual,
491 the Notation Reference, the Program Reference, and the Music
499 The LM is written in a tutorial style which introduces the most
500 important concepts, structure and syntax of the elements of a
501 LilyPond score in a carefully graded sequence of steps.
502 Explanations of all musical concepts used in the Manual can be
503 found in the Music Glossary, and readers are assumed to have no
504 prior knowledge of LilyPond. The objective is to take readers to
505 a level where the Notation Reference can be understood and
506 employed to both adapt the templates in the Appendix to their
507 needs and to begin to construct their own scores. Commonly used
508 tweaks are introduced and explained. Examples are provided
509 throughout which, while being focussed on the topic being
510 introduced, are long enough to seem real in order to retain the
511 readers' interest. Each example builds on the previous material,
512 and comments are used liberally. Every new aspect is thoroughly
513 explained before it is used.
515 Users are encouraged to read the complete Learning Manual from
520 Notation Reference: a (hopefully complete) description of LilyPond
521 input notation. Some material from here may be duplicated in the
522 Learning Manual (for teaching), but consider the NR to be the
523 "definitive" description of each notation element, with the LM
524 being an "extra". The goal is _not_ to provide a step-by-step
525 learning environment -- do not avoid using notation that has not
526 be introduced previously in the NR (for example, use \break if
527 appropriate). This section is written in formal technical writing
530 Avoid duplication. Although users are not expected to read this
531 manual from start to finish, they should be familiar with the
532 material in the Learning Manual (particularly ``Fundamental
533 Concepts''), so do not repeat that material in each section of
534 this book. Also watch out for common constructs, like ^ - _ for
535 directions -- those are explained in NR 3. In NR 1, you can
536 write: DYNAMICS may be manually placed above or below the staff,
537 see @@ref@{Controlling direction and placement@}.
539 Most tweaks should be added to LSR and not placed directly in the
540 .itely file. In some cases, tweaks may be placed in the main
541 text, but ask about this first.
543 Finally, you should assume that users know what the notation
544 means; explaining musical concepts happens in the Music Glossary.
548 Application Usage: information about using the program lilypond
549 with other programs (lilypond-book, operating systems, GUIs,
550 convert-ly, etc). This section is written in formal technical
553 Users are not expected to read this manual from start to finish.
557 Music Glossary: information about the music notation itself.
558 Explanations and translations about notation terms go here.
560 Users are not expected to read this manual from start to finish.
563 Internals Reference: not really a documentation book, since it is
564 automagically generated from the source, but this is its name.
569 @subsection Section organization
574 The order of headings inside documentation sections should
587 You @emph{must} include a @@seealso.
591 The order of items inside the @@seealso section is
600 @@rlearning@{foozle@}.
610 @@file@{path/to/dir/blahz@}.
612 Snippets: @@rlsr@{section@}.
615 @@rinternals@{fazzle@},
616 @@rinternals@{booar@}.
620 If there are multiple entries, separate them by commas but do not
624 Always end with a period.
627 Place each link on a new line as above; this makes it much easier
628 to add or remove links. In the output, they appear on a single
631 ("Snippets" is REQUIRED; the others are optional)
634 Any new concepts or links which require an explanation should go
635 as a full sentence(s) in the main text.
638 Don't insert an empty line between @@seealso and the first entry!
639 Otherwise there is excessive vertical space in the PDF output.
644 To create links, use @@ref@{@} if the link is within the same
648 @@predefined ... @@endpredefined is for commands in ly/*-init.ly
652 Do not include any real info in second-level sections (ie 1.1
653 Pitches). A first-level section may have introductory material,
654 but other than that all material goes into third-level sections
655 (ie 1.1.1 Writing Pitches).
660 @subsection Checking cross-references
662 Cross-references between different manuals are heavily used in the
663 documentation, but they are not checked during compilation.
664 However, if you compile the documentation, a script called
665 check_texi_refs can help you with checking and fixing these
666 cross-references; for information on usage, cd into a source tree
667 where documentation has been built, cd into Documentation and look
668 for check-xrefs and fix-xrefs targets in 'make help' output. Note
669 that you have to find yourself the source files to fix
670 cross-references in the generated documentation such as the
671 Internals Reference; e.g. you can grep scm/ and lily/.
674 @subsection General writing
679 Do not forget to create @@cindex entries for new sections of text.
680 Enter commands with @@funindex, i.e.
683 @@cindex pitches, writing in different octaves
688 do not bother with the @@code@{@} (they are added automatically).
689 These items are added to both the command index and the unified
692 Both index commands should go in front of the actual material.
694 @@cindex entries should not be capitalized, ie
697 @@cindex time signature
701 is preferred instead of @qq{Time signature}, Only use capital
702 letters for musical terms which demand them, like D.S. al Fine.
704 For scheme functions, only include the final part, ie
707 @@funindex modern-voice-cautionary
709 @@funindex #(set-accidental-style modern-voice-cautionary)
718 In general, use the American spellings. The internal lilypond
719 property names use this spelling.
722 List of specific terms:
726 simultaenous NOT concurrent
727 measure: the unit of music
728 bar line: the symbol delimiting a measure NOT barline
729 note head NOT notehead
730 chord construct NOT chord (when referring to <>)
736 @subsection Technical writing style
738 These refer to the NR. The LM uses a more gentle, colloquial
744 Do not refer to LilyPond in the text. The reader knows what the
745 manual is about. If you do, capitalization is LilyPond.
748 If you explicitly refer to @q{lilypond} the program (or any other
749 command to be executed), write @code{@@command@{lilypond@}}.
752 Do not explicitly refer to the reader/user. There is no one else
753 besides the reader and the writer.
756 Do not use abbreviations (don't, won't, etc.). If you do, use a
760 blabla blabla, i.e., blabla blabla
764 Avoid fluff (@qq{Notice that,} @qq{as you can see,}
768 The use of the word @q{illegal} is inappropriate in most cases.
769 Say @q{invalid} instead.
774 @node Tips for writing docs
775 @section Tips for writing docs
777 In the NR, I highly recommend focusing on one subsection at a
778 time. For each subsection,
783 check the mundane formatting. Are the headings (@@predefined,
784 @@seealso, etc) in the right order?
787 add any appropriate index entries.
790 check the links in the @@seealso section -- links to music
791 glossary, internal references, and other NR sections are the main
792 concern. Check for potential additions.
795 move LSR-worthy material into LSR. Add the snippet, delete the
796 material from the .itely file, and add a @@lilypondfile command.
799 check the examples and descriptions. Do they still work?
800 @strong{Do not} assume that the existing text is
801 accurate/complete; some of the manual is highly out of date.
804 is the material in the @@knownissues still accurate?
807 can the examples be improved (made more explanatory), or is there
808 any missing info? (feel free to ask specific questions on -user;
809 a couple of people claimed to be interesting in being
810 @qq{consultants} who would help with such questions)
814 In general, I favor short text explanations with good examples --
815 @qq{an example is worth a thousand words}. When I worked on the
816 docs, I spent about half my time just working on those tiny
817 lilypond examples. Making easily-understandable examples is much
818 harder than it looks.
821 @subsubheading TWEAKS
823 In general, any \set or \override commands should go in the
824 @qq{select snippets} section, which means that they should go in
825 LSR and not the .itely file. For some cases, the command
826 obviously belongs in the @qq{main text} (i.e. not inside
827 @@predefined or @@seealso or whatever) -- instrument names are a
828 good example of this.
831 \set Staff.instrumentName = #"foo"
834 On the other side of this,
837 \override Score.Hairpin #'after-line-breaking = ##t
840 clearly belongs in LSR.
842 I'm quite willing to discuss specific cases if you think that a
843 tweaks needs to be in the main text. But items that can go into
844 LSR are easier to maintain, so I'd like to move as much as
848 It would be @qq{nice} if you spent a lot of time crafting nice
849 tweaks for users... but my recommendation is @strong{not} to do
850 this. There's a lot of doc work to do without adding examples of
851 tweaks. Tweak examples are trivial to added by normal users.
854 @node Updating docs with convert-ly
855 @section Updating doc with convert-ly
857 cd into Documentation and run
860 find . -name '*.itely' | xargs convert-ly -e
864 (This also updates translated docs.)
869 @node Translating the documentation
870 @section Translating the documentation