summaryrefslogtreecommitdiff
path: root/graphics/circuit_macros/examples/extras
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/circuit_macros/examples/extras')
-rw-r--r--graphics/circuit_macros/examples/extras/Ant.m430
-rw-r--r--graphics/circuit_macros/examples/extras/Asymptotes.m493
-rw-r--r--graphics/circuit_macros/examples/extras/Birds.m4 (renamed from graphics/circuit_macros/examples/extras/birds.m4)0
-rw-r--r--graphics/circuit_macros/examples/extras/Bistable.m4 (renamed from graphics/circuit_macros/examples/extras/bistable.m4)0
-rw-r--r--graphics/circuit_macros/examples/extras/Brace.m4 (renamed from graphics/circuit_macros/examples/extras/brace.m4)0
-rw-r--r--graphics/circuit_macros/examples/extras/Ccurve.m414
-rw-r--r--graphics/circuit_macros/examples/extras/Chaos.m4 (renamed from graphics/circuit_macros/examples/extras/chaos.m4)0
-rw-r--r--graphics/circuit_macros/examples/extras/Chuck.m46
-rw-r--r--graphics/circuit_macros/examples/extras/ClassDAmp.m46
-rw-r--r--graphics/circuit_macros/examples/extras/Cruller.m467
-rw-r--r--graphics/circuit_macros/examples/extras/Cylinder.m443
-rw-r--r--graphics/circuit_macros/examples/extras/HSV.m4 (renamed from graphics/circuit_macros/examples/extras/hsv.m4)0
-rw-r--r--graphics/circuit_macros/examples/extras/Highgain.m410
-rw-r--r--graphics/circuit_macros/examples/extras/Koch.m433
-rw-r--r--graphics/circuit_macros/examples/extras/Makefile44
-rw-r--r--graphics/circuit_macros/examples/extras/Parallel-series.m415
-rw-r--r--graphics/circuit_macros/examples/extras/Person.m4 (renamed from graphics/circuit_macros/examples/extras/person.m4)0
-rw-r--r--graphics/circuit_macros/examples/extras/README_extras2
-rw-r--r--graphics/circuit_macros/examples/extras/Rotellipse.m4 (renamed from graphics/circuit_macros/examples/extras/rotellipse.m4)0
-rw-r--r--graphics/circuit_macros/examples/extras/SampleFlow.m48
-rw-r--r--graphics/circuit_macros/examples/extras/Spec555.m456
-rw-r--r--graphics/circuit_macros/examples/extras/Squiggle.m4 (renamed from graphics/circuit_macros/examples/extras/squiggle.m4)0
-rw-r--r--graphics/circuit_macros/examples/extras/Venus.m4 (renamed from graphics/circuit_macros/examples/extras/venus.m4)0
-rw-r--r--graphics/circuit_macros/examples/extras/ex17.m443
24 files changed, 245 insertions, 225 deletions
diff --git a/graphics/circuit_macros/examples/extras/Ant.m4 b/graphics/circuit_macros/examples/extras/Ant.m4
deleted file mode 100644
index f4a22226a2..0000000000
--- a/graphics/circuit_macros/examples/extras/Ant.m4
+++ /dev/null
@@ -1,30 +0,0 @@
-.PS
-# Ant.m4 (Langton's ant)
-# https://tex.stackexchange.com/questions/361838/how-to-create-a-langtons-ant-in-latex/361891
-# https://en.wikipedia.org/wiki/Langton%27s_ant
-gen_init
-NeedDpicTools
- picwid = 5
- D: (0,0); DD: (1,0); t[D] = 0
- minx = 0; miny = 0; maxx = 0; maxy = 0
- for i = 0 to 10500 do {
- if (t[D]%2) == 0 then { DD: (-DD.y,DD.x) } else { DD: (DD.y,-DD.x) }
- t[D] += 1
- D: D+DD
- if D.x > maxx then { maxx = D.x; for y = miny to maxy do { t[maxx,y] = 0 }} \
- else { if D.x < minx then {
- minx = D.x; for y = miny to maxy do { t[minx,y] = 0 }}}
- if D.y > maxy then { maxy = D.y; for x = minx to maxx do { t[x,maxy] = 0 }} \
- else { if D.y < miny then {
- miny = D.y; for x = minx to maxx do { t[x,miny] = 0 }}}
- }
- boxwid = picwid/(maxx-minx)
- boxht = picwid/(maxy-miny)
- if boxht > boxwid then { boxht = boxwid } else { boxwid = boxht }
- circlerad = boxht/2
- hue = 240; val = 1
- for i = minx to maxx do { for j = miny to maxy do {
- if t[i,j]!=0 then { sat = (t[i,j]%20)/20
- hsvtorgb(hue,sat,val,r,g,b)
- circle colored rgbstring(r,g,b) at (-i,j)*boxwid } }}
-.PE
diff --git a/graphics/circuit_macros/examples/extras/Asymptotes.m4 b/graphics/circuit_macros/examples/extras/Asymptotes.m4
new file mode 100644
index 0000000000..4afd0f5758
--- /dev/null
+++ b/graphics/circuit_macros/examples/extras/Asymptotes.m4
@@ -0,0 +1,93 @@
+.PS
+# Asymptotes.m4
+# https://tex.stackexchange.com/questions/706340/create-an-asymptotes-summary-diagram-for-a-function
+gen_init
+
+definergbcolor(armygreen,0.29,0.33,0.13)
+definergbcolor(vlightgray,0.95,0.95,0.95)
+boxrad = 7bp__
+
+define(`greenbox',`box wid 90bp__ \
+ outlined "armygreen!90" shaded "armygreen!90" \
+ "{\color{white} `$1'}" ')
+
+define(`graybox',`box thick 0.4 outlined "gray" shaded "vlightgray" \
+ `$1'')
+
+ changequote(,) command "\newcommand{\eace}{\'e}
+ \newcommand{\squote}{\char39}
+ \newcommand{\dequation}{d'\'equation}"
+ changequote(`,)
+
+foreach_(`txt',`L`'m4Lx: graybox(wid 72bp__ ht 130 bp__ \
+ "\parbox{72bp}{\begin{centering}
+ {\sf txt \\ \vfill\vbox{}}
+ \end{centering}}")
+ ifelse(m4Lx,6,,`move 10bp__')',
+
+ `$(C_f)$ admet\\ Une asymptote\\ horizontale\\ \dequation:\\
+ $y = a$\\ au voisinage\\ de $\infty$',
+
+ `$(C_f)$ admet\\ Une asymptote\\ oblique\\ \dequation:\\
+ $y = ax+b$\\ au voisinage\\ de $\infty$',
+
+ `\hbox{}\vspace*{0.5\baselineskip}
+ $(C_f)$ admet\\ Une branche\\ parabolique\\ de direction\\
+ la droite\\ \dequation:\\
+ $y = ax$\\ au voisinage\\ de $\infty$',
+
+ `$(C_f)$ admet\\ Une branche\\ parabolique\\ de direction\\
+ l\squote{}axe des\\ ordonn\eace{}s\\ au voisinage\\ de $\infty$',
+
+ `$(C_f)$ admet\\ Une branche\\ parabolique\\ de direction\\
+ l\squote{}axe des\\ abscisses\\ au voisinage\\ de $\infty$',
+
+ `\vspace*{1ex}$(C_f)$ admet\\ Une \\ asymptote\\ verticale\\
+ \dequation:\\[1ex]
+ $x = a$\\ \hbox{}\hfill\hbox{}')
+
+ M: [ M1: graybox(wid 105bp__ \
+ "$\lim\limits_{x\rightarrow\infty} [f(x)-ax] = b$")
+ move 3bp__
+ M2: graybox(wid 105bp__ \
+ "$\lim\limits_{x\rightarrow\infty} [f(x)-ax] = \infty$")
+ ] with .s at ((L2.x+L4.x)/2,L2.n.y+boxht)
+
+ U:[ foreach_(`txt',`U`'m4Lx:graybox(wid 100bp__ ifelse(m4Lx,1,`+20bp__') "txt")
+ ifelse(m4Lx,4,,`move 2bp__')',
+ `$\lim\limits_{x\rightarrow\infty} [f(x)-(ax{+}b)] = 0$',
+ `\(\lim\limits_{x\rightarrow\infty} \frac{f(x)}{x} =
+ \raisebox{-0.5ex}{$a \atop {(a \neq 0)}$}\)',
+ `\(\lim\limits_{x\rightarrow\infty} \frac{f(x)}{x} = \infty \)',
+ `\(\lim\limits_{x\rightarrow\infty} \frac{f(x)}{x} = 0 \)')
+ ] with .s at ((L1.x+L6.x)/2,M.n.y+boxht)
+
+ T1: greenbox($\lim\limits_{x\rightarrow\infty} f(x) = a$) \
+ with .s at (L1.x,U.n.y+boxht)
+ T2: greenbox($\lim\limits_{x\rightarrow\infty} f(x) = \infty$) \
+ with .s at ((L1.x+L6.x)/2,T1.s.y)
+ T3: greenbox($\lim\limits_{x\rightarrow a} f(x) = \infty$) \
+ with .e at (L6.e.x,T2.y)
+
+ linethick_(1)
+ arrow from (U.w.x-5bp__,T1.s.y) down T1.s.y-L1.n.y
+ A: (T2.w.x,T2.s.y+boxrad); B1: U.U1.n+(boxht,0)
+ move to A; arcto((B1,A),B1,boxrad*3/2); arrow to B1
+ A: (U.U3.w.x+boxrad,T2.s.y); arrow from A to (A,U.U3.n)
+ B2: (1/2 between M.M1.e and M.M2.w,U.U2.n)
+ line from A+(-5bp__,0) down_ 10bp__ then left 10bp__
+ arcto((B2,Here),B2,boxrad*3/2); arrow to B2
+ B3: (L5.e.x-2*boxrad,U.U4.n.y)
+ line from A+( 5bp__,0) down_ 10bp__ then right_ 10 bp__
+ arcto((B3,Here),B3,boxrad*3/2); arrow to B3
+ arrow from (B3,U.U4.s) to (B3,L5.n)
+ arrow from (U.U4.e.x+5bp__,T3.s.y) down T3.s.y-L6.n.y
+ line from U.U2.s+(-5bp__,0) down_ 10bp__ then left_ 10bp__
+ arcto((M.M1.n,Here),M.M1.n,boxrad*3/2); arrow to M.M1.n
+ arrow from (Here,M.M1.s) down M.M1.s.y-L2.n.y
+ line from U.U2.s+( 5bp__,0) down_ 10bp__ then right_ 10bp__
+ arcto((M.M2.n,Here),M.M2.n,boxrad*3/2); arrow to M.M2.n
+ arrow from (L3.e.x-boxrad*3/2,M.M2.s.y) down M.M2.s.y-L3.n.y
+ arrow from (M.M2.e.x+5bp__,U.U3.s.y) down U.U3.s.y-L4.n.y
+ arrow from (M.w.x-5bp__,U.U1.s.y) down U.U1.s.y-L2.n.y
+.PE
diff --git a/graphics/circuit_macros/examples/extras/birds.m4 b/graphics/circuit_macros/examples/extras/Birds.m4
index 4b42ea35af..4b42ea35af 100644
--- a/graphics/circuit_macros/examples/extras/birds.m4
+++ b/graphics/circuit_macros/examples/extras/Birds.m4
diff --git a/graphics/circuit_macros/examples/extras/bistable.m4 b/graphics/circuit_macros/examples/extras/Bistable.m4
index ac49023863..ac49023863 100644
--- a/graphics/circuit_macros/examples/extras/bistable.m4
+++ b/graphics/circuit_macros/examples/extras/Bistable.m4
diff --git a/graphics/circuit_macros/examples/extras/brace.m4 b/graphics/circuit_macros/examples/extras/Brace.m4
index b0089fe96d..b0089fe96d 100644
--- a/graphics/circuit_macros/examples/extras/brace.m4
+++ b/graphics/circuit_macros/examples/extras/Brace.m4
diff --git a/graphics/circuit_macros/examples/extras/Ccurve.m4 b/graphics/circuit_macros/examples/extras/Ccurve.m4
deleted file mode 100644
index 6f3b537aac..0000000000
--- a/graphics/circuit_macros/examples/extras/Ccurve.m4
+++ /dev/null
@@ -1,14 +0,0 @@
-.PS
-# Ccurve.m4
-gen_init
-scale = 1.5
-# Gosper C curve
-
-`define' c_curve {if $3==0 then { continue by ($1,$2) } else {
- c_curve( ($1-$2)/2, ($1+$2)/2, $3-1)
- c_curve( ($1+$2)/2, ($2-$1)/2, $3-1)}}
-
-line from 0,4 to 0,4
-c_curve(0,4,10)
-
-.PE
diff --git a/graphics/circuit_macros/examples/extras/chaos.m4 b/graphics/circuit_macros/examples/extras/Chaos.m4
index 17ae070e58..17ae070e58 100644
--- a/graphics/circuit_macros/examples/extras/chaos.m4
+++ b/graphics/circuit_macros/examples/extras/Chaos.m4
diff --git a/graphics/circuit_macros/examples/extras/Chuck.m4 b/graphics/circuit_macros/examples/extras/Chuck.m4
index df83a8ce0e..3d85390e80 100644
--- a/graphics/circuit_macros/examples/extras/Chuck.m4
+++ b/graphics/circuit_macros/examples/extras/Chuck.m4
@@ -216,11 +216,5 @@ dimension_thick
r_dimen(from D[3]+(0,-14) right 35,0,35)
r_dimen(from (0,D[3].y-14) right 35,0,35)
-# arrow <- down 30 left 30 from D[3] chop 16/2 chop 0 then left 5
-# "16 DRILL 23 CBORE" rjust "4 HOLES" rjust
-
-# arrow <- from (-305/2,30.6+10+2) up 5 left 5 then up 13
-# s_box(SEE (A)) with .sw at Here+(-5pt__,2pt__)
-
command "}%"
.PE
diff --git a/graphics/circuit_macros/examples/extras/ClassDAmp.m4 b/graphics/circuit_macros/examples/extras/ClassDAmp.m4
index b8e845cf06..93f73a17cb 100644
--- a/graphics/circuit_macros/examples/extras/ClassDAmp.m4
+++ b/graphics/circuit_macros/examples/extras/ClassDAmp.m4
@@ -9,7 +9,7 @@ Q1: mosfet(down_ dimen_*5/4,R,TFSDdPyQdB)
dot(at Q1.S)
{ line up_ dimen_/4
dot(,,1); "ifsvg(`svg_it(V)svg_sub(DD)',`$V_{\hbox{\scriptsize DD}}$')" \
- at last [].n+(0,0.05) above }
+ at last [].e ljust }
line left_ dimen_*2/3
SW: switch(left_ dimen_,`$1',D); ifelse(`$1',,`rlabel(,SW1)',`llabel(,SW2)')
Q2: mosfet(up_ dimen_*5/4,,TFSDPyQuB) with .D at Q1.D
@@ -27,7 +27,7 @@ T: dot; right_
]')
S1: String
-S2: String(R) with .Q1.S at S1.Q2.D+(0,-2*elen_)
+S2: String(R) with .Q1.S at S1.Q2.D+(0,-3/2*elen_)
I1: line left_ dimen_/2 from S1.Comp.In1
sinusoid(dimen_/4,twopi_/(dimen_/2),-pi_/2,0,dimen_/2) \
with .Start at I1.end-(textoffset,0)
@@ -51,7 +51,7 @@ NO: dot(at N.Out+(dimen_/12,0))
dot
{ line up_ dimen_/2; diode(to (NO,Here),Z); line to NO }
{ capacitor(down_ dimen_); ground(,T,S)
- llabel(,iflatex(C_{\hbox{\scriptsize On}},ifsvg(svg_it(R)`'svg_sub(On)))) }
+ llabel(iflatex(C_{\hbox{\scriptsize On}},ifsvg(svg_it(R)`'svg_sub(On)))) }
line dashed to (S1.SW,Here)
arrow <-> dashed from S1.SW to S2.SW chop dimen_/4
diff --git a/graphics/circuit_macros/examples/extras/Cruller.m4 b/graphics/circuit_macros/examples/extras/Cruller.m4
deleted file mode 100644
index d2c215ae13..0000000000
--- a/graphics/circuit_macros/examples/extras/Cruller.m4
+++ /dev/null
@@ -1,67 +0,0 @@
-.PS
-# Cruller.m4
-threeD_init
-NeedDpicTools
-scale = 2.54
-
-define(`lobe',`(sind(6*(`$1'))+4)/5*2.25')
-
- viewazimuth = 20 # Set view angles in degrees
- viewelevation = 30
- setview(viewazimuth,viewelevation,0)
-
- dt = 3 # major angle degrees per facet
- ds = 10 # minor angle degrees per facet
-
- tradius = 6
-define(`cruller',`rot3Dz((`$1')*dtor_,
- sum3D(0,tradius,0,0,Rect_(lobe(`$2'+2*(`$1')),`$2')))')
-
-define(`tvisible',`dot3D(View3D,
- cross3D(diff3D(cruller(`$1'+dt/2,`$2'),cruller(`$1',`$2')),
- diff3D(cruller(`$1',`$2'+ds/2),cruller(`$1',`$2'))))')
-
- # create the arrays and sort
- n = 0
- for t = dt to 360+dt/2 by dt do {
- for s=ds/2 to 360.1 by ds do {
- if tvisible(t,s) > -0.01 then {
- n +=1
- t[n] = t
- s[n] = s
- d[n] = dot3D(cruller(t,s),view3D1,view3D2,view3D3) # view distance
- ix[n] = n
- }
- } }
-# prval(n)
- dpquicksort(d,1,n,ix)
-
- # Background
-Bne: (9,6)
-Bsw: (-9,-6)
-B: 0.5 between Bne and Bsw
-iflatex(`line fill_(0.75) \
- from (Bsw,Bne) to Bsw then to (Bne,Bsw) then to Bne then to (Bsw,Bne)',
- `ShadedPolygon((Bsw,Bne):Bsw:(Bne,Bsw):Bne,,-30,
- 0,1,1,1,
- .5,.1,.4,0,
- 1,0,0,0) at B')
- # draw the facets
-thinlines_
-[
- rgbtohsv(0.6,0.4,0,h,s,v)
- for i = 1 to n do {
- tc = t[ix[i]]; sc = s[ix[i]]
- SE: (Project(cruller(tc+dt/2,sc-ds/2)))
- SW: (Project(cruller(tc-dt/2,sc-ds/2)))
- NW: (Project(cruller(tc-dt/2,sc+ds/2)))
- NE: (Project(cruller(tc+dt/2,sc+ds/2)))
- f = ((dcosine3D(3,cruller(tc,sc))/2.25+1)/2)^2
- hsvtorgb(h,(1-f)*s,1,r,g,b)
- line outlined rgbstring(r,g,b) shaded rgbstring(r,g,b) ifpdf( invis ) \
- from SE to SW then to NW then to NE then to SE }
- ] at B
-
-thicklines_
-
-.PE
diff --git a/graphics/circuit_macros/examples/extras/Cylinder.m4 b/graphics/circuit_macros/examples/extras/Cylinder.m4
deleted file mode 100644
index abe9a9bac7..0000000000
--- a/graphics/circuit_macros/examples/extras/Cylinder.m4
+++ /dev/null
@@ -1,43 +0,0 @@
-.PS
-# Cylinder.m4
-gen_init(SIdefaults) # lengths are in mm
-
-define(`cylinder',`[ angle = ifelse(`$3',,20,`$3')
- w = ifelse(`$1',,boxwid,`$1')
- h = ifelse(`$2',,boxht,`$2')
- B: ellipse wid w ht sind(angle)*w
- S: box invis wid w ht h fill_(1) with .s at B
- line from S.nw to S.sw
- line from S.ne to S.se
- T: ellipse wid w ht sind(angle)*w at B+(0,h)
- ]')
-
-define Cylinder { [ dtor = atan2(1,0)/90
- if "$1"=="" then { w = boxwid } else { w = $1 }
- if "$2"=="" then { h = boxht } else { h = $2 }
- if "$3"=="" then { angle = 20 } else { angle = $3 }
- B: ellipse wid w ht sin(angle*dtor)*w
- S: box invis wid w ht h fill 1 with .s at B
- line from S.nw to S.sw
- line from S.ne to S.se
- T: ellipse wid w ht sin(angle*dtor)*w at B+(0,h)
- ] }
-
-M4: [
- cylinder
- move
- cylinder(,,15)
- move
- cylinder(3,50)
- ]
-"M4 macro" at last [].s below
-
-Pic: [
- Cylinder
- move
- Cylinder(,,15)
- move
- Cylinder(3,50)
- ] with .w at M4.e+(5,0)
-"pic macro" at last [].s below
-.PE
diff --git a/graphics/circuit_macros/examples/extras/hsv.m4 b/graphics/circuit_macros/examples/extras/HSV.m4
index 662184dd7d..662184dd7d 100644
--- a/graphics/circuit_macros/examples/extras/hsv.m4
+++ b/graphics/circuit_macros/examples/extras/HSV.m4
diff --git a/graphics/circuit_macros/examples/extras/Highgain.m4 b/graphics/circuit_macros/examples/extras/Highgain.m4
index 06bc62985e..71cbc74a49 100644
--- a/graphics/circuit_macros/examples/extras/Highgain.m4
+++ b/graphics/circuit_macros/examples/extras/Highgain.m4
@@ -48,23 +48,23 @@ define(`vectorsize',
[
R: darrow(right linewid,,,,,,|-)
- { s_box($R$) dabove(at R.start+(5pt__,0)) }
+ { "$R$" dabove(at R.start+(5pt__,0)) }
Sum: circle invis "$\sum$"
darrow(right_ linewid*5/4)
- { s_box($E$) dabove(at last line) }
+ { "$E$" dabove(at last line) }
vectorsize(p,at 1/4 along_(last line))
Gain: shadebox(box "$G = \diag\mat{g_i}$" wid boxwid*1.5 ht boxht*0.75 )
darrow(,,,,,,!-)
- { s_box($U^{\prime}$) dabove(at last line) }
+ { "$U^{\prime}$" dabove(at last line) }
Compensator: shadebox(box wid boxwid*1.5 "\sl Compensator" "$K(s)$")
darrow(right_ linewid*5/4,,,,,,!-)
vectorsize(m,at 1/4 along_(last line))
- { s_box($U$) dabove(at last line) }
+ { "$U$" dabove(at last line) }
Plant: shadebox(box "\sl Plant" "$H(s)$" )
dline(right_ linewid*3/4 from Plant.e,,,,!-)
vectorsize(p,at last line)
Y: dtee(R)
- {s_box($Y$) dabove}
+ {"$Y$" dabove}
darrow(right_ linewid*2/3,t)
dline(down boxht from Y,t)
diff --git a/graphics/circuit_macros/examples/extras/Koch.m4 b/graphics/circuit_macros/examples/extras/Koch.m4
deleted file mode 100644
index cb122c10b6..0000000000
--- a/graphics/circuit_macros/examples/extras/Koch.m4
+++ /dev/null
@@ -1,33 +0,0 @@
-.PS
-# Koch snowflake
-gen_init
-
- leng = 4
- X: 3,5
- nsides = 3; rot[1] = 0; rot[2] = -120; rot[3] = -120
- depth=4
-
- for i=1 to depth do {
- for j=1 to nsides do { tmp[j] = rot[j] }
- leng = leng/3
- k = 0
- for j=1 to nsides do {
- rot[k+1] = tmp[j]
- rot[k+2] = 60
- rot[k+3] = -120
- rot[k+4] = 60
- k += 4
- }
- nsides = k
- }
-
- a = 0
- line from X to X
- for i=1 to nsides do {
- a += rot[i]
-# X: X+(Rect_(leng,a))
-# continue to X
- continue by (Rect_(leng,a))
- }
-
-.PE
diff --git a/graphics/circuit_macros/examples/extras/Makefile b/graphics/circuit_macros/examples/extras/Makefile
index efc8a2b23e..a29b0a81fd 100644
--- a/graphics/circuit_macros/examples/extras/Makefile
+++ b/graphics/circuit_macros/examples/extras/Makefile
@@ -51,7 +51,7 @@ BOXDIMS =
DVIPSOPTS = -G0 -t letter
DIMFILE = $(DOC).dim
-BS = tr '|' '\134'
+TRSLASH = tr '|' '\134'
# Might be needed (change latex commands to $(LTX) )
# LTX = latex --shell-escape
@@ -62,13 +62,13 @@ XTRASRC=printf "|documentclass[11pt]{article}\n\
|usepackage{times,boxdims,siunitx,amssymb,tikz}\n\
|setlength{|textwidth}{8in} |setlength{|textheight}{10.5in}\n\
|setlength{|hoffset}{-2cm} |setlength{|voffset}{-3cm}\n\
-|begin{document}\n" | $(BS)
+|begin{document}\n" | $(TRSLASH)
PDFLTXSRC=printf "|documentclass[11pt]{standalone}\n\
|usepackage{times,boxdims,siunitx,amssymb,tikz,geometry}\n\
|geometry{paperwidth=15in,paperheight=14in,margin=1in}\n\
|pagestyle{empty}|thispagestyle{empty}\n\
-|begin{document}|noindent|input{"$*".tex}|end{document}\n" | $(BS)
+|begin{document}|noindent|input{"$*".tex}|end{document}\n" | $(TRSLASH)
LTXFILE=printf "|documentclass[11pt]{article}\n\
|usepackage[dvipsnames]{xcolor}\n\
@@ -81,7 +81,7 @@ LTXFILE=printf "|documentclass[11pt]{article}\n\
|newbox|graph\n\
|begin{document}\n\
|noindent|input{"$*".tex}|box|graph\n\
-|end{document}\n" | $(BS)
+|end{document}\n" | $(TRSLASH)
.SUFFIXES: .ps .dvi .tex .m4 .pic .eps .png .pdf .svg .tif .gif
.m4.pic:
@@ -158,33 +158,39 @@ LTXFILE=printf "|documentclass[11pt]{article}\n\
#########################################################################
-$(DOC).pdf:
+$(DOC).pdf: texfiles
@$(XTRASRC) > extras.tex
touch extras.dim
-for fl in `ls *.m4` ; do \
file=`basename $$fl .m4` ; \
- echo $$file.m4 ; \
- $(M4) pgf.m4 extras.dim $$file.m4 | $(PIC) -g > $$file.tex ; \
- printf "\n\n|noindent|parbox{|textwidth}{\n" | $(BS) >> extras.tex ; \
- printf "|input{$$file.tex}\n" | $(BS) >> extras.tex ; \
+ printf "\n\n|noindent|parbox{|textwidth}{\n" | $(TRSLASH) >> extras.tex; \
+ printf "|input{$$file.tex}\n" | $(TRSLASH) >> extras.tex ; \
printf "\n $$file.m4\n}\n|vspace{|baselineskip}" \
- | sed -e 's/_/|_/g' | $(BS) >> extras.tex ; \
- done
- printf "\n|end{document}\n" | $(BS) >> extras.tex
- pdflatex extras
- -for file in $(XBOXDIMS) ; do \
- rm -f $$file.tex ; \
- $(M4) pgf.m4 extras.dim $$file.m4 | $(PIC) -g > $$file.tex ; \
+ | sed -e 's/_/|_/g' | $(TRSLASH) >> extras.tex ; \
done
+ printf "\n|end{document}\n" | $(TRSLASH) >> extras.tex
pdflatex extras
+# -for file in $(XBOXDIMS) ; do \
+# rm -f $$file.tex ; \
+# $(M4) pgf.m4 extras.dim $$file.m4 | $(PIC) -g > $$file.tex ; \
+# done
+# pdflatex extras
+
+texfiles:
+ touch extras.dim
+ for fl in `ls *.m4` ; do \
+ file=`basename $$fl .m4` ; \
+ echo $$file.m4 ; \
+ $(M4) pgf.m4 extras.dim $$file.m4 | $(PIC) -g > $$file.tex ; done
+ touch texfiles
$(DOC).ps: psmode $(DOC).dvi
psmode:
- printf "|usepackage{pstricks,pst-grad}\n" | $(BS) > mode.tex
+ printf "|usepackage{pstricks,pst-grad}\n" | $(TRSLASH) > mode.tex
pdfmode:
- printf "|usepackage{tikz}\n" | $(BS) > mode.tex
+ printf "|usepackage{tikz}\n" | $(TRSLASH) > mode.tex
$(DOC).dvi: $(DOC).tex files.tex header.tex psmode
touch $(DOC).dim
@@ -208,4 +214,4 @@ tst1:
dvips $(DVIPSOPTS) tst -o tst.ps
clean:
- rm -f *.ps *.pdf *.tex *.dim *.pic *.log *.dms *.aux *.svg
+ rm -f *.ps *.pdf *.tex *.dim *.pic *.log *.dms *.aux *.svg texfiles
diff --git a/graphics/circuit_macros/examples/extras/Parallel-series.m4 b/graphics/circuit_macros/examples/extras/Parallel-series.m4
new file mode 100644
index 0000000000..fb20cc21eb
--- /dev/null
+++ b/graphics/circuit_macros/examples/extras/Parallel-series.m4
@@ -0,0 +1,15 @@
+.PS
+# parallel-series.m4
+# https://tex.stackexchange.com/questions/709074/how-to-plot-a-block-diagram-with-tikz
+cct_init
+
+ dot; line right_ dimen_/2
+ parallel_(
+ parallel_(
+ `ebox(,wdth=0.2;text="$x_1$")',
+ `Sep=dimen_*3/4;ebox(,wdth=0.2;text="$x_2$")'),
+ Sep=dimen_;series_(
+ `ebox(,wdth=0.2;text="$x_3$")',
+ `ebox(,wdth=0.2;text="$x_4$")'))
+ line right_ dimen_/2; dot
+.PE
diff --git a/graphics/circuit_macros/examples/extras/person.m4 b/graphics/circuit_macros/examples/extras/Person.m4
index 4fdf09d387..4fdf09d387 100644
--- a/graphics/circuit_macros/examples/extras/person.m4
+++ b/graphics/circuit_macros/examples/extras/Person.m4
diff --git a/graphics/circuit_macros/examples/extras/README_extras b/graphics/circuit_macros/examples/extras/README_extras
index 45074a49b2..ebef7cfcd1 100644
--- a/graphics/circuit_macros/examples/extras/README_extras
+++ b/graphics/circuit_macros/examples/extras/README_extras
@@ -11,4 +11,4 @@ often be done reasonably in several possible languages.
This directory is assumed to be a subdirectory of the examples directory
in order to include the necessary definition files.
-Type "make" and, to clean up, "make clean".
+Type "make" to create extras.pdf and, to clean up, "make clean".
diff --git a/graphics/circuit_macros/examples/extras/rotellipse.m4 b/graphics/circuit_macros/examples/extras/Rotellipse.m4
index a49ce308b3..a49ce308b3 100644
--- a/graphics/circuit_macros/examples/extras/rotellipse.m4
+++ b/graphics/circuit_macros/examples/extras/Rotellipse.m4
diff --git a/graphics/circuit_macros/examples/extras/SampleFlow.m4 b/graphics/circuit_macros/examples/extras/SampleFlow.m4
index 077a0ba6e3..94e334c46a 100644
--- a/graphics/circuit_macros/examples/extras/SampleFlow.m4
+++ b/graphics/circuit_macros/examples/extras/SampleFlow.m4
@@ -2,11 +2,11 @@
# SampleFlow.m4
darrow_init
-boxwid = 1.9
-boxht = 1.0
+boxwid = 1.15
+boxht = 0.6
linethick = 1.2
- define(`dlthick',0.25)
+ define(`dlthick',0.125)
define(`dfillcolor',`0.7,0.7,0.7')
define rbox {box rad boxht/10}
@@ -17,7 +17,7 @@ linethick = 1.2
dleft
darrow(to last box.w) } }
- command "{\sf\huge"
+ command "{\sf"
B1: rbox
{ "Sample" ljust indent "Acquisition" ljust }
diff --git a/graphics/circuit_macros/examples/extras/Spec555.m4 b/graphics/circuit_macros/examples/extras/Spec555.m4
new file mode 100644
index 0000000000..713ccb2967
--- /dev/null
+++ b/graphics/circuit_macros/examples/extras/Spec555.m4
@@ -0,0 +1,56 @@
+.PS
+# Spec555.m4
+# https://tex.stackexchange.com/questions/64801/display-ics-with-circuitikz?rq=1
+log_init
+
+define(`spec555',`[ Chip: box wid 8*lg_pinsep ht 10*lg_pinsep fill_(0.9)
+ command "{\scriptsize\sf"
+ P1: "1" at 3/4<Chip.sw,Chip.se> below rjust; "GND" above
+ P5: "5" at Chip.s below rjust ; "CTRL" above
+ P2: "2" at 1/8<Chip.sw,Chip.nw> above rjust; "TRG" ljust
+ P6: "6" at 3/8<Chip.sw,Chip.nw> above rjust; "THR" ljust
+ P7: "7" at 7/8<Chip.sw,Chip.nw> above rjust; "DIS" ljust
+ P3: "3" at Chip.e above ljust ; "OUT" rjust
+ P4: "4" at 3/4<Chip.nw,Chip.ne> above rjust; "\phantom{M}RESET" below
+ P8: "8" at Chip.n above rjust ; "Vcc" below
+ "NE-555" at Chip.c "TIMER"
+ command "}%"
+ line left dimen_ from P7; X:dot
+ { R1:resistor(up_ P7.y-P6.y); rlabel(,\SI{68}{\kilo\ohm}); dot }
+ R2:resistor(down_ P7.y-P6.y); llabel(,\SI{68}{\kilo\ohm}); dot; {line to P6}
+ line to (Here,P2); SW: dot; {line to P2}
+ line from P8 to (P8,R1.end); dot ]')
+
+ command "{\small\sf"
+ T1: spec555; "U1" at T1.Chip.nw above ljust
+ T2: spec555 with .Chip.w at T1.Chip.e+(2.5*dimen_,0)
+ "U2" at T2.Chip.nw above ljust
+ {line left_ dimen_/2 from (T1.X,T1.P7); diode(down_ T1.P7.y-T1.P6.y)
+ rlabel(,\shortstack{D1\\1N4148})
+ line to (T1.X,Here); dot}
+ capacitor(down_ elen_ from T1.SW,E+); llabel(,\SI{10}{\micro\farad}); dot
+ dot(at Here-(dimen_/2,0),,1); G: dot(,,1); "GND" rjust at G.w
+ capacitor(from T1.P5 to (T1.P5,G),E+); rlabel(,\SI{0.01}{\nano\farad}); dot
+ line from T1.P1 to (T1.P1,G); dot
+ Vcc: dot(at (G,T1.R1.end),,1); "Vcc" rjust at Vcc.w
+ dot(at (T1.P4,Vcc)); line to T1.P4
+ line right_ dimen_/2 from T1.P3;
+ R3: resistor(down_ to (Here,T2.s-(0,dimen_/4))); llabel(,\SI{10}{\kilo\ohm})
+ line to (T2.P5,Here) then to T2.P5
+ dot(at (T2.X,G)); ground
+ reversed(`capacitor',up_ to (Here,T2.P5),E+); rlabel(,\SI{100}{\nano\farad})
+ line to (Here,T2.P2)
+ line from T2.P1 to (T2.P1,G); dot
+ line from T2.P4 to (T2.P4,Vcc) then to Vcc chop 0 chop dotrad_
+ dot(at (T2.X,T2.R1.end)+(0,dimen_/2),,1); {line to T2.R1.end chop dotrad_}
+ "$+$\SI{5}{\volt} to $+$\SI{15}{\volt}" at last [].n above
+ capacitor(right_ dimen_ from T2.P3,C); llabel(,\SI{100}{\micro\farad})
+ Pot1: potentiometer(down_ (Here.y-G.y)/2) with .Start at Here
+ "Rx" at Pot1.T1 ljust
+ Sp: speaker(R,,,fill_(0.9)) with .In5 at Pot1.End
+ "1" above rjust at Sp.In5; "2" below rjust at Sp.In7
+ "\shortstack{E1\\Speaker}" at Sp.In2 rjust
+ line from Sp.In7 to (Sp.In7,G) then to G chop 0 chop dotrad_
+ command "}%"
+
+.PE
diff --git a/graphics/circuit_macros/examples/extras/squiggle.m4 b/graphics/circuit_macros/examples/extras/Squiggle.m4
index 671ae2addd..671ae2addd 100644
--- a/graphics/circuit_macros/examples/extras/squiggle.m4
+++ b/graphics/circuit_macros/examples/extras/Squiggle.m4
diff --git a/graphics/circuit_macros/examples/extras/venus.m4 b/graphics/circuit_macros/examples/extras/Venus.m4
index 676cd98143..676cd98143 100644
--- a/graphics/circuit_macros/examples/extras/venus.m4
+++ b/graphics/circuit_macros/examples/extras/Venus.m4
diff --git a/graphics/circuit_macros/examples/extras/ex17.m4 b/graphics/circuit_macros/examples/extras/ex17.m4
new file mode 100644
index 0000000000..a304d7359b
--- /dev/null
+++ b/graphics/circuit_macros/examples/extras/ex17.m4
@@ -0,0 +1,43 @@
+.PS
+# ex17.m4
+cct_init
+
+[
+nrows = 4
+ncols = 9
+linewid = linewid*0.6 # everything smaller
+define(`elen_',linewid) # shorter default length
+
+ for j = 1 to nrows do {
+ { for i = 1 to ncols do {
+ Point_(-120) resistor
+ Point_( 0) inductor
+ Point_( 120) capacitor
+ if i < ncols then {Point_(0) diode} }
+ }
+ Point_(-120) move to rvec_(elen_,0)
+ { for i = 1 to ncols do {
+ Point_(-60) capacitor
+ Point_( 60) resistor }
+ }
+ Point_(-60) move to rvec_(elen_,0)
+ }
+ Point_(0) for i = 1 to ncols-1 do { inductor }
+]
+
+[ # an exercise of the `parallel_' macro:
+ down_ # for labelling
+ Point_(-80) # skew current direction
+
+ parallel_(Sep=1.75*dimen_;
+ parallel_(
+ `capacitor(,C); rlabel(,,C_2)',
+ `resistor; rlabel(,R_2)' ),
+ parallel_(
+ `resistor; rlabel(,R_1); move to rvec_(-dimen_/5,0)
+ inductor(,W); rlabel(,L_1)',
+ `reversed(`source',to rvec_(elen_,0),V,sourcerad_*2.5); rlabel(,v_s)' )
+ )
+
+] with .sw at last [].se+(elen_,0)
+.PE