summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-12-28 22:32:07 +0000
committerKarl Berry <karl@freefriends.org>2020-12-28 22:32:07 +0000
commitae7b85d3ff2a814b8c735c12031dd075b58bedac (patch)
tree9ae34b60ddea3e61499ce49a6878e0d527da7370 /Master/texmf-dist/tex/generic
parent95b311c50ee68843f5d0f54551bf92d6dcf765d8 (diff)
circuitikz (28dec20)
git-svn-id: svn://tug.org/texlive/trunk@57245 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic')
-rw-r--r--Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex35
1 files changed, 30 insertions, 5 deletions
diff --git a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
index 0b15f0f160e..0c2df7cd700 100644
--- a/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
+++ b/Master/texmf-dist/tex/generic/circuitikz/pgfcircpath.tex
@@ -59,6 +59,30 @@
}
}
+%
+% expandable IF for the extra nodes (thanks to Henri Menke)
+% see https://chat.stackexchange.com/transcript/message/56560808#56560808
+%
+\def\pgfcirc@if@has@i{%
+ \ifpgfcirc@has@i
+ \expandafter\pgfutil@firstoftwo
+ \else
+ \expandafter\pgfutil@secondoftwo
+ \fi}
+\def\pgfcirc@if@has@v{%
+ \ifpgfcirc@has@v
+ \expandafter\pgfutil@firstoftwo
+ \else
+ \expandafter\pgfutil@secondoftwo
+ \fi}
+\def\pgfcirc@if@has@f{%
+ \ifpgfcirc@has@f
+ \expandafter\pgfutil@firstoftwo
+ \else
+ \expandafter\pgfutil@secondoftwo
+ \fi}
+
+
%% Generic bipole path
\def\pgf@circ@bipole@path#1#2{
@@ -158,11 +182,12 @@
\drawpoles
\pgf@circ@ifkeyempty{bipole/label/name}\else\pgf@circ@drawlabels{label}\fi
\pgf@circ@ifkeyempty{bipole/annotation/name}\else\pgf@circ@drawlabels{annotation}\fi
- \ifpgfcirc@has@v\pgf@circ@drawvoltage\fi
- % \pgf@circ@ifkeyempty{bipole/current/label/name}\else\pgf@circ@drawcurrent\fi
- \ifpgfcirc@has@i\pgf@circ@drawcurrent\fi
- % \pgf@circ@ifkeyempty{bipole/flow/label/name}\else\pgf@circ@drawflow\fi
- \ifpgfcirc@has@f\pgf@circ@drawflow\fi
+ % the following must be made in their own path scope to avoid crash in TikZ 3.1.8/3.1.8a
+ % it should be logically safe for older version too --- even if TikZ reverted the change
+ % use explandable ifs too, thanks to Henri Menke
+ {\pgfcirc@if@has@v{\pgf@circ@drawvoltage}{}}%
+ {\pgfcirc@if@has@i{\pgf@circ@drawcurrent}{}}%
+ {\pgfcirc@if@has@f{\pgf@circ@drawflow}{}}%
% finish the path from the component to the final target
% you never know --- re-set \pgf@temp to detect open
\pgfextra{\def\pgf@temp{open}\def\pgf@circ@temp{#3}}