dpost.ps: increase linewidth to match groff
[troff.git] / eqn / tuning.c
blobff72a13723e7bd82aa7a633fbb09ca528fdc4c63
1 #include "e.h"
3 /*
5 This file contains parameter values for many of the
6 tuning parameters in eqn. Names are defined words.
8 Strings are plugged in verbatim.
9 Floats are usually in ems.
13 /* In main.c: */
15 double BeforeSub = 1.2; /* line space before a subscript */
16 double AfterSub = 0.2; /* line space after a subscript */
18 /* diacrit.c: */
20 double Dvshift = 0.25; /* vertical shift for diacriticals on tall letters */
21 double Dhshift = 0.025; /* horizontal shift for tall letters */
22 double Dh2shift = 0.05; /* horizontal shift for small letters */
23 double Dheight = 0.25; /* increment to height for diacriticals */
24 double Barv = 0.68; /* vertical shift for bar */
25 double Barh = 0.05; /* 1/2 horizontal shrink for bar */
26 double Ubarv = 0.1; /* shift underbar up this much ems */
27 double Ubarh = 0.05; /* 1/2 horizontal shrink for underbar */
29 /* Also:
30 Vec, Dyad, Hat, Tilde, Dot, Dotdot, Utilde */
32 /* eqnbox.c: */
34 char *IRspace = "\\^"; /* space between italic & roman boxes */
36 /* fat.c: */
38 double Fatshift = 0.05; /* fattening shifts by Fatshift ems */
40 /* funny.c: */
42 int Funnyps = 5; /* point size change (== 5 above) */
43 double Funnyht = 0.2; /* height correction */
44 double Funnybase = 0.3; /* base correction */
46 /* integral.c: */
48 int Intps = 4; /* point size change for integral (== 4 above) */
49 double Intht = 1.15; /* ht of integral in ems */
50 double Intbase = 0.3; /* base in ems */
51 double Int1h = 0.4; /* lower limit left */
52 double Int1v = 0.2; /* lower limit down */
53 double Int2h = 0.05; /* upper limit right was 8 */
54 double Int2v = 0.1; /* upper limit up */
56 /* matrix.c: */
58 char *Matspace = "\\ \\ "; /* space between matrix columns */
60 /* over.c: */
62 double Overgap = 0.3; /* gap between num and denom */
63 double Overwid = 0.5; /* extra width of box */
64 double Overline = 0.1; /* extra length of fraction bar */
66 /* paren.c* */
68 double Parenbase = 0.4; /* shift of base for even count */
69 double Parenshift = 0.13; /* how much to shift parens down in left ... */
70 /* ignored unless postscript */
71 double Parenheight = 0.3; /* extra height above builtups */
73 /* pile.c: */
75 double Pilegap = 0.4; /* gap between pile elems */
76 double Pilebase = 0.5; /* shift base of even # of piled elems */
78 /* shift.c: */
80 double Subbase = 0.2; /* subscript base belowe main base */
81 double Supshift = 0.4; /* superscript .4 up main box */
82 char *Sub1space = "\\|"; /* italic sub roman space */
83 char *Sup1space = "\\|"; /* italic sup roman space */
84 char *Sub2space = "\\^"; /* space after subscripted thing */
85 char *SS1space = "\\^"; /* space before sub in x sub i sup j */
86 char *SS2space = "\\^"; /* space before sup */
88 /* sqrt.c: */
89 /* sqrt is hard! punt for now. */
90 /* part of the problem is that every typesetter does it differently */
91 /* and we have several typesetters to run. */
93 /* text.c: */
94 /* ought to be done by a table */
96 struct tune {
97 char *name;
98 char *cval;
99 } tune[] ={
100 /* diacrit.c */
101 "vec_def", "\\f1\\v'-.5m'\\s-3\\(->\\s0\\v'.5m'\\fP", /* was \s-2 & .45m */
102 "dyad_def", "\\f1\\v'-.5m'\\s-3\\z\\(<-\\|\\(->\\s0\\v'.5m'\\fP",
103 "hat_def", "\\f1\\v'-.05m'\\s+1^\\s0\\v'.05m'\\fP", /* was .1 */
104 "tilde_def", "\\f1\\v'-.05m'\\s+1~\\s0\\v'.05m'\\fP",
105 "dot_def", "\\f1\\v'-.67m'.\\v'.67m'\\fP",
106 "dotdot_def", "\\f1\\v'-.67m'..\\v'.67m'\\fP",
107 "utilde_def", "\\f1\\v'1.0m'\\s+2~\\s-2\\v'-1.0m'\\fP",
108 /* funny.c */
109 "sum_def", "\\|\\v'.2m'\\s+5\\(su\\s-5\\v'-.2m'\\|",
110 "union_def", "\\|\\v'.2m'\\s+5\\(cu\\s-5\\v'-.2m'\\|",
111 "inter_def", "\\|\\v'.2m'\\s+5\\(ca\\s-5\\v'-.2m'\\|",
112 "prod_def", "\\|\\v'.2m'\\s+5\\(pr\\s-5\\v'-.2m'\\|",
113 /* integral.c */
114 "int_def", "\\v'.1m'\\s+4\\(is\\s-4\\v'-.1m'",
115 0, 0
118 tbl *ftunetbl[TBLSIZE]; /* user-defined names */
120 char *ftunes[] ={ /* this table intentionally left small */
121 "Subbase",
122 "Supshift",
126 void init_tune(void)
128 int i;
130 for (i = 0; tune[i].name != NULL; i++)
131 install(deftbl, tune[i].name, tune[i].cval, 0);
132 for (i = 0; ftunes[i] != NULL; i++)
133 install(ftunetbl, ftunes[i], (char *) 0, 0);
136 #define eq(s, t) (strcmp(s,t) == 0)
138 void ftune(char *s, char *t) /* brute force for now */
140 double f = atof(t);
141 double *target;
143 while (*t == ' ' || *t == '\t')
144 t++;
145 if (eq(s, "Subbase"))
146 target = &Subbase;
147 else if (eq(s, "Supshift"))
148 target = &Supshift;
149 if (t[0] == '+' || t[0] == '-')
150 *target += f;
151 else
152 *target = f;