Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/darrow.m4

raw
1 divert(-1)
2 darrow.m4 Macros for double lines and arrows
3
4 * Circuit_macros Version 11.0, copyright (c) 2026 J. D. Aplevich under *
5 * the LaTeX Project Public Licence in file Licence.txt. The files of *
6 * this distribution may be redistributed or modified provided that this *
7 * copyright notice is included and provided that modifications are clearly *
8 * marked to distinguish them from this distribution. There is no warranty *
9 * whatsoever for these files. *
10
11 ` Some of these macros have uncomfortably many arguments for specifying
12 options, so wrappers beginning with upper-case letters (Dline,
13 Darrow, Darc) are provided and implement key=val;key=val... option
14 specifications. Sometimes however, cleaner code results from using
15 the original macros. Could these be written in a more straightforward
16 fashion? Probably, but the current versions have evolved from macros
17 written very early on and backward compatibility has been kept, with
18 only a few exceptions.
19
20 The drawn elements are
21 darc darrow dend dleft dline dright dtee dturn
22 and there are wrappers
23 Darc Darrow Dline
24 '
25 define(`darrow_')
26 ifdef(`libgen_',,`include(libgen.m4)divert(-1)')
27
28 =============================================================================
29 # Style defaults:
30 Default width (thickness) of double lines
31 define(`dlthick',`(0.08*scale+lthick)')
32
33 `ELement fill color (default white)
34 e.g. define(`dfillcolor',`1,0.84,0')'
35 define(`dfillcolor',`1,1,1') `=white'
36
37 define(`dfillgrey',1) `fill shade for gpic'
38 define(`darcrad',`dlthick*2') `default darc radius'
39 define(`dfillext',0.25bp__) `extended length of dtee, dleft, dright fill'
40
41 `Default length:'
42 ifdef(`elen_',,`define(`elen_',linewid*3/2)')
43 =============================================================================
44
45 `deleminit_(linespec,len,dlinethick)
46 dline initialization'
47 define(`deleminit_',`define(`m4dlthk',ifelse(`$3',,dlthick,`$3'))dnl
48 rpoint_(ifelse(`$1',,`to rvec_(ifelse(`$2',,linewid,`$2'),0)',`$1')) ')
49
50
51 `above, below, ljust, rjust but displaced
52 by dlthick/2 eg "string" dabove(at position)'
53 define(`dabove',`above ifelse(`$1',,`at Here',`$1')+(0,dlthick/2)')
54 define(`dbelow',`below ifelse(`$1',,`at Here',`$1')-(0,dlthick/2)')
55 define(`dljust',`ljust ifelse(`$1',,`at Here',`$1')+(dlthick/2,0)')
56 define(`drjust',`rjust ifelse(`$1',,`at Here',`$1')-(dlthick/2,0)')
57
58 `dline(linespec,start truncation,end truncation,dlthick, ends,
59 outline attributes, inner attributes )
60 ends= blank, x-x, -x, x-, where x means ! or |'
61 define(`dline',`deleminit_(`$1',,`$4')
62 M4DL: line invis from last line.start to last line.end \
63 chop ifelse(`$2',,0,m4dlthk/2) chop ifelse(`$3',,0,m4dlthk/2)
64 {line thick m4dlthk/(1bp__) `$6' from M4DL.start to M4DL.end }
65 ifelse(rgbstring(dfillcolor),"",,
66 `{line thick m4dlthk/(1bp__)-2*linethick \
67 ifelse(`$7',,`outlined rgbstring(dfillcolor)',`$7') \
68 from M4DL.start \
69 ifinstr(`$5',|-,`+vec_(lthick,0)',`$5',!-,`+vec_(lthick/2,0)') \
70 to M4DL.end \
71 ifinstr(`$5',-|,`-vec_(lthick,0)',`$5',-!,`-vec_(lthick/2,0)') }')
72 ifgpic(`M4dV: vec_(0,m4dlthk/2-lthick/2); shade(dfillgrey,
73 {line from M4DL.start+(M4dV.x,M4dV.y) to M4DL.end+(M4dV.x,M4dV.y)}
74 {line from M4DL.start-(M4dV.x,M4dV.y) to M4DL.end-(M4dV.x,M4dV.y)})')
75 line invis from M4DL.start to M4DL.end')
76
77 `dleft(at position,dlthick,attribs)
78 Turn left, leaving current location
79 at exit of corner.
80 attribs=
81 innershade=(r,g,b)|"color";
82 outline=(r,g,b)|"color";'
83 define(`dleft',`deleminit_(,ifelse(`$2',,dlthick,`$2'),`$2')
84 pushkeys_(`$3',innershade::N;outline::N;) dnl
85 ifelse(`$1',,,`move to substr(`$1',eval(index(`$1',t)+1))-vec_(m4dlthk/2,0)')
86 { line thick m4dlthk/(1bp__) to rvec_(m4dlthk,0) }
87 ifelse(rgbstring(dfillcolor),"",,
88 `{line thick m4dlthk/(1bp__)-2*linethick \
89 m4fixcolor(outlined,m4innershade,`dfillcolor') \
90 to rvec_(m4dlthk/2,0) then to rvec_(m4dlthk/2,m4dlthk/2+dfillext)}
91 move to rvec_(m4dlthk/2,0) then to rvec_(m4dlthk/2,m4dlthk/2) ')
92 ifgpic(`{line from rvec_(0,m4dlthk/2-lthick/2) to rvec_(0,m4dlthk/2-lthick/2)}
93 {line from rvec_(m4dlthk-lthick/2,m4dlthk/2) \
94 to rvec_(m4dlthk-lthick/2,-m4dlthk/2+lthick/2) then \
95 to rvec_(0,-m4dlthk/2+lthick/2)}
96 move to rvec_(m4dlthk/2,m4dlthk/2)') popdef(`m4innershade',`m4outline')
97 rp_ang = rp_ang+pi__/2')
98 `dright(at position,dlthick,attribs)
99 Turn right, leaving current location
100 at exit of corner.
101 attribs=
102 innershade=(r,g,b)|"color";
103 outline=(r,g,b)|"color";'
104 define(`dright',`deleminit_(,ifelse(`$2',,dlthick,`$2'),`$2')
105 pushkeys_(`$3',innershade::N;outline::N;) dnl
106 ifelse(`$1',,,`move to substr(`$1',eval(index(`$1',t)+1))-vec_(m4dlthk/2,0)')
107 { line thick m4dlthk/(1bp__) to rvec_(m4dlthk,0) }
108 ifelse(rgbstring(dfillcolor),"",,
109 `{line thick m4dlthk/(1bp__)-2*linethick \
110 m4fixcolor(outlined,m4innershade,`dfillcolor') \
111 to rvec_(m4dlthk/2,0) then to rvec_(m4dlthk/2,-m4dlthk/2-dfillext)}
112 move to rvec_(m4dlthk/2,0) then to rvec_(m4dlthk/2,-m4dlthk/2) ')
113 ifgpic(`{line from rvec_(0,-m4dlthk/2+lthick/2) \
114 to rvec_(0,-m4dlthk/2+lthick/2)}
115 {line from rvec_(m4dlthk-lthick/2,-m4dlthk/2) \
116 to rvec_(m4dlthk-lthick/2,m4dlthk/2-lthick/2) then \
117 to rvec_(0,m4dlthk/2-lthick/2)}
118 move to rvec_(m4dlthk/2,-m4dlthk/2)') popdef(`m4innershade',`m4outline')
119 rp_ang = rp_ang-pi__/2')
120
121 `m4fixcolor(outlined|shaded,"colorname"|(r,g,b),colormacro)
122 define(`colormacro',`r,g,b')'
123 define(`m4fixcolor',`ifelse(`$2',,`ifelse(`$3',,,``$1' rgbstring($3)')',
124 index(`$2',`"'),0,``$1' `$2'' ,
125 ``$1' rgbstring(m4ctrunc(`$2'))')')
126
127 `dturn(arg,dlthick,attribs)
128 Turn arg relative degrees ccw
129 attribs=
130 innershade=(r,g,b)|"color";
131 outline=(r,g,b)|"color";'
132 define(`dturn',`deleminit_(,ifelse(`$2',,dlthick,`$2'),`$2')
133 [S: Here pushkeys_(`$3',innershade::N;outline::N;)
134 deg = ifelse(`$1',,0,`$1')
135 c = cosd(deg); s = sind(deg); sgn = sign(deg); r = (dlthick-lthick)/2
136 G: S+vec_(lthick/2*abs(s),sgn*dlthick/2)
137 A: S+vec_(lthick/2*abs(s),sgn*r)
138 B: A+vec_(vscal_(lthick/2*abs(s),c,s))
139 H: G+vec_(vscal_(lthick/2*abs(s),c,s))
140 C: S+vec_(0, sgn*r)
141 J: S+vec_(0, sgn*dlthick/2)
142 if deg==0 then {t = 0} else { t = (1-c)/s } # t = tan(deg/2)
143 D: A+vec_(vscal_(r*2,sgn*t,-sgn))
144 E: B+vec_(vscal_(r*2,sgn*s,-sgn*c))
145 F: S+vec_(0,-sgn*r)
146 X: 0.5 between B and E
147 ifelse(rgbstring(dfillcolor),`""',,`line thick 0 \
148 m4fixcolor(outlined,m4innershade,`dfillcolor') \
149 m4fixcolor(shaded,m4innershade,`dfillcolor') \
150 from S to F then to D then to E then to H then to G then to J then to S')
151 ifgpic(`m4tmpth = linethick; linethick=0
152 shade(dfillgrey,`line from C to A then to B; line from E to D then to F')
153 linethick = m4tmpth')
154 line thick lthick/(1bp__) m4fixcolor(outlined,m4outline) from C to A then to B
155 line thick lthick/(1bp__) m4fixcolor(outlined,m4outline) from E to D then to F
156 # Loopover_(`Px',`"Px" at Px above;', A,B,C,D,E,F,S,X)
157 # Loopover_(`Px',`"Px" at Px above;', G,H,J)
158 `$4' popdef(`m4innershade',`m4outline')] with .S at Here
159 move to last [].X
160 ifelse(`$1',,,`Point_(`$1'+rp_ang*rtod_)') ')
161
162 `darrow(linespec, start truncation, end truncation, dlthick,
163 arrowhd wid, arrowhd ht, terminals,color attribs)
164 terminals is blank or x-, ->, x->, <-, <-x, <-> where x is
165 ! for closed end with half-width line or
166 | for closed end with full-width line'
167 `e.g.,
168 linethick=5; rgbdraw(1,0,0,darrow(down_ 2,,,0.5,0.75,0.75,|)'
169
170 define(`darrow',`deleminit_(`$1',,`$4')
171 arrow invis from last line.start to last line.end
172 ifelse(ifinstr(`$7',<->,,`$7',<-,T),T,
173 `define(`m4dx',`ifinstr(`$7',|,|,`$7',!,!)'->)dnl
174 M4DA: line invis from last line.end to last line.start \
175 chop ifelse(`$3',,0,m4dlthk/2) chop ifelse(`$2',,0,m4dlthk/2)
176 rp_ang = rp_ang+pi__',
177 `define(`m4dx',`$7')dnl
178 M4DA: line invis from last line.start to last line.end \
179 chop ifelse(`$2',,0,m4dlthk/2) chop ifelse(`$3',,0,m4dlthk/2)')
180 [ C: M4DA.c; S: M4DA.start; E: M4DA.end
181 w = ifelse(`$5',,m4dlthk*3/2,`$5')
182 h = ifelse(`$6',,m4dlthk,`$6')
183 d = sqrt((w/2)^2+h^2)
184 p = d/w*lthick
185 V: vec_(0,m4dlthk/2-lthick/2)
186 T: vec_(h-lthick/2,0)
187 P: vec_(p,0)
188 Vt: vec_(0,w/2/h * (h-lthick/2-p))
189 W: vec_(lthick/2,0)
190 X: ifinstr(`$7',<->,C,m4dx,!,S,m4dx,|,S+(W.x,W.y),S)
191 ifgpic(`shade(dfillgrey,') line dnl
192 ifelse(rgbstring(dfillcolor),"",,`shaded rgbstring(dfillcolor)') `$8' from dnl
193 ifinstr(m4dx,|,`X to X+(V.x,V.y) then',`X+(V.x,V.y)') to \
194 E-(T.x,T.y)+(V.x,V.y) then to E-(T.x,T.y)+(Vt.x,Vt.y) \
195 then to E-(P.x,P.y) \
196 then to E-(T.x,T.y)-(Vt.x,Vt.y) then to E-(T.x,T.y)-(V.x,V.y) \
197 then to dnl
198 ifinstr(m4dx,<-,
199 `S+(T.x,T.y)-(V.x,V.y) then to S+(T.x,T.y)-(Vt.x,Vt.y) \
200 then to S+(P.x,P.y) \
201 then to S+(T.x,T.y)+(Vt.x,Vt.y) then to S+(T.x,T.y)+(V.x,V.y) \
202 then to X+(V.x,V.y)',
203 m4dx,|,
204 `X-(V.x,V.y) then to X',
205 m4dx,!,
206 `S-(V.x,V.y); line thick linethick/2 from S+(W.x/2,W.y/2)-(V.x,V.y) \
207 to S+(W.x/2,W.y/2)+(V.x,V.y)
208 line from S+(V.x,V.y) to X+(V.x,V.y)',
209 `X-(V.x,V.y)') ifgpic(`)')
210 ] with .C at M4DA.c
211 ifelse(ifinstr(`$7',<->,,`$7',<-,T),T,
212 `rp_ang = rp_ang-pi__
213 arrow invis from M4DA.end to M4DA.start',
214 `arrow invis from M4DA.start to M4DA.end')
215 ')
216
217 `dtee([L|R],dlthick|attribs)
218 Construct tee with tail to back (default), left,
219 or right of current direction, leaving current
220 location at tee centre; eg
221 dline(right_,,t); dtee(R);
222 { darrow(down_,t) }; darrow(right_,t)
223 attribs:
224 thick=expr; (line thickness in drawing units)
225 innershade=(r,g,b)|"color";
226 outline=(r,g,b)|"color";'
227 define(`dtee',`pushkeys_(`$2',thick:m4nil;innershade::N;outline::N;)dnl
228 deleminit_(,ifelse(m4thick,(m4nil),dlthick,m4thick))
229 move to last line.c
230 ifelse(`$1',L,`rp_ang = rp_ang-pi_/2', `$1',R,`rp_ang = rp_ang+pi_/2')
231 ifelse(m4innershade,,,`pushdef(`dfillcolor',`m4ctrunc(m4innershade)')') dnl
232 {line thick m4dlthk/(1bp__) dnl
233 ifelse(m4outline,,,index(m4outline,`"'),0,`outlined m4outline',
234 `outlined rgbstring(m4ctrunc(m4outline))') dnl
235 from rvec_(-m4dlthk/2,0) to rvec_(m4dlthk/2,0)}
236 pushdef(`m4dll',(m4dlthk/2+dfillext))dnl
237 pushdef(`m4df',`rgbstring(dfillcolor)')dnl
238 ifelse(m4df,"",,
239 `{line thick m4dlthk/(1bp__)-2*linethick outlined m4df to rvec_(-m4dll,0) }
240 {line thick m4dlthk/(1bp__)-2*linethick outlined m4df \
241 from rvec_(0,-m4dll) to rvec_(0,m4dll) } ')
242 ifgpic(`m4tmpth = linethick; linethick=0; shade(dfillgrey,
243 {line from rvec_(-m4dlthk/2, m4dlthk/2) to rvec_( m4dlthk/2, m4dlthk/2)}
244 {line from rvec_( m4dlthk/2,-m4dlthk/2) to rvec_(-m4dlthk/2,-m4dlthk/2)})
245 linethick = m4tmpth')
246 ifelse(m4innershade,,,`popdef(`dfillcolor')')dnl
247 popdef(`m4thick',`m4innershade',`m4outline',`m4dll',`m4df')')
248
249 `dend([at position],dlthick|attribs)
250 Close off line end
251 attribs:
252 thick=expr; (line thickness in drawing units)
253 outline=(r,g,b)|"color";'
254 define(`dend',`pushkeys_(`$2',thick:m4nil;outline::N;)dnl
255 pushdef(`m4thk',`ifelse(m4thick,(m4nil),dlthick,m4thick)')dnl
256 ifelse(`$1',,,`move to patsubst(`$1',`^ *at *')')
257 {line ifelse(m4outline,,,`outlined m4outline') ifinstr(`$2',=,,`$2') dnl
258 from rvec_(0,-m4thk/2) to rvec_(0,m4thk/2) }
259 move to rvec_(last line.thick pt__/2,0)dnl
260 popdef(`m4thick',`m4outline',`m4thk')')
261
262 `darc(center pos, radius, start radians, end radians, dlthick,
263 arrow wid, arrow ht, symbols,
264 outline attributes, inner attributes )
265 draw CCW arc in a [ ] block
266 symbols= x-, -x, x-x, ->, x->, <-, <-x, <->
267 where x is | or ! ; arrowheads for dpic only '
268 pushdef(`darc',`pushdef(`m4r',`(ifelse(`$2',,darcrad,`($2)'))') dnl
269 pushdef(`m4C',`ifelse(`$1',,rvec_(0,m4r),`$1')') dnl
270 pushdef(`m4as',`(ifelse(`$3',,rp_ang-pi__/2,`$3'))') dnl
271 pushdef(`m4ae',`(ifelse(`$4',,m4as+pi__/2,`$4'))') dnl
272 arc invis from m4C+(rect_(m4r,m4as)) to m4C+(rect_(m4r,m4ae)) with .c at m4C
273 C_darc: last arc.c; Start_darc: last arc.start; End_darc: Here
274 r_darc = m4r; as_darc = m4as; ae_darc = m4ae popdef(`m4r',`m4C',`m4as',`m4ae')
275 dlth_darc=ifelse(`$5',,dlthick,(`$5'))
276 w_darc = ifelse(`$6',,dlth_darc*1.75,(`$6'))
277 h_darc = ifelse(`$7',,dlth_darc,(`$7'))
278 p_darc = sqrt((w_darc/2)^2+h_darc^2)/(w_darc/2)*lthick
279 tas_darc = as_darc ifinstr(`$8',<-,`+ p_darc/r_darc')
280 tae_darc = ae_darc ifinstr(`$8',->,`- p_darc/r_darc')
281 TS: C_darc+(rect_(r_darc,tas_darc))
282 TE: C_darc+(rect_(r_darc,tae_darc))
283 { arc thick dlth_darc/(1bp__) wid w_darc ht h_darc dnl
284 ifinstr(`$8',<-,<-`'ifinstr(`$8',->,>),`$8',->,->) dnl
285 `$9' from Start_darc to End_darc with .c at C_darc }
286 pushdef(`m4inn',`ifelse(`$10',,`ifelse(rgbstring(dfillcolor),"",,
287 ifdef(`dfillcolor',T),T,`outlined rgbstring(dfillcolor)')',`$10')') dnl
288 ifelse(m4inn,,,
289 `arc thick dlth_darc/(1bp__)-linethick*2 \
290 wid (h_darc-p_darc-lthick)/h_darc*w_darc ht h_darc-p_darc-lthick \
291 ifinstr(`$8',<-,<-`'ifinstr(`$8',->,>),`$8',->,->) \
292 m4inn from TS to TE with .c at C_darc') popdef(`m4inn')
293 ifinstr(`$8',|-,`X: (vscal_(lthick/2,-sin(as_darc),cos(as_darc)))
294 line `$9' \
295 from C_darc+(rect_(r_darc+dlth_darc/2-lthick/2,as_darc))+X to \
296 C_darc+(rect_(r_darc-dlth_darc/2+lthick/2,as_darc))+X',
297 `$8',!-,`X: (vscal_(lthick/4,-sin(as_darc),cos(as_darc)))
298 line `$9' thick linethick/2 \
299 from C_darc+(rect_(r_darc+dlth_darc/2-lthick/4,as_darc))+X to \
300 C_darc+(rect_(r_darc-dlth_darc/2+lthick/4,as_darc))+X')
301 ifinstr(`$8',-|,`X: (vscal_(lthick/2,-sin(ae_darc),cos(ae_darc)))
302 line `$9' from C_darc+(rect_(r_darc+dlth_darc/2-lthick/2,ae_darc))-X to \
303 C_darc+(rect_(r_darc-dlth_darc/2+lthick/2,ae_darc))-X',
304 `$8',-!,`X: (vscal_(lthick/4,-sin(ae_darc),cos(ae_darc)))
305 line `$9' thick linethick/2 \
306 from C_darc+(rect_(r_darc+dlth_darc/2-lthick/4,ae_darc))-X to \
307 C_darc+(rect_(r_darc-dlth_darc/2+lthick/4,ae_darc))-X')
308 rp_ang := ae_darc+pi__/2 ')
309
310 `Darc(center pos, radius, start radians, end radians, params)
311 or
312 Darc(,params)
313 draw CCW arc
314 params is a semicolon-separated list:
315 thick=val; (total thicknes, ie width)
316 wid=val; (arrowhead width)
317 ht=val; (arrowhead height)
318 outline=color; (e.g. "red" or (1,0,0) )
319 innershade=color; (e.g. (0,1,1) or "cyan")
320 ends= x-, -x, x-x, ->, x->, <-, <-x, <-> where x is ! or |
321 < and > work for dpic only
322 |- closed end with full-width line
323 !- closed end with half-width line
324 If arg1 is null then the additional list items are accepted:
325 centre=Position;
326 rad=expr;
327 startdeg=degrees; NOTE: degrees
328 enddeg=degrees; NOTE: degrees
329 eg Darc(C,r,ang1,ang2,ends=<-|)'
330 define(`Darc',
331 `pushkeys_(ifelse(`$1',,`$2',`$5'),thick:dlthick;wid:dlthick*1.75;ht:dlthick;
332 outline::N;innershade::N;ends::N;centre:Here:N;rad:darcrad;
333 startdeg::;enddeg::;)dnl
334 pushdef(`m4ou',`m4fixcolor(outlined,m4outline)')dnl
335 pushdef(`m4sh',`m4fixcolor(outlined,m4innershade,`dfillcolor')')dnl
336 ifelse(`$1',,
337 `darc(m4centre,m4rad,m4startdeg*dtor_,m4enddeg*dtor_,
338 m4thick,m4wid,m4ht,m4ends,m4ou,m4sh)',
339 `darc(`$1',`$2',ifelse(m4startdeg,,`$3',m4startdeg*dtor_),
340 ifelse(m4enddeg,,`$4',m4enddeg*dtor_),
341 m4thick,m4wid,m4ht,m4ends,m4ou,m4sh)') dnl
342 popdef(`m4thick',`m4wid',`m4ht',`m4outline',`m4innershade',`m4ends',
343 `m4centre',`m4rad',`m4startdeg',`m4enddeg',`m4ou',`m4sh')')')
344
345 `darrow(linespec,params)
346 params is a semicolon-separated list of items:
347 s; truncate at start by dline thickness/2
348 e; truncate at end by dline thickness/2
349 thick=expr; (total thicknes, ie width)
350 wid=expr; (arrowhead width)
351 ht=expr; (arrowhead height)
352 outline=color; (e.g. "red" or (1,0,0) )
353 innershade=color; (e.g. (0,1,1) or "cyan")
354 name=name; (name of underlying invis line)
355 ends= -> or x-> or <- or <-x or <-> where x is | or !
356 |- closed end with full-width line
357 !- closed end with half-width line
358 eg Darrow(from A to B,E;ends=<-|)'
359 define(`Darrow',
360 `pushkeys_(`$2',thick:dlthick;wid:dlthick*3/2;ht:dlthick;
361 outline::N;innershade::N;name::N;ends::N;)dnl
362 ifelse(m4innershade,,,`pushdef(`dfillcolor',`m4ctrunc(m4innershade)')')dnl
363 pushdef(`m4nm',ifelse(m4name,,,m4name:))dnl
364 ifelse(m4outline,,
365 `m4nm darrow(`$1',ifinstr(`$2',S,t),ifinstr(`$2',E,t),
366 m4thick,m4wid,m4ht,m4ends)',
367 index(m4outline,`"'),0,
368 `m4nm darrow(`$1',ifinstr(`$2',S,t),ifinstr(`$2',E,t),
369 m4thick,m4wid,m4ht,m4ends,outlined m4outline)',
370 `rgbdraw(m4ctrunc(m4outline),
371 m4nm darrow(`$1',ifinstr(`$2',S,t),ifinstr(`$2',E,t),
372 m4thick,m4wid,m4ht,m4ends))')
373 ifelse(m4innershade,,,`popdef(`dfillcolor')')dnl
374 popdef(`m4ends',`m4thick',`m4wid',`m4ht',`m4outline',`m4innershade',`m4name',
375 `m4nm')')
376
377 `Dline(linespec,params)
378 params is a semicolon-separated list of items:
379 S; truncate at start by dline thickness/2
380 E; truncate at end by dline thickness/2
381 thick=val; (total thicknes, ie width)
382 outline=color; (e.g. "red" or (1,0,0) )
383 innershade=color; (e.g. (0,1,1) or "cyan")
384 name=Name;
385 ends= x-x; or -x; or x-; where x is ! or |
386 |- closed end with full-width line
387 !- closed end with half-width line
388 eg Dline(from A to B,E;ends=|-)'
389 define(`Dline',
390 `pushkeys_(`$2',thick:dlthick;outline::N;innershade::N;ends::N;name::N;)dnl
391 ifelse(m4name,,,m4name:) dline(`$1',ifinstr(`$2',S;,t),ifinstr(`$2',E;,t),
392 m4thick,m4ends,m4fixcolor(outlined,m4outline),
393 m4fixcolor(outlined,m4innershade,`dfillcolor'))
394 popdef(`m4thick',`m4outline',`m4innershade',`m4ends',`m4name') ')
395
396 define(`m4ctrunc',`substr(`$1',1,eval(len(`$1')-2))')
397
398 #efine(`mark',`{dot(at `$1'); "`$1'" at last [].s below}')
399 #efine(`pure',`patsubst(`$1',`"',`\\"')')
400 divert(0)dnl