]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/devel/doc-work.itexi
More misc CG stuff.
[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 @menu
59 * Texinfo introduction::        
60 * Sectioning commands::         
61 * LilyPond formatting::         
62 * Text formatting::             
63 * Syntax survey::               
64 * Other text concerns::         
65 @end menu
66
67
68 @node Texinfo introduction
69 @subsection Texinfo introduction
70
71 The language is called texinfo; you can see its manual here:
72 @uref{http://www.gnu.org/software/texinfo/manual/texinfo/}
73
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.
78
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.}
82
83
84 @node Sectioning commands
85 @subsection Sectioning commands
86
87 Most of the manual operates at the
88
89 @example
90 @@node Foo
91 @@subsubsection Foo
92 @end example
93
94 @noindent
95 level.  Sections are created with
96
97 @example
98 @@node Foo
99 @@subsection Foo
100 @end example
101
102 @itemize
103 @item
104 Please leave two blank lines above a @@node; this makes it
105 easier to find sections in texinfo.
106
107 @item
108 Sectioning commands (@@node and @@section) must not appear
109 inside an @@ignore.  Separate those commands with a space, ie @@n
110 ode.
111
112 @end itemize
113
114
115 @node LilyPond formatting
116 @subsection LilyPond formatting
117
118 @itemize
119
120 @item
121 Use two spaces for indentation in lilypond examples.  (no
122 tabs)
123
124 @item
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"}
129
130 @item
131 All engravers should have double-quotes around them:
132
133 @example
134 \consists "Spans_arpeggio_engraver"
135 @end example
136
137 Again, LilyPond does not strictly require this, but it is a useful
138 standard to follow.
139
140 @item
141 Examples should end with a complete bar if possible.
142
143 @item
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:
147
148 @example
149 \override textscript #'padding = #3 c1^"hi"
150 @end example
151
152 Good:
153
154 @example
155 \override textscript #'padding = #3
156 c1^"hi"
157 @end example
158
159 @item
160 Most LilyPond input should be produced with:
161
162 @example
163 @@lilypond[verbatim,quote,relative=2]
164 @end example
165
166 @noindent
167 or
168
169 @example
170 @@lilypond[verbatim,quote,relative=1]
171 @end example
172
173 If you want to use \layout@{@} or define variables, use
174
175 @example
176 @@lilypond[verbatim,quote]
177 @end example
178
179 In rare cases, other options may be used (or omitted), but ask first.
180
181 @item
182 Inspirational headwords are produced with
183
184 @example
185 @@lilypondfile[quote,ragged-right,line-width=16\cm,staffsize=16]
186 @{pitches-headword.ly@}
187 @end example
188
189 @item
190 LSR snippets are linked with
191
192 @example
193 @@lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
194 @{filename.ly@}
195 @end example
196
197 @noindent
198 excepted in Templates, where `doctitle' may be omitted.
199
200 @item
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)
204
205 @item
206 Specify durations for at least the first note of every bar.
207
208 @item
209 If possible, end with a complete bar.
210
211 @item
212 Comments should go on their own line, and be placed before
213 the line(s) to which they refer.
214
215 @item
216 Add extra spaces around @{ @} marks; ie
217
218 @example
219 not:          \chordmode @{c e g@}
220 but instead:  \chordmode @{ c e g @}
221 @end example
222
223 @item
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
226 checks.
227
228 @item
229 If you want to work on an example outside of the manual (for
230 easier/faster processing), use this header:
231
232 @example
233 \paper @{
234   #(define dump-extents #t)
235   indent = 0\mm
236   line-width = 160\mm - 2.0 * 0.4\in
237   ragged-right = ##t
238   force-assignment = #""
239   line-width = #(- line-width (* mm  3.000000))
240 @}
241
242 \layout @{
243 @}
244 @end example
245
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.
249
250 @end itemize
251
252
253 @node Text formatting
254 @subsection Text formatting
255
256 @itemize
257
258 @item
259 Lines should be less than 72 characters long.  (I personally
260 recommend writing with 66-char lines, but don't bother modifying
261 existing material.)
262
263 @item
264 Do not use tabs.
265
266 @item
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.
271
272 @item
273 Use two spaces after a period.
274
275 @item
276 In examples of syntax, use @@var@{musicexpr@} for a music
277 expression.
278
279 @item
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.
284
285 @item
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:
289
290 @example
291 The variable@@tie@{@}@@var@{a@} ...
292 @end example
293
294 @item
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
299
300 @example
301 @@example
302   foo @{
303     bar
304   @}
305 @@end example
306 @end example
307
308 @noindent
309 should be replaced with
310
311 @example
312 @@example
313 foo @{
314   bar
315 @}
316 @@end example
317 @end example
318
319 @noindent
320 where `@@example' starts the line (without leading spaces).
321
322 @item
323 Do not compress the input vertically; this is, do not use
324
325 @example
326     Beginning of logical unit
327     @@example
328     ...
329     @@end example
330     continuation of logical unit
331 @end example
332
333 @noindent
334 but instead do
335
336 @example
337 Beginning of logical unit
338
339 @@example
340 ...
341 @@end example
342
343 @@noindent
344 continuation of logical unit
345 @end example
346
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
350 line above it.
351
352 @item
353 in @@itemize use @@item
354 on a separate line like this:
355
356 @example
357 @@itemize
358 @@item
359 Foo
360
361 @@item
362 Bar
363 @end example
364
365 Do not use @@itemize @@bullet.
366
367 @item
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
372 enclose it with
373
374 @example
375 @@w@{ ... @}
376
377   e.g.
378
379 @@w@{"@@version@{@}"@}
380 @end example
381
382 @end itemize
383
384
385 @node Syntax survey
386 @subsection Syntax survey
387
388 @itemize
389 @item
390 @@c - single line comments
391   "@@c NOTE:" is a comment which should remain in the final
392   version.  (gp only command ;)
393 @item
394 @@ignore ... @@end ignore - multi-line comment
395
396 @item
397 @@cindex - General index. Please add as many as you can.  Don't
398   capitalize the first word.
399 @item
400 @@funindex - is for a \lilycommand.
401
402 @item
403 @@example ... @@end ignore - example text that should be set as a
404   blockquote.  Any @{@} must be escaped with @@@{ @}@@
405 @item
406 @@itemize @@item
407 A @@item
408 B ... @@end itemize - for bulleted lists.
409   Do not compress vertically like this.
410
411 @item
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@{  @}@}.
415 @item
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
419   per term.
420 @item
421 @@q@{@} - Single quotes. Used for `vague' terms.
422 @item
423 @@qq@{@} - Double quotes.  Used for actual quotes ("he said") or for
424   introducing special input modes.
425
426 @item
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"
431
432 @item
433 @@var - Use for variables.
434 @item
435 @@warning@{@} - produces a "Note: " box. Use for important messages.
436
437 @item
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).
441
442 @end itemize
443
444
445
446 @node Other text concerns
447 @subsection Other text concerns
448
449 @itemize
450
451 @item
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.
457
458 @item
459 Introducing examples must be done with
460
461 @example
462      . (ie finish the previous sentence/paragaph)
463      : (ie `in this example:')
464      , (ie `may add foo with the blah construct,')
465 @end example
466
467 The old "sentence runs directly into the example" method is not
468 allowed any more.
469
470 @item
471 Abbrevs in caps, e.g., HTML, DVI, MIDI, etc.
472
473 @item
474 Colon usage
475
476 @enumerate
477
478 @item
479 To introduce lists
480
481 @item
482 When beginning a quote: "So, he said,...".
483
484 This usage is rarer.  Americans often just use a comma.
485
486 @item
487 When adding a defining example at the end of a sentence.
488
489 @end enumerate
490
491 @item
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.
495
496 @end itemize
497
498
499
500
501 @node Documentation policy
502 @section Documentation policy
503
504 @menu
505 * Books::                       
506 * Section organization::        
507 * Checking cross-references::   
508 * General writing::             
509 * Technical writing style::     
510 @end menu
511
512 @node Books
513 @subsection Books
514
515 There are four parts to the documentation: the Learning Manual,
516 the Notation Reference, the Program Reference, and the Music
517 Glossary.
518
519 @itemize
520
521 @item
522 Learning Manual:
523
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.
539
540 Users are encouraged to read the complete Learning Manual from
541 start-to-finish.
542
543
544 @item
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
553 style.
554
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@}.
563
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.
567
568 Finally, you should assume that users know what the notation
569 means; explaining musical concepts happens in the Music Glossary.
570
571
572 @item
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
576 writing style.
577
578 Users are not expected to read this manual from start to finish.
579
580
581 @item
582 Music Glossary: information about the music notation itself.
583 Explanations and translations about notation terms go here.
584
585 Users are not expected to read this manual from start to finish.
586
587 @item
588 Internals Reference: not really a documentation book, since it is
589 automagically generated from the source, but this is its name.
590
591 @end itemize
592
593
594 @node Section organization
595 @subsection Section organization
596
597 @itemize
598
599 @item
600 The order of headings inside documentation sections should
601 be:
602
603 @example
604 main docs
605 @@predefined
606 @@endpredefined
607 @@snippets
608 @@seealso
609 @@knownissues
610 @end example
611
612 @item
613 You @emph{must} include a @@seealso.
614
615 @itemize
616 @item
617 The order of items inside the @@seealso section is
618
619 @example
620 Music Glossary:
621 @@rglos@{foo@},
622 @@rglos@{bar@}.
623
624 Learning Manual:
625 @@rlearning@{baz@},
626 @@rlearning@{foozle@}.
627
628 Notation Reference:
629 @@ruser@{faazle@},
630 @@ruser@{boo@}.
631
632 Application Usage:
633 @@rprogram@{blah@}.
634
635 Installed Files:
636 @@file@{path/to/dir/blahz@}.
637
638 Snippets: @@rlsr@{section@}.
639
640 Internals Reference:
641 @@rinternals@{fazzle@},
642 @@rinternals@{booar@}.
643 @end example
644
645 @item
646 If there are multiple entries, separate them by commas but do not
647 include an `and'.
648
649 @item
650 Always end with a period.
651
652 @item
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
655 line.
656
657 ("Snippets" is REQUIRED; the others are optional)
658
659 @item
660 Any new concepts or links which require an explanation should go
661 as a full sentence(s) in the main text.
662
663 @item
664 Don't insert an empty line between @@seealso and the first entry!
665 Otherwise there is excessive vertical space in the PDF output.
666
667 @end itemize
668
669 @item
670 To create links, use @@ref@{@} if the link is within the same
671 manual.
672
673 @item
674 @@predefined ... @@endpredefined is for commands in ly/*-init.ly
675 FIXME?
676
677 @item
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).
682
683 @end itemize
684
685
686 @node Checking cross-references
687 @subsection Checking cross-references
688
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/.
699
700
701 @node General writing
702 @subsection General writing
703
704 @itemize
705
706 @item
707 Do not forget to create @@cindex entries for new sections of text.
708 Enter commands with @@funindex, i.e.
709
710 @example
711 @@cindex pitches, writing in different octaves
712 @@funindex \relative
713 @end example
714
715 @noindent
716 do not bother with the @@code@{@} (they are added automatically).
717 These items are added to both the command index and the unified
718 index.
719
720 Both index commands should go in front of the actual material.
721
722 @@cindex entries should not be capitalized, ie
723
724 @example
725 @@cindex time signature
726 @end example
727
728 @noindent
729 is preferred instead of @qq{Time signature},   Only use capital
730 letters for musical terms which demand them, like D.S. al Fine.
731
732 For scheme functions, only include the final part, i.e.,
733
734 @example
735 @@funindex modern-voice-cautionary
736      and NOT
737 @@funindex #(set-accidental-style modern-voice-cautionary)
738 @end example
739
740 @item
741 Preferred terms:
742
743 @itemize
744
745 @item
746 In general, use the American spellings.  The internal lilypond
747 property names use this spelling.
748
749 @item
750 List of specific terms:
751
752 @example
753 canceled
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 <>)
759 @end example
760
761 @end itemize
762
763 @end itemize
764
765
766 @node Technical writing style
767 @subsection Technical writing style
768
769 These refer to the NR.  The LM uses a more gentle, colloquial
770 style.
771
772 @itemize
773
774 @item
775 Do not refer to LilyPond in the text.  The reader knows what the
776 manual is about.  If you do, capitalization is LilyPond.
777
778 @item
779 If you explicitly refer to @q{lilypond} the program (or any other
780 command to be executed), write @code{@@command@{lilypond@}}.
781
782 @item
783 Do not explicitly refer to the reader/user.  There is no one else
784 besides the reader and the writer.
785
786 @item
787 Avoid contractions (don't, won't, etc.).  Spell the words out completely.
788
789 @item
790 Avoid abbreviations, except for commonly used abbreviations of foreign
791 language terms such as etc. and i.e.
792
793 @item
794 Avoid fluff (@qq{Notice that,} @qq{as you can see,}
795 @qq{Currently,}).
796
797 @item
798 The use of the word @q{illegal} is inappropriate in most cases.
799 Say @q{invalid} instead.
800
801 @end itemize
802
803
804 @node Tips for writing docs
805 @section Tips for writing docs
806
807 In the NR, I highly recommend focusing on one subsection at a
808 time.  For each subsection,
809
810 @itemize
811
812 @item
813 check the mundane formatting.  Are the headings (@@predefined,
814 @@seealso, etc.) in the right order?
815
816 @item
817 add any appropriate index entries.
818
819 @item
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.
823
824 @item
825 move LSR-worthy material into LSR.  Add the snippet, delete the
826 material from the .itely file, and add a @@lilypondfile command.
827
828 @item
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.
832
833 @item
834 is the material in the @@knownissues  still accurate?
835
836 @item
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)
841
842 @end itemize
843
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.
849
850
851 @subsubheading TWEAKS
852
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.
859
860 @example
861 \set Staff.instrumentName = #"foo"
862 @end example
863
864 On the other side of this,
865
866 @example
867 \override Score.Hairpin #'after-line-breaking = ##t
868 @end example
869
870 clearly belongs in LSR.
871
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
875 possible into there.
876
877
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
882 them to the LSR.
883
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
887 the difficulty.
888
889
890 @node Updating docs with convert-ly
891 @section Updating doc with convert-ly
892
893 cd into Documentation and run
894
895 @example
896 find . -name '*.itely' | xargs convert-ly -e
897 @end example
898
899 @noindent
900 (This also updates translated docs.)
901
902
903
904
905 @node Translating the documentation
906 @section Translating the documentation
907
908