home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V7 / usr / doc / trofftut / tt07 < prev    next >
Encoding:
Text File  |  1979-01-10  |  1.7 KB  |  82 lines

  1. .NH
  2. Strings
  3. .PP
  4. Obviously if a paper contains a large number of occurrences
  5. of an acute accent over a letter `e',
  6. typing
  7. .BD \eo"e\e\'"
  8. for each \*e
  9. would be a great nuisance.
  10. .PP
  11. Fortunately,
  12. .UL troff
  13. provides a way in which you can store an arbitrary
  14. collection of text in a `string',
  15. and thereafter use the string name as a shorthand
  16. for its contents.
  17. Strings are one of several
  18. .UL troff
  19. mechanisms whose judicious use
  20. lets you type a document
  21. with less effort and organize
  22. it
  23. so that extensive format changes
  24. can be made with few editing changes.
  25. .PP
  26. A reference to a string is replaced by whatever
  27. text
  28. the string was defined as.
  29. Strings are defined with the command
  30. .BD .ds .
  31. The line
  32. .P1
  33. \&^ds e \eo"e\e'"
  34. .P2
  35. defines the string
  36. .BD e
  37. to have the value
  38. .BD \eo"e\e\'"
  39. .PP
  40. String names may be either one or two characters long,
  41. and are referred to by
  42. .BD \e*x
  43. for one character names or
  44. .BD \e*(xy
  45. for two character names.
  46. Thus to get
  47. t\*el\*ephone,
  48. given the definition of the string
  49. .BD e
  50. as above,
  51. we can say
  52. t\e*el\e*ephone.
  53. .PP
  54. If a string must begin with blanks, define it as
  55. .P1
  56. \&.ds xx "      text
  57. .P2
  58. The double quote signals the beginning of the definition.
  59. There is no trailing quote;
  60. the end of the line terminates the string.
  61. .PP
  62. A string may actually be several lines long;
  63. if
  64. .UL troff
  65. encounters a 
  66. .BD \e
  67. at the end of
  68. .ul
  69. any
  70. line, it is thrown away and the next line
  71. added to the current one.
  72. So you can make a long string simply by ending each line
  73. but the last with a backslash:
  74. .P1
  75. \&^ds xx this \e
  76. is a very \e
  77. long string
  78. .P2
  79. .PP
  80. Strings may be defined in terms of other strings, or even in terms of themselves;
  81. we will discuss some of these possibilities later.
  82.