如何垂直提升组件标签位置?L1 标签应该高一点。我可以添加新节点并指定位置 - 但也许存在一些标签属性,如“文本 yshift”?会更简单。
\documentclass[preview,border=12pt,12pt, varwidth=\maxdimen]{standalone}
\usepackage[europeanresistors,europeaninductors]{circuitikz}
\begin{document}
\begin{circuitikz}[european, scale=1]
% \wfrac - trupmena su didesniais vertikaliais tarpais
\newcommand{\wfrac}[2]{\frac{\vrule width 0px depth 3px\relax #1}{\vrule width 0px height 8px\relax #2}}
\draw (0,0) coordinate(point0) to[R=$\wfrac{R_1}{15,75\;K\Omega}$, *-] (0,4) coordinate(point1);
\draw (0,4) to[american inductor, l=$\wfrac{L_1}{15,75\;mH}$, *-*] (4,4) coordinate(point2);
\draw (4,4) to[american inductor=$L_2$] (4,0);
\draw (0,0) to[short, -*] (4,0);
\draw (4,4) to[C=$C_2$] (8,4) coordinate(point3);
\draw (8,4) to[R=$R_2$] (8,0);
\draw (4,0) to[short, -*] (8,0);
\ctikzset{wiper end arrow={Latex[width=4pt]}}
\draw (11,0) to[pR=$R_3$, mirror, name=R3, *-] (11,4) coordinate(point4);
\draw (R3.wiper) -- ++ (0,1) -- (11,3) node[circ]{};
\draw (8,0) -- (11,0);
\draw (11,4) to[short, *-*] (8,4);
\draw (0,4) -- (0,6) to[C=$C_1$] (11,6) -- (11,4);
\draw (point1) -- ++ (-2,0);
\draw (point0) -- ++ (-2,0);
\draw (point4) -- ++ (2,0);
\draw (11,0) -- ++ (2,0);
\node[draw,rectangle,text centered,font=\bfseries] at ([xshift=-0.5cm,yshift=0.5cm] point1){1};
\node[draw,rectangle,text centered,font=\bfseries] at ([yshift=0.5cm] point2){2};
\node[draw,rectangle,text centered,font=\bfseries] at ([xshift=0.5cm,yshift=0.5cm] point4){3};
\node[draw,rectangle,text centered,font=\bfseries] at (0,-0.5){4};
\node[draw,rectangle,text centered,font=\bfseries] at (11,-0.5){4};
\end{circuitikz}
\end{document}
答案1
像这样?
- 您可以用来定义元素标签的距离
label distance = <value>
,在下面的 MWE 中查看以 标记的代码行% <-------
。 - 我从头开始重新绘制了你的计划。此时:
- 该方案由四个循环组成
- 我使用相对坐标,
- 一些坐标还包含带有其名称的标签(p0,p1,...),
- 为坐标中的标签定义通用样式
- 这样,方案的代码就更简短、更简洁了:
\documentclass[12pt, margin=3mm]{standalone}
\usepackage[americaninductor, europeanresistor,
siunitx]{circuitikz}
\usepackage{nccmath}
\begin{document}
\begin{circuitikz}[every label/.style = {label distance=2mm,
draw, minimum size=1em, inner sep=1pt}]
\ctikzset{capacitors/width=0.1, capacitors/height=0.5}
\draw (0,0) coordinate[label=below:4] (p0)
to[R=$\mfrac{R_1}{\qty{15,75}{\kilo\ohm}}$, *-] ++ (0,4) coordinate[label=above left:1] (p1) to[L=$\mfrac{L_1}{\qty{15,75}{\milli\henry}}$,
label distance=5pt, % <-------
*-*] ++ (3, 0) coordinate[label=above:2] (p2)
to[L=$L_2$, -*] ++ (0,-4)
(p2) to[C=$C_2$, -*] ++ (3, 0) coordinate (aux1)
to[R=$R_2$, -*] ++ (0,-4)
(aux1) to[short, -*] ++ (3, 0) coordinate[label=above right:3] (p3)
to[short,-*] ++ (0,-1) coordinate (aux2)
to[pR=$R_3$, n=pot] ++ (0,-2)
to[short,-*] ++ (0,-1) coordinate[label=below:4] (p4)
(aux2) -| (pot.wiper)
(p4) to[short] (p0)
%
(p1) -- ++ (0,2) to[C=$C_1$] ++ (9, 0)
to[short,-*] ++ (0,-2)
%
(p1) -- ++ (-2,0)
(p0) -- ++ (-2,0)
(p3) -- ++ (2,0)
(p4) -- ++ (2,0);
\end{circuitikz}
\end{document}
- 值
\qty{15,75}{\kilo\ohm}
和\qty{15,75}{\milli\henry}
也可以分别以缩写形式\qty{15,75}{\kohm}
和来写\qty{15,75}{\mH}
。
答案2
你确定要把那条线放在那里吗?这是我第一次看到它……否则,你可以使用堆叠标签功能。我在代码中加入了注释,解释了我在做什么
\documentclass[border=10pt]{standalone}
\usepackage[T1]{fontenc}
% Use siunitx for the values of components
\usepackage[siunitx]{circuitikz}
% Set the style of your circuit in the preamble for consistency
% here: european symbols, but american inductors (I agree ;-)!)
% stacked labels are centered by default
\ctikzset{european, american inductors, l2 halign=c}
\begin{document}
\begin{tikzpicture}
% the horizontal stacked label must be bottom aligned (default is centered) vertically
\draw(0,0) to[L, l2=$L_1$ and \qty{15.75}{\mH}, l2 valign=b] ++(3,0)
to [R, l2=$R_1$ and \qty{15.75}{\kohm}] ++ (0,-3);
\end{tikzpicture}
\end{document}
如果您想要该线,则可以使用以下内容(再次,更改将针对所有文档;每个堆叠的标签都会跟随。如果您喜欢,您需要类似的东西进行注释)。
\documentclass[border=10pt]{standalone}
\usepackage[T1]{fontenc}
% Use siunitx for the values of components
\usepackage[siunitx]{circuitikz}
% Set the style of your circuit in the preamble for consistency
% here: european symbols, but american inductors (I agree ;-)!)
% stacked labels are centered by default
\ctikzset{european, american inductors, l2 halign=c}
%%
%% Add a line between entries in stacked labels
%% (and a bit of breathing space)
%%
\makeatletter
\ctikzset{l2base/.code n args={2}{
\pgfkeys{/tikz/circuitikz/bipole/label/name=%
\bgroup
\def\arraystretch{1.2}
\setlength{\tabcolsep}{2pt}%
\def\pgfcirc@ltwo@tabu{\tabular[\pgfcirc@ltwo@valign]}%
\expandafter\pgfcirc@ltwo@tabu\expandafter{\pgfcirc@ltwo@halign}%
#1\\ \hline #2%
\endtabular
\egroup
}%
}}
\makeatother
\begin{document}
\begin{tikzpicture}
% the horizontal stacked label must be bottom aligned (default is centered) vertically
\draw(0,0) to[L, l2=$L_1$ and \qty{15.75}{\mH}, l2 valign=b] ++(3,0)
to [R, l2=$R_1$ and \qty{15.75}{\kohm}] ++ (0,-3);
\end{tikzpicture}
\end{document}
PD 说明:请,尝试将代码简化为最小发帖时留言一次;这是对回答者时间的尊重。