home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / APPS / lout2.lzh / LOUT2 / DOC / TR.LOUT / ch2.03 < prev    next >
Text File  |  1994-01-25  |  3KB  |  84 lines

  1. @Section
  2.   @Tag { named }
  3.   @Title { Named parameters }
  4. @Begin
  5. @PP
  6. In addition to left and right (or body) parameters, a symbol may have
  7. any number of {@I {named parameters}}:
  8. parameter.named @SubIndex { @Code named parameter }
  9. named.par @Index { @Code named parameter }
  10. @ID @Code  {
  11. "def @Chapter"
  12. "    named @Tag {}"
  13. "    named @Title {}"
  14. "    right x"
  15. "{"
  16. "    ..."
  17. "}"
  18. }
  19. Their definitions appear in between those of any left and right
  20. parameters, and each is followed by a @I {default value} between
  21. default @Index { Default value of parameter }
  22. braces.  When @Code "@Chapter" is invoked, its named parameters are
  23. given values in the following way:
  24. @ID @Code  {
  25. "@Chapter"
  26. "    @Tag { intro }"
  27. "    @Title { Introduction }"
  28. "{"
  29. "    ..."
  30. "}"
  31. }
  32. That is, a list of named parameters appears immediately following the
  33. symbol, each with its value enclosed in braces.  Any right parameter
  34. follows after them.  They do not have to appear in the order they were
  35. defined, and they can even be omitted altogether, in which case the
  36. default value from the definition is used instead.
  37. @PP
  38. A named @Code "@Tag" parameter
  39. tag.par @Index { @Code "@Tag" parameter, default value of }
  40. does not take its default value from the definition; instead, if a default
  41. value is needed, Lout invents a simple word which differs from every other
  42. tag.  This is important, for example, in the production of numbered
  43. chapters and sections (Section {@NumberOf chapters}).
  44. @PP
  45. Named parameters may have parameters, {@PageMark strange} as in the
  46. following definition:
  47. @ID @Code {
  48. "def @Strange"
  49. "    named @Format right @Val { [@Val] }"
  50. "    right x"
  51. "{"
  52. "    @Format x"
  53. "}"
  54. }
  55. The named parameter @Code "@Format" has right parameter {@Code "@Val"},
  56. and the default value of @Code "@Format" is this parameter enclosed in
  57. brackets.  When @Code "@Format" is invoked it must be supplied with
  58. a right parameter, which will replace {@Code "@Val"}.  Thus,
  59. @ID @Code {
  60. "@Strange 27"
  61. }
  62. equals @Code "@Format 27" and so has result
  63. @ID {
  64. @Strange 27
  65. }
  66. The @Code "@Format" symbol is like a definition with parameters whose
  67. body can be changed:
  68. @ID @Code {
  69. "@Strange"
  70. "    @Format { Slope @Font @Val. }"
  71. "27"
  72. }
  73. still equals {@Code "@Format 27"}, but this time the result is
  74. @ID {
  75. @Strange
  76.     @Format { Slope @Font @Val. }
  77. 27
  78. }
  79. In practice, examples of named parameters with parameters all have this
  80. flavour of format being separated from content; running headers (Section
  81. {@NumberOf pagelayout}) and printing styles for bibliographies
  82. (Section {@NumberOf biblio}) are two major ones.
  83. @End @Section
  84.