]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/doc/usd/22.trofftut/tt07
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / share / doc / usd / 22.trofftut / tt07
1 .\" This module is believed to contain source code proprietary to AT&T.
2 .\" Use and redistribution is subject to the Berkeley Software License
3 .\" Agreement and your Software Agreement with AT&T (Western Electric).
4 .\"
5 .\"     @(#)tt07        8.1 (Berkeley) 6/8/93
6 .\" Copyright (C) Caldera International Inc. 2001-2002.  All rights reserved.
7 .\" 
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions are
10 .\" met:
11 .\" 
12 .\" Redistributions of source code and documentation must retain the above
13 .\" copyright notice, this list of conditions and the following
14 .\" disclaimer.
15 .\" 
16 .\" Redistributions in binary form must reproduce the above copyright
17 .\" notice, this list of conditions and the following disclaimer in the
18 .\" documentation and/or other materials provided with the distribution.
19 .\" 
20 .\" All advertising materials mentioning features or use of this software
21 .\" must display the following acknowledgement:
22 .\" 
23 .\" This product includes software developed or owned by Caldera
24 .\" International, Inc.  Neither the name of Caldera International, Inc.
25 .\" nor the names of other contributors may be used to endorse or promote
26 .\" products derived from this software without specific prior written
27 .\" permission.
28 .\" 
29 .\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
30 .\" INTERNATIONAL, INC.  AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
31 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
32 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33 .\" DISCLAIMED.  IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE
34 .\" FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR
35 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
36 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
37 .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
38 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
39 .\" OR OTHERWISE) RISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
40 .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 .\" 
42 .\" $FreeBSD$
43 .\"
44 .NH
45 Strings
46 .PP
47 Obviously if a paper contains a large number of occurrences
48 of an acute accent over a letter `e',
49 typing
50 .BD \eo"e\e\'"
51 for each \*e
52 would be a great nuisance.
53 .PP
54 Fortunately,
55 .UL troff
56 provides a way in which you can store an arbitrary
57 collection of text in a `string',
58 and thereafter use the string name as a shorthand
59 for its contents.
60 Strings are one of several
61 .UL troff
62 mechanisms whose judicious use
63 lets you type a document
64 with less effort and organize
65 it
66 so that extensive format changes
67 can be made with few editing changes.
68 .PP
69 A reference to a string is replaced by whatever
70 text
71 the string was defined as.
72 Strings are defined with the command
73 .BD .ds .
74 The line
75 .P1
76 \&^ds e \eo"e\e'"
77 .P2
78 defines the string
79 .BD e
80 to have the value
81 .BD \eo"e\e\'"
82 .PP
83 String names may be either one or two characters long,
84 and are referred to by
85 .BD \e*x
86 for one character names or
87 .BD \e*(xy
88 for two character names.
89 Thus to get
90 t\*el\*ephone,
91 given the definition of the string
92 .BD e
93 as above,
94 we can say
95 t\e*el\e*ephone.
96 .PP
97 If a string must begin with blanks, define it as
98 .P1
99 \&.ds xx "      text
100 .P2
101 The double quote signals the beginning of the definition.
102 There is no trailing quote;
103 the end of the line terminates the string.
104 .PP
105 A string may actually be several lines long;
106 if
107 .UL troff
108 encounters a 
109 .BD \e
110 at the end of
111 .ul
112 any
113 line, it is thrown away and the next line
114 added to the current one.
115 So you can make a long string simply by ending each line
116 but the last with a backslash:
117 .P1
118 \&^ds xx this \e
119 is a very \e
120 long string
121 .P2
122 .PP
123 Strings may be defined in terms of other strings, or even in terms of themselves;
124 we will discuss some of these possibilities later.