From ae7b85d3ff2a814b8c735c12031dd075b58bedac Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 28 Dec 2020 22:32:07 +0000 Subject: circuitikz (28dec20) git-svn-id: svn://tug.org/texlive/trunk@57245 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/generic/circuitikz/pgfcircpath.tex | 35 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'Master/texmf-dist/tex/generic') 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}} -- cgit v1.2.3