如何编辑 TikZ-circuits.ee.IEC 电阻的可调样式?

如何编辑 TikZ-circuits.ee.IEC 电阻的可调样式?

晚上好!

我想画一些与X相关的电阻(比如与温度相关的,如图所示[此时有一些红色的部分])。

我有一个解决方案,但我不认为这是正确的方法。

是否有可能编辑可调节款式在简单的设置下,得到想要的形状?例如,我可以用以下设置来消除它的箭头:

\tikzset{NoArrowhead/.style={annotation arrow/.style = {> = none}}}

我可以以类似的方式添加细小的红线和文本符号吗?

顺便说一句:字母“vartheta”不一定是固定符号,因为可能存在其他依赖关系,例如电压依赖性,所以我们需要符号“V”

感谢您的阅读和关注!

在此处输入图片描述

好的,这是我的代码——说说你的意思。

\documentclass[margin=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC}
\usepackage{amsmath, amssymb}

%% temp adjustable %%%%%%%%%%%%%%%%
\tikzset{
temp adjustable/.style={
append after command={%
%NEW:
(-2.5\tikzcircuitssizeunit,-1.5\tikzcircuitssizeunit) edge[line to, red]
(-1.5\tikzcircuitssizeunit,-1.5\tikzcircuitssizeunit) 
%OLD:
(-1.5\tikzcircuitssizeunit,-1.5\tikzcircuitssizeunit) edge[line to] (1.5\tikzcircuitssizeunit,1.5\tikzcircuitssizeunit)
%NEW
node[red] () at (-0.5\tikzcircuitssizeunit,-1.5\tikzcircuitssizeunit) {$\vartheta$}
}}}
%%%%%%%%%%%%%%%%
%===========
\begin{document}
%===========
\begin{tikzpicture}[circuit ee IEC, font=\sffamily\footnotesize]

\draw (3,0) to  [resistor= {temp adjustable}] (5,0);

\end{tikzpicture}
%===========
\end{document}
%===========

答案1

好的,我很感激 John Kormylo 的评论;所以让我向您介绍我的解决方案:

在此处输入图片描述

\documentclass[margin=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC}
\usepackage{amsmath, amssymb}

%%%%%%%%%%%%%%%%%%%%%%%%%%
% LowUpDep %%%%%%%%%%%%%%%%%%%%
\tikzset{dependent/.style={annotation arrow/.style = {>=}}}
%
%
%LowDep %%%%%
\tikzset{LowDep/.style args={#1}{
append after command={%
\bgroup
[current point is local=true]
[every LowDep/.try]
[annotation arrow,-]
(-2.5\tikzcircuitssizeunit,-1.5\tikzcircuitssizeunit) edge[line to]
(-1.5\tikzcircuitssizeunit,-1.5\tikzcircuitssizeunit) node[xshift=3.0\tikzcircuitssizeunit]{#1}
\egroup%
}},
%
LowDep'/.style args={#1}{
append after command={%
\bgroup
[current point is local=true, yscale=-1]
[every LowDep/.try]
[annotation arrow,-]
(-2.5\tikzcircuitssizeunit,-1.5\tikzcircuitssizeunit) edge[line to]
(-1.5\tikzcircuitssizeunit,-1.5\tikzcircuitssizeunit) node[xshift=3.0\tikzcircuitssizeunit]{#1}
\egroup%
}}
}
%
%
%
%UpDep %%%%%
\tikzset{UpDep/.style args={#1}{
append after command={%
\bgroup
[current point is local=true]
[every UpDep/.try]
[annotation arrow,-]
%
(2.5\tikzcircuitssizeunit,1.5\tikzcircuitssizeunit)  edge[line to]
(1.5\tikzcircuitssizeunit,1.5\tikzcircuitssizeunit) node[xshift=-3.0\tikzcircuitssizeunit]{#1}
\egroup%
}},
%
UpDep'/.style args={#1}{
append after command={%
\bgroup
[current point is local=true, yscale=-1]
[every UpDep/.try]
[annotation arrow,-]
%
(2.5\tikzcircuitssizeunit,1.5\tikzcircuitssizeunit)  edge[line to]
(1.5\tikzcircuitssizeunit,1.5\tikzcircuitssizeunit) node[xshift=-3.0\tikzcircuitssizeunit]{#1}
\egroup%
}}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%


%===========
\begin{document}
%===========

\begin{tikzpicture}[circuit ee IEC, font=\sffamily\footnotesize]

%
\draw (0,0) to  [resistor={LowDep={foo}, UpDep={bar}, adjustable={
info={Testtext}, info'={Testtext}
}}, dependent] (2,0);

\draw (0,-2) to  [resistor={LowDep={foo}, adjustable}, dependent] (2,-2);

\draw (0,-4) to  [resistor={UpDep={bar}, adjustable}, dependent] (2,-4);


%
\draw (3,0) to  [resistor={LowDep'={foo}, UpDep'={bar}, adjustable'={
info={Testtext}, info'={Testtext }
}}, dependent] (5,0);

\draw (3,-2) to  [resistor={LowDep'={foo}, adjustable'}, dependent] (5,-2);

\draw (3,-4) to  [resistor={UpDep'={bar}, adjustable'}, dependent] (5,-4);

%%
\draw (0,-6) to  [capacitor={LowDep={foo}, UpDep={bar}, adjustable}, dependent] (2,-6);

\draw (3,-6) to  [diode={LowDep={foo}, UpDep={bar}, adjustable}, dependent] (5,-6);

\end{tikzpicture}
%===========
\end{document}
%===========

答案2

如果要使其\vartheta可调,可以使用以下命令:

\documentclass[margin=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC}
\usepackage{amsmath, amssymb}

%create new parameter
\tikzset{adj var/.initial={\vartheta}}

%% temp adjustable %%%%%%%%%%%%%%%%
\tikzset{
temp adjustable/.style={
append after command={%
%NEW:
(-2.5\tikzcircuitssizeunit,-1.5\tikzcircuitssizeunit) edge[line to, red]
(-1.5\tikzcircuitssizeunit,-1.5\tikzcircuitssizeunit) 
%OLD:
(-1.5\tikzcircuitssizeunit,-1.5\tikzcircuitssizeunit) edge[line to] (1.5\tikzcircuitssizeunit,1.5\tikzcircuitssizeunit)
%NEW
node[red] () at (-0.5\tikzcircuitssizeunit,-1.5\tikzcircuitssizeunit) {$\pgfkeysvalueof{/tikz/adj var}$}
}}}
%%%%%%%%%%%%%%%%
%===========
\begin{document}
%===========
\begin{tikzpicture}[circuit ee IEC, font=\sffamily\footnotesize]

\draw (0,0) to  [resistor= {temp adjustable}, adj var=V] (2,0);

\end{tikzpicture}
%===========
\end{document}
%===========

修饰变种

相关内容