summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-05-02 20:41:58 +0000
committerKarl Berry <karl@freefriends.org>2021-05-02 20:41:58 +0000
commit080ac5381f901946a1b4558ef16853881a4dbcb9 (patch)
tree2f8dd6ecd4038ea24c8606ad86fff69c62957fc7 /Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex
parentb3c9da64133509370b373118b06bf35a1af71c83 (diff)
circuitikz (2may21)
git-svn-id: svn://tug.org/texlive/trunk@59054 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex')
-rw-r--r--Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex31
1 files changed, 31 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex
index 9400b0c7011..ac87e083040 100644
--- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex
+++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircutils.tex
@@ -89,4 +89,35 @@
}}}%
}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% subcircuits (experimental)
+%%
+%% introduced by Romano Giannetti around April 2021
+%%
+%%
+\newbox\ctikz@scratchbox
+\long\def\ctikzsubcircuitdef#1#2#3{%
+ \expandafter\gdef\csname #1@Anchor\endcsname{}
+ \expandafter\gdef\csname #1@setanchors\endcsname{
+ \setbox\ctikz@scratchbox=\hbox{%
+ \begin{circuitikz}
+ \draw (0,0) \csname#1\endcsname{T-#1}{};
+ \foreach [count=\i] \anchor in {#2}
+ % reference anchor is -center
+ \draw (0,{2-\i/2}) let \p1 = ($(T-#1-subckt@reference)-(T-#1-\anchor)$) in
+ node[right]{\anchor: \x1,\y1 \expandafter\xdef\csname #1@Anchor\anchor\endcsname{++(\x1,\y1)}};
+ \end{circuitikz}
+ }
+ }
+ \expandafter\gdef\csname#1\endcsname##1##2{\csname#1aux\endcsname{##1}{\csname #1@Anchor##2\endcsname}}
+ \expandafter\gdef\csname#1aux\endcsname##1##2{%
+ % move to the anchor
+ ##2
+ % reference anchor should be -reference
+ coordinate (##1-subckt@reference)
+ #3
+ }
+}
+\long\def\ctikzsubcircuitactivate#1{\csname #1@setanchors\endcsname}
+
\endinput