]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/devel/doc-work.itexi
Merge branch 'master' of ssh://gpercival@git.sv.gnu.org/srv/git/lilypond
[lilypond.git] / Documentation / devel / doc-work.itexi
1 @c -*- coding: us-ascii; mode: texinfo; -*-
2 @node Documentation work
3 @chapter Documentation work
4
5 @menu
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::  
12 @end menu
13
14
15 @node Introduction to documentation work
16 @section Introduction to documentation work
17
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.
27
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.
41
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.
47
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.
52
53
54
55 @node Texinfo crash course
56 @section Texinfo crash course
57
58 The language is called texinfo; you can see its manual here:
59 @uref{http://www.gnu.org/software/texinfo/manual/texinfo/}
60
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.
65
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.}
69
70
71 @subsection Sectioning commands
72
73 Most of the manual operates at the
74
75 @example
76 @@node Foo
77 @@subsubsection Foo
78 @end example
79
80 @noindent
81 level.  Sections are created with
82
83 @example
84 @@node Foo
85 @@subsection Foo
86 @end example
87
88 @itemize
89 @item
90 Please leave two blank lines above a @@node; this makes it
91 easier to find sections in texinfo.
92
93 @item
94 Sectioning commands (@@node and @@section) must not appear
95 inside an @@ignore.  Separate those commands with a space, ie @@n
96 ode.
97
98 @end itemize
99
100
101
102 @subsection LilyPond formatting
103
104 @itemize
105
106 @item
107 Use two spaces for indentation in lilypond examples.  (no
108 tabs)
109
110 @item
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"}
115
116 @item
117 All engravers should have double-quotes around them:
118
119 @example
120 \consists "Spans_arpeggio_engraver"
121 @end example
122
123 Again, LilyPond does not strictly require this, but it is a useful
124 standard to follow.
125
126 @item
127 Examples should end with a complete bar if possible.
128
129 @item
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:
133
134 @example
135 \override textscript #'padding = #3 c1^"hi"
136 @end example
137
138 Good:
139
140 @example
141 \override textscript #'padding = #3
142 c1^"hi"
143 @end example
144
145 @item
146 Most LilyPond input should be produced with:
147
148 @example
149 @@lilypond[verbatim,quote,relative=2]
150 @end example
151
152 @noindent
153 or
154
155 @example
156 @@lilypond[verbatim,quote,relative=1]
157 @end example
158
159 If you want to use \layout@{@} or define variables, use
160
161 @example
162 @@lilypond[verbatim,quote]
163 @end example
164
165 In rare cases, other options may be used (or omitted), but ask first.
166
167 @item
168 Inspirational headwords are produced with
169
170 @example
171 @@lilypondfile[quote,ragged-right,line-width=16\cm,staffsize=16]
172 @{pitches-headword.ly@}
173 @end example
174
175 @item
176 LSR snippets are linked with
177
178 @example
179 @@lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
180 @{filename.ly@}
181 @end example
182
183 @noindent
184 excepted in Templates, where `doctitle' may be omitted.
185
186 @item
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)
190
191 @item
192 Specify durations for at least the first note of every bar.
193
194 @item
195 If possible, end with a complete bar.
196
197 @item
198 Comments should go on their own line, and be placed before
199 the line(s) to which they refer.
200
201 @item
202 Add extra spaces around @{ @} marks; ie
203
204 @example
205 not:          \chordmode @{c e g@}
206 but instead:  \chordmode @{ c e g @}
207 @end example
208
209 @item
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
212 checks.
213
214 @item
215 If you want to work on an example outside of the manual (for
216 easier/faster processing), use this header:
217
218 @example
219 \paper @{
220   #(define dump-extents #t)
221   indent = 0\mm
222   line-width = 160\mm - 2.0 * 0.4\in
223   ragged-right = ##t
224   force-assignment = #""
225   line-width = #(- line-width (* mm  3.000000))
226 @}
227
228 \layout @{
229 @}
230 @end example
231
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.
235
236 @end itemize
237
238
239 @subsection Text formatting
240
241 @itemize
242
243 @item
244 Lines should be less than 72 characters long.  (I personally
245 recommend writing with 66-char lines, but don't bother modifying
246 existing material.)
247
248 @item
249 Do not use tabs.
250
251 @item
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.
256
257 @item
258 Use two spaces after a period.
259
260 @item
261 In examples of syntax, use @@var@{musicexpr@} for a music
262 expression.
263
264 @item
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.
269
270 @item
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:
274
275 @example
276 The variable@@tie@{@}@@var@{a@} ...
277 @end example
278
279 @item
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
284
285 @example
286 @@example
287   foo @{
288     bar
289   @}
290 @@end example
291 @end example
292
293 @noindent
294 should be replaced with
295
296 @example
297 @@example
298 foo @{
299   bar
300 @}
301 @@end example
302 @end example
303
304 @noindent
305 where `@@example' starts the line (without leading spaces).
306
307 @item
308 Do not compress the input vertically; this is, do not use
309
310 @example
311     Beginning of logical unit
312     @@example
313     ...
314     @@end example
315     continuation of logical unit
316 @end example
317
318 @noindent
319 but instead do
320
321 @example
322 Beginning of logical unit
323
324 @@example
325 ...
326 @@end example
327
328 @@noindent
329 continuation of logical unit
330 @example
331
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
335 line above it.
336
337 @item
338 in @@itemize use @@item
339 on a separate line like this:
340
341 @example
342 @@itemize
343 @@item
344 Foo
345
346 @@item
347 Bar
348 @end example
349
350 Do not use @@itemize @@bullet.
351
352 @item
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
357 enclose it with
358
359 @example
360 @@w@{ ... @}
361
362   e.g.
363
364 @@w@{"@@version@{@}"@}
365 @end example
366
367 @end itemize
368
369
370 @subsection Syntax survey
371
372 @itemize
373 @item
374 @@c - single line comments
375   "@@c NOTE:" is a comment which should remain in the final
376   version.  (gp only command ;)
377 @item
378 @@ignore ... @@end ignore - multi-line comment
379
380 @item
381 @@cindex - General index. Please add as many as you can.  Don't
382   capitalize the first word.
383 @item
384 @@funindex - is for a \lilycommand.
385
386 @item
387 @@example ... @@end ignore - example text that should be set as a
388   blockquote.  Any @{@} must be escaped with @@@{ @}@@
389 @item
390 @@itemize @@item
391 A @@item
392 B ... @@end itemize - for bulleted lists.
393   Do not compress vertically like this.
394
395 @item
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@{  @}@}.
399 @item
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
403   per term.
404 @item
405 @@q@{@} - Single quotes. Used for `vague' terms.
406 @item
407 @@qq@{@} - Double quotes.  Used for actual quotes ("he said") or for
408   introducing special input modes.
409
410 @item
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"
415
416 @item
417 @@var - Use for variables.
418 @item
419 @@warning@{@} - produces a "Note: " box. Use for important messages.
420
421 @item
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).
425
426 @end itemize
427
428
429
430 @subsection Other text concerns
431
432 @itemize
433
434 @item
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.
440
441 @item
442 Introducing examples must be done with
443
444 @example
445      . (ie finish the previous sentence/paragaph)
446      : (ie `in this example:')
447      , (ie `may add foo with the blah construct,')
448 @end example
449
450 The old "sentence runs directly into the example" method is not
451 allowed any more.
452
453 @item
454 Abbrevs in caps, e.g., HTML, DVI, MIDI, etc.
455
456 @item
457 Colon usage
458
459 @enumerate
460
461 @item
462 To introduce lists
463
464 @item
465 When beginning a quote: "So, he said,...".
466
467 This usage is rarer.  Americans often just use a comma.
468
469 @item
470 When adding a defining example at the end of a sentence.
471
472 @end enumerate
473
474 @item
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.
478
479 @end itemize
480
481
482
483
484 @node Documentation policy
485 @section Documentation policy
486
487
488 @subsection Books
489
490 There are four parts to the documentation: the Learning Manual,
491 the Notation Reference, the Program Reference, and the Music
492 Glossary.
493
494 @itemize
495
496 @item
497 Learning Manual:
498
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.
514
515 Users are encouraged to read the complete Learning Manual from
516 start-to-finish.
517
518
519 @item
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
528 style.
529
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@}.
538
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.
542
543 Finally, you should assume that users know what the notation
544 means; explaining musical concepts happens in the Music Glossary.
545
546
547 @item
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
551 writing style.
552
553 Users are not expected to read this manual from start to finish.
554
555
556 @item
557 Music Glossary: information about the music notation itself.
558 Explanations and translations about notation terms go here.
559
560 Users are not expected to read this manual from start to finish.
561
562 @item
563 Internals Reference: not really a documentation book, since it is
564 automagically generated from the source, but this is its name.
565
566 @end itemize
567
568
569 @subsection Section organization
570
571 @itemize
572
573 @item
574 The order of headings inside documentation sections should
575 be:
576
577 @example
578 main docs
579 @@predefined
580 @@endpredefined
581 @@snippets
582 @@seealso
583 @@knownissues
584 @end example
585
586 @item
587 You @emph{must} include a @@seealso.
588
589 @itemize
590 @item
591 The order of items inside the @@seealso section is
592
593 @example
594 Music Glossary:
595 @@rglos@{foo@},
596 @@rglos@{bar@}.
597
598 Learning Manual:
599 @@rlearning@{baz@},
600 @@rlearning@{foozle@}.
601
602 Notation Reference:
603 @@ruser@{faazle@},
604 @@ruser@{boo@}.
605
606 Application Usage:
607 @@rprogram@{blah@}.
608
609 Installed Files:
610 @@file@{path/to/dir/blahz@}.
611
612 Snippets: @@rlsr@{section@}.
613
614 Internals Reference:
615 @@rinternals@{fazzle@},
616 @@rinternals@{booar@}.
617 @end example
618
619 @item
620 If there are multiple entries, separate them by commas but do not
621 include an `and'.
622
623 @item
624 Always end with a period.
625
626 @item
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
629 line.
630
631 ("Snippets" is REQUIRED; the others are optional)
632
633 @item
634 Any new concepts or links which require an explanation should go
635 as a full sentence(s) in the main text.
636
637 @item
638 Don't insert an empty line between @@seealso and the first entry!
639 Otherwise there is excessive vertical space in the PDF output.
640
641 @end itemize
642
643 @item
644 To create links, use @@ref@{@} if the link is within the same
645 manual.
646
647 @item
648 @@predefined ... @@endpredefined is for commands in ly/*-init.ly
649 FIXME?
650
651 @item
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).
656
657 @end itemize
658
659
660 @subsection Checking cross-references
661
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/.
672
673
674 @subsection General writing
675
676 @itemize
677
678 @item
679 Do not forget to create @@cindex entries for new sections of text.
680 Enter commands with @@funindex, i.e.
681
682 @example
683 @@cindex pitches, writing in different octaves
684 @@funindex \relative
685 @end example
686
687 @noindent
688 do not bother with the @@code@{@} (they are added automatically).
689 These items are added to both the command index and the unified
690 index.
691
692 Both index commands should go in front of the actual material.
693
694 @@cindex entries should not be capitalized, ie
695
696 @example
697 @@cindex time signature
698 @end example
699
700 @noindent
701 is preferred instead of @qq{Time signature},   Only use capital
702 letters for musical terms which demand them, like D.S. al Fine.
703
704 For scheme functions, only include the final part, ie
705
706 @example
707 @@funindex modern-voice-cautionary
708      and NOT
709 @@funindex #(set-accidental-style modern-voice-cautionary)
710 @end example
711
712 @item
713 Preferred terms:
714
715 @itemize
716
717 @item
718 In general, use the American spellings.  The internal lilypond
719 property names use this spelling.
720
721 @item
722 List of specific terms:
723
724 @example
725 canceled
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 <>)
731 @end example
732
733 @end itemize
734
735
736 @subsection Technical writing style
737
738 These refer to the NR.  The LM uses a more gentle, colloquial
739 style.
740
741 @itemize
742
743 @item
744 Do not refer to LilyPond in the text.  The reader knows what the
745 manual is about.  If you do, capitalization is LilyPond.
746
747 @item
748 If you explicitly refer to @q{lilypond} the program (or any other
749 command to be executed), write @code{@@command@{lilypond@}}.
750
751 @item
752 Do not explicitly refer to the reader/user.  There is no one else
753 besides the reader and the writer.
754
755 @item
756 Do not use abbreviations (don't, won't, etc.).  If you do, use a
757 comma after it:
758
759 @example
760 blabla blabla, i.e., blabla blabla
761 @end example
762
763 @item
764 Avoid fluff (@qq{Notice that,} @qq{as you can see,}
765 #qq{Currently,}).
766
767 @item
768 The use of the word @q{illegal} is inappropriate in most cases.
769 Say @q{invalid} instead.
770
771 @end itemize
772
773
774 @node Tips for writing docs
775 @section Tips for writing docs
776
777 In the NR, I highly recommend focusing on one subsection at a
778 time.  For each subsection,
779
780 @itemize
781
782 @item
783 check the mundane formatting.  Are the headings (@@predefined,
784 @@seealso, etc) in the right order?
785
786 @item
787 add any appropriate index entries.
788
789 @item
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.
793
794 @item
795 move LSR-worthy material into LSR.  Add the snippet, delete the
796 material from the .itely file, and add a @@lilypondfile command.
797
798 @item
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.
802
803 @item
804 is the material in the @@knownissues  still accurate?
805
806 @item
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)
811
812 @end itemize
813
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.
819
820
821 @subsubheading TWEAKS
822
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.
829
830 @example
831 \set Staff.instrumentName = #"foo"
832 @end example
833
834 On the other side of this,
835
836 @example
837 \override Score.Hairpin #'after-line-breaking = ##t
838 @end example
839
840 clearly belongs in LSR.
841
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
845 possible into there.
846
847
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.
852
853
854 @node Updating docs with convert-ly
855 @section Updating doc with convert-ly
856
857 cd into Documentation and run
858
859 @example
860 find . -name '*.itely' | xargs convert-ly -e
861 @end example
862
863 @noindent
864 (This also updates translated docs.)
865
866
867
868
869 @node Translating the documentation
870 @section Translating the documentation
871
872