home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 4 / DATAFILE_PDCD4.iso / unix / riscbsd / 1_1_contri / usd / 25_trofftu / tt07 < prev    next >
Encoding:
Text File  |  1986-05-23  |  1.7 KB  |  84 lines

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