]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/devel/doc-work.itexi
Merge branch 'lilypond/translation' of ssh://jomand@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 Please leave two blank lines above a @@node; this makes it
90 easier to find sections in texinfo.
91
92 @item Sectioning commands (@@node and @@section) must not appear
93 inside an @@ignore.  Separate those commands with a space, ie @@n
94 ode.
95
96 @end itemize
97
98
99
100 @subsection LilyPond formatting
101
102 @itemize
103
104 @item Use two spaces for indentation in lilypond examples.  (no
105 tabs)
106
107 @item All text strings should be prefaced with #.  LilyPond does
108 not strictly require this, but it is helpful to get users
109 accustomed to this scheme construct.  ie @code{\set
110 Staff.instrumentName = #"cello"}
111
112 @item All engravers should have double-quotes around them:
113
114 @example
115     \consists "Spans_arpeggio_engraver"
116 @end example
117
118 Again, LilyPond does not strictly require this, but it is a useful
119 standard to follow.
120
121 @item Examples should end with a complete bar if possible.
122
123 @item If possible, only write one bar per line.  The notes on each
124 line should be an independent line -- tweaks should occur on their
125 own line if possible.  Bad:
126
127 @example
128 \override textscript #'padding = #3 c1^"hi"
129 @end example
130
131 Good:
132
133 @example
134 \override textscript #'padding = #3
135 c1^"hi"
136 @end example
137
138 @item Most LilyPond input should be produced with:
139
140 @example
141 @@lilypond[verbatim,quote,relative=2]
142 @end example
143
144 @noindent
145 or
146
147 @example
148 @@lilypond[verbatim,quote,relative=1]
149 @end example
150
151 If you want to use \layout@{@} or define variables, use
152
153 @example
154 @@lilypond[verbatim,quote]
155 @end example
156
157 In rare cases, other options may be used (or omitted), but ask first.
158
159 @item
160 Inspirational headwords are produced with
161
162 @example
163 @@lilypondfile[quote,ragged-right,line-width=16\cm,staffsize=16]
164 @{pitches-headword.ly@}
165 @end example
166
167 @item LSR snippets are linked with
168
169 @example
170 @@lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
171 @{filename.ly@}
172 @end example
173
174 @noindent
175 excepted in Templates, where `doctitle' may be omitted.
176
177 @item Avoid long stretches of input code.  Noone is going to read
178 them in print.  Please create a smaller example.  (the smaller
179 example does not need to be minimal, however)
180
181 @item Specify durations for at least the first note of every bar.
182
183 @item If possible, end with a complete bar.
184
185 @item Comments should go on their own line, and be placed before
186 the line(s) to which they refer.
187
188 @item Add extra spaces around @{ @} marks; ie
189
190 @example
191 not:          \chordmode @{c e g@}
192 but instead:  \chordmode @{ c e g @}
193 @end example
194
195 @item If you only have one bar per line, omit bar checks.  If you
196 put more than one bar per line (not recommended), then include bar
197 checks.
198
199 @item If you want to work on an example outside of the manual (for
200 easier/faster processing), use this header:
201
202 @example
203 \paper @{
204   #(define dump-extents #t)
205   indent = 0\mm
206   line-width = 160\mm - 2.0 * 0.4\in
207   ragged-right = ##t
208   force-assignment = #""
209   line-width = #(- line-width (* mm  3.000000))
210 @}
211
212 \layout @{
213 @}
214 @end example
215
216 You may not change any of these values.  If you are making an
217 example demonstrating special \paper@{@} values, contact the
218 Documentation Editor.
219
220 @end itemize
221
222
223 @subsection Text formatting
224
225 @itemize
226
227 @item
228 * Lines should be less than 72 characters long.  (I personally
229   recommend writing with 66-char lines, but don't bother modifying
230   existing material.)
231
232 @item
233 * Do not use tabs.
234
235 @item
236 * Do not use spaces at the beginning of a line (except in @@example
237   or @@verbatim environments), and do not use more than a single
238   space between words.  `makeinfo' copies the input lines verbatim
239   without removing those spaces.
240
241 @item
242 * Use two spaces after a period.
243
244 @item
245 * In examples of syntax, use @@var@{musicexpr@} for a music
246   expression.
247
248 @item
249 * Don't use @@rinternals@{@} in the main text.  If you're tempted to
250   do so, you're probably getting too close to "talking through the
251   code".  If you really want to refer to a context, use @@code@{@} in
252   the main text and @@rinternals@{@} in the @@seealso.
253
254 @item
255 * Variables or numbers which consist of a single character
256   (probably followed by a punctuation mark) should be tied
257   properly, either to the previous or the next word.  Example:
258
259       The variable@@tie@{@}@@var@{a@} ...
260
261 @item
262 * To get consistent indentation in the DVI output it is better to
263   avoid the @@verbatim environment.  Use the @@example environment
264   instead if possible, but without extraneous indentation.  For
265   example, this
266
267     @@example
268       foo @{
269         bar
270       @}
271     @@end example
272
273   should be replaced with
274
275     @@example
276     foo @{
277       bar
278     @}
279     @@end example
280
281   where `@@example' starts the line (without leading spaces).
282
283 @item
284 * Do not compress the input vertically; this is, do not use
285
286     Beginning of logical unit
287     @@example
288     ...
289     @@end example
290     continuation of logical unit
291
292   but
293
294     Beginning of logical unit
295
296     @@example
297     ...
298     @@end example
299
300     @@noindent
301     continuation of logical unit
302
303   This makes it easier to avoid forgetting the `@@noindent'.  Only
304   use @@noindent if the material is discussing the same material;
305   new material should simply begin without anything special on the
306   line above it.
307
308 @item
309 * in @@itemize use @@item on a separate line like this:
310   @@itemize
311   @@item
312   Foo
313
314   @@item
315   Bar
316
317   Do not use @@itemize @@bullet.
318
319 @item
320 * To get LilyPond version, use @@version@{@} (this does not work inside
321   LilyPond snippets).  If you write "@@version@{@}" (enclosed with
322   quotes), or generally if @@version@{@} is not followed by a space,
323   enclose it with
324
325   @@w@{ ... @}
326
327   e.g.
328
329   @@w@{"@@version@{@}"@}
330
331   to prevent an ugly line break in PDF output.
332 @end itemize
333
334
335 @subsection Syntax survey
336
337 @itemize
338 @item
339 @@c - single line comments
340   "@@c NOTE:" is a comment which should remain in the final
341   version.  (gp only command ;)
342 @item
343 @@ignore ... @@end ignore - multi-line comment
344
345 @item
346 @@cindex - General index. Please add as many as you can.  Don't
347   capitalize the first word.
348 @item
349 @@funindex - is for a \lilycommand.
350
351 @item
352 @@example ... @@end ignore - example text that should be set as a
353   blockquote.  Any @{@} must be escaped with @@@{ @}@@
354 @item
355 @@itemize @@item A @@item B ... @@end itemize - for bulleted lists.
356   Do not compress vertically like this.
357
358 @item
359 @@code@{@} - typeset in a tt-font. Use for actual lilypond code or
360   property/context names.  If the name contains a space, wrap
361   the entire thing inside @@w@{@@code@{  @}@}.
362 @item
363 @@notation@{@} - refers to pieces of notation, e.g.
364   "@@notation@{cres.@}".  Also use to specific lyrics ("the
365   @@notation@{A - men@} is centered").  Only use once per subsection
366   per term.
367 @item
368 @@q@{@} - Single quotes. Used for `vague' terms.
369 @item
370 @@qq@{@} - Double quotes.  Used for actual quotes ("he said") or for
371   introducing special input modes.
372
373 @item
374 @@tie@{@} - Variables or numbers which consist of a single character
375   (probably followed by a punctuation mark) should be tied
376   properly, either to the previous or the next word.  Example:
377     "The letter@@tie@{@}@@q@{I@} is skipped"
378
379 @item
380 @@var - Use for variables.
381 @item
382 @@warning@{@} - produces a "Note: " box. Use for important messages.
383
384 @item
385 @@bs - Generates a backslash inside @@warning.
386     Any `\' used inside @@warning (and @@q or @@qq) must be written as `@@bs@{@}' 
387     (texinfo would also allow \\, but this breaks with PDF output).
388
389 @end itemize
390
391
392
393 @subsection Other text concerns
394
395 @itemize
396
397 @item
398 * References must occur at the end of a sentence, for more
399   information see @@ref@{the texinfo manual@}.  Ideally this should
400   also be the final sentence of a paragraph, but this is not
401   required.  Any link in a doc section must be duplicated in the
402   @@seealso section at the bottom.
403
404 @item
405 * Introducing examples must be done with
406      . (ie finish the previous sentence/paragaph)
407      : (ie `in this example:')
408      , (ie `may add foo with the blah construct,')
409   The old "sentence runs directly into the example" method is not
410   allowed any more.
411
412 @item
413 * Abbrevs in caps, e.g., HTML, DVI, MIDI, etc.
414
415 @item
416 * Colon usage
417
418   1. To introduce lists
419   2. When beginning a quote: "So, he said,..."
420      This usage is rarer.  Americans often just use a comma.
421   3. When adding a defining example at the end of a sentence.
422
423 @item
424 * Non-ASCII characters which are in utf-8 should be directly used;
425   this is, don't say `Ba@@ss@{@}tuba' but `Baßtuba'.  This ensures that
426   all such characters appear in all output formats.
427
428 @end itemize
429
430
431
432
433 @node Documentation policy
434 @section Documentation policy
435
436
437 @subsection Books
438
439 There are four parts to the documentation: the Learning Manual,
440 the Notation Reference, the Program Reference, and the Music
441 Glossary.
442
443 @itemize
444
445 @item
446 * Learning Manual:
447   The LM is written in a tutorial style which introduces the most
448   important concepts, structure and syntax of the elements of a
449   LilyPond score in a carefully graded sequence of steps.
450   Explanations of all musical concepts used in the Manual can be
451   found in the Music Glossary, and readers are assumed to have no
452   prior knowledge of LilyPond.  The objective is to take readers to
453   a level where the Notation Reference can be understood and
454   employed to both adapt the templates in the Appendix to their
455   needs and to begin to construct their own scores.  Commonly used
456   tweaks are introduced and explained.  Examples are provided
457   throughout which, while being focussed on the topic being
458   introduced, are long enough to seem real in order to retain the
459   readers' interest.  Each example builds on the previous material,
460   and comments are used liberally.  Every new aspect is thoroughly
461   explained before it is used.
462
463 Users are encouraged to read the complete Learning Manual from
464 start-to-finish.
465
466
467 @item
468 * Notation Reference: a (hopefully complete) description of
469   LilyPond input notation.  Some material from here may be
470   duplicated in the Learning Manual (for teaching), but consider
471   the NR to be the "definitive" description of each notation
472   element, with the LM being an "extra".  The goal is _not_ to
473   provide a step-by-step learning environment -- do not avoid
474   using notation that has not be introduced previously in the
475   NR  (for example, use \break if appropriate).  This section is
476   written in formal technical writing style.
477
478 Avoid duplication.  Although users are not expected to read this
479 manual from start to finish, they should be familiar with the
480 material in the Learning Manual (particularly ``Fundamental
481 Concepts''), so do not repeat that material in each section of
482 this book.  Also watch out for common constructs, like ^ - _ for
483 directions -- those are explained in NR 3.  In NR 1, you can
484 write:
485 DYNAMICS may be manually placed above or below the
486 staff, see @@ref@{Controlling direction and placement@}.
487
488 Most tweaks should be added to LSR and not placed directly in the
489 .itely file.  In some cases, tweaks may be placed in the main
490 text, but ask about this first.
491
492 Finally, you should assume that users know what the notation
493 means; explaining musical concepts happens in the Music Glossary.
494
495
496 @item
497 * Application Usage: information about using the program lilypond
498   with other programs (lilypond-book, operating systems, GUIs,
499   convert-ly, etc).  This section is written in formal technical
500   writing style.
501
502 Users are not expected to read this manual from start to finish.
503
504
505 @item
506 * Music Glossary: information about the music notation itself.
507   Explanations and translations about notation terms go here.
508
509 Users are not expected to read this manual from start to finish.
510
511 @item
512 * Internals Reference: not really a documentation book, since it
513   is automagically generated from the source, but this is its
514   name.
515
516 @end itemize
517
518
519 @subsection Section organization
520
521 @itemize
522
523 @item The order of headings inside documentation sections should
524 be:
525
526 @example
527 main docs
528 @@predefined
529 @@endpredefined
530 @@snippets
531 @@seealso
532 @@knownissues
533 @end example
534
535 @item
536 * You _must_ include a @@seealso.  The order of items inside the
537   @@seealso section is
538
539     Music Glossary:
540     @@rglos@{foo@},
541     @@rglos@{bar@}.
542
543     Learning Manual:
544     @@rlearning@{baz@},
545     @@rlearning@{foozle@}.
546
547     Notation Reference:
548     @@ruser@{faazle@},
549     @@ruser@{boo@}.
550
551     Application Usage:
552     @@rprogram@{blah@}.
553
554     Installed Files:
555     @@file@{path/to/dir/blahz@}.
556
557     Snippets: @@rlsr@{section@}.
558
559     Internals Reference:
560     @@rinternals@{fazzle@},
561     @@rinternals@{booar@}.
562
563       If there are multiple entries, separate them by commas
564       but do not include an `and'.
565
566       Always end with a period.
567
568       Place each link on a new line as above; this makes it much
569       easier to add or remove links.  In the output, they
570       appear on a single line.
571
572   ("Snippets" is REQUIRED; the others are optional)
573
574   Any new concepts or links which require an explanation should go
575   as a full sentence(s) in the main text.
576
577   Don't insert an empty line between @@seealso and the first entry!
578   Otherwise there is excessive vertical space in the PDF output.
579
580 @item
581 * To create links, use @@ref@{@} if the link is within the same
582   manual.
583
584 @item
585 * @@predefined ... @@endpredefined is for commands in ly/*-init.ly
586   FIXME?
587
588 @item
589 * Do not include any real info in second-level sections (ie 1.1
590   Pitches).  A first-level section may have introductory material,
591   but other than that all material goes into third-level sections
592   (ie 1.1.1 Writing Pitches).
593
594 @end itemize
595
596
597 @subsection Checking cross-references
598
599 Cross-references between different manuals are heavily used in the
600 documentation, but they are not checked during compilation.  However,
601 if you compile the documentation, a script called check_texi_refs can
602 help you with checking and fixing these cross-references; for
603 information on usage, cd into a source tree where documentation has
604 been built, cd into Documentation and look for check-xrefs and
605 fix-xrefs targets in 'make help' output.  Note that you have to find
606 yourself the source files to fix cross-references in the generated
607 documentation such as the Internals Reference; e.g. you can grep
608 scm/ and lily/.
609
610
611 @subsection General writing
612
613 @itemize
614
615 @item
616 * Do not forget to create @@cindex entries for new sections of text.
617   Enter commands with @@funindex, i.e.
618     @@cindex pitches, writing in different octaves
619     @@funindex \relative
620   do not bother with the @@code@{@} (they are added automatically).  These
621   items are added to both the command index and the unified index.
622
623   Both index commands should go in front of the actual material.
624
625   @@cindex entries should not be capitalized, ie
626     @@cindex time signature
627   is preferred.  (instead of `Time signature')   Only use capital
628   letters for musical terms which demand them, like D.S. al Fine.
629
630   For scheme functions, only include the final part, ie
631     @@funindex modern-voice-cautionary
632   and NOT
633     @@funindex #(set-accidental-style modern-voice-cautionary)
634
635 @item
636 * Preferred terms:
637     - in general, use the American spellings.  The internal
638       lilypond property names use this spelling.
639     - list of specific terms:
640 canceled
641 simultaenous    NOT concurrent
642 measure: the unit of music
643 bar line: the symbol delimiting a measure   NOT barline
644 note head   NOT notehead
645 chord construct   NOT chord (when referring to <>)
646
647 @end itemize
648
649
650 @subsection Technical writing style
651
652 @itemize
653
654 @item
655 * Do not refer to LilyPond in the text.  The reader knows what the
656   manual is about.  If you do, capitalization is LilyPond.
657
658 @item
659 * If you explicitly refer to `lilypond' the program (or any other
660   command to be executed), say `@@command@{lilypond@}'.
661
662 @item
663 * Do not explicitly refer to the reader/user.  There is no one
664   else besides the reader and the writer.
665
666 @item
667 * Do not use abbreviations (don't, won't, etc.).  If you do, use a
668   comma after it:
669
670     blabla blabla, i.e., blabla blabla
671
672 @item
673 * Avoid fluff (``Notice that,'' ``as you can see,''
674   ``Currently,'').
675
676 @item
677 * The use of the word `illegal' is inappropriate in most cases.
678   Say `invalid' instead.
679
680 @end itemize
681
682
683 @node Tips for writing docs
684 @section Tips for writing docs
685
686 In the NR, I highly recommend working on one subsection at a time.
687 For each subsection,
688
689 - check the mundane formatting.  Are the headings (@@predefined,
690   @@seealso, etc) in the right order?
691 - add any appropriate index entries.
692 - check the links in the @@seealso section -- links to music
693   glossary, internal references, and other NR sections are the
694   main concern.  Check for potential additions.
695 - move LSR-worthy material into LSR.  Add the snippet (or
696   just send it to Valentin for adding), delete the material from
697   the .itely file, and add a @@lilypondfile command.
698
699 - check the examples and descriptions.  Do they still work?
700   *Do not* assume that the existing text is accurate/complete;
701   some of the manual is highly out of date.
702 - is the material in the @@knownissues  still accurate?
703 - process anything on the TODO list on the GDP web site.
704 - can the examples be improved (made more explanatory), or is
705   there any missing info?  (feel free to ask specific questions
706   on -user; a couple of people claimed to be interesting in being
707   "consultants" who would help with such questions)
708
709 In general, I favor short text explanations with good examples --
710 "an example is worth a thousand words".  When I worked on the
711 docs, I spent about half my time just working on those tiny
712 lilypond examples.  Making easily-understandable examples is much
713 harder than it looks.
714
715
716 TWEAKS
717
718 In general, any \set or \override commands should go in the
719 "select snippets" section, which means that they should go in LSR
720 and not the .itely file.  For some cases, the command obviously
721 belongs in the "main text" (ie not inside @@predefined or @@seealso
722 or whatever) -- instrument names are a good example of this.
723   \set Staff.instrumentName = #"foo"
724 On the other side of this,
725   \override Score.Hairpin #'after-line-breaking = ##t
726 clearly belongs in LSR.
727
728 I'm quite willing to discuss specific cases if you think that a
729 tweaks needs to be in the main text.  But items that can go into
730 LSR are easier to maintain, so I'd like to move as much as
731 possible into there.
732
733
734 It would be "nice" if you spent a lot of time crafting nice tweaks
735 for users... but my recommendation is *not* to do this.  There's a
736 lot of doc work to do without adding examples of tweaks.  Tweak
737 examples are trivial to add later -- they could be made by normal
738 users, or by you after GDP is over.
739
740 Basically, it's not something that needs to be done while I'm
741 around.  Remember that I'm gone in August at the latest; there's a
742 *lot* of doc work that should be done before then.  I strongly
743 recommend that you save all the tweaks until later.
744
745
746 FINAL
747
748 - when you think you're finished, let me know.  I'll spend a few
749   minutes and send you a list of mistakes to fix.
750   (there's a *lot* of details to cover; we'll probably spend a
751   week going back and forth like this.  See earlier warning about
752   hating me by the time you're done with a doc section :)
753 - I'll ask people on -user to review the Snippet list at this
754   time; correcting things on the Snippet list is much easier than
755   getting comments on the integrated snippets.
756 - when we're both satisfied with the section, we'll invite
757   comments from -user.  Judging from my experience with Pitches,
758   it will take between three and five weeks to keep on revising
759   the "final" version.
760
761 I personally found it quite frustrating to still be fixing
762 problems in a doc section which I thought was "perfect" a whole
763 bloody *month* ago.  Don't get me wrong; it's great that we get so
764 many comments from -user.  :)   But just be aware that when you
765 think you're finally done with a section, you're actually only
766 halfway there.
767
768
769
770
771
772
773
774 @node Updating docs with convert-ly
775 @section Updating doc with convert-ly
776
777 cd into Documentation and run
778
779 @example
780 find . -name '*.itely' | xargs convert-ly -e
781 @end example
782
783 @noindent
784 (This also updates translated docs.)
785
786
787
788
789 @node Translating the documentation
790 @section Translating the documentation
791
792