Circuitikz 连接:连接球 (*-),加上转弯 (-|)

Circuitikz 连接:连接球 (*-),加上转弯 (-|)

一定有更好的方法!而且,我相信这里一定有人可以告诉我。

我经常发现自己想在原理图中建立连接,其中连接的一端应该有一个圆形的暗斑,就像使用 * 表示内联短路一样。连接的另一端在某个角落附近。也就是说,你必须画两条正交线才能到达那里——通常用“向下和向下”运算符 |- 或其孪生 -| 来完成。

但是,to[short, *-] 内联元素似乎无法与 |- 运算符配合使用。因此,我最终绘制了一条 0.1 厘米左右的短线,然后是“向下和向下”部分。如下所示:

\documentclass[border=5mm]{standalone}
\usepackage[american,RPvoltages,siunitx]{circuitikz}
\ctikzset{logic ports=ieee}

\begin{document}
\begin{circuitikz}
\node [and port] (and0) at (0,2) {and0};
\draw (and0.in 2) -- ++(-1,0) node[left] {$A$};
\draw (and0.out)  -- ++(1,0) node[right] {$B$};

\node [or  port] (or0)  at (3,0) {or0};
\draw (and0.in 2) to[short, *-] ++(0,-.1)
                  |- (or0.in 1);
\draw (or0.in 2) -| ($(and0.out) + (0,-.1)$)
                  to[short, -*] (and0.out);
\end{circuitikz}
\end{document}

这给了我以下绘图: 两个门配两个连接器

您可以看到,我以两种方式制作了连接器,具体取决于我希望连接圆出现在哪一端。但是,这两种方法都不太优雅。

我想要的是一个可以做类似以下操作的符号:

... to[short, *-] |- (or0.in 2);

但那不管用。有什么想法吗?

答案1

不,to[]不适用于|-或类似情况。您必须将其视为to一种幻想--(中间添加了某物的线/电线;中间short没有添加任何内容的情况)。这不是circuitikz具体的;您可以尝试使用 TiZto[out=45, in=135]看看...

最好的方法是用素线连接,再加杆node[circ]{},或者用垂直坐标代替运动

第一个选项的示例是使用

\draw (and0.in 2) node[circ]{} |- (or0.in 1);

*-对于您的第一个连接(基本上与后台执行的操作相同),第二个连接可以应用于您的第二个连接:

\draw (or0.in 2) -- (or0.in 2 -| and0.out) to[short, -*] (and0.out);

此外,您可以将极点放在沿或线操作的任意位置---|一个|-好处是,在|--|操作中,“扭结”位于pos=0.5(请参阅我添加到您的示例中的代码)。

\documentclass[border=5mm]{standalone}
\usepackage[american,RPvoltages,siunitx]{circuitikz}
\ctikzset{logic ports=ieee}

\begin{document}
\begin{circuitikz}
\node [and port] (and0) at (0,2) {and0};
\draw (and0.in 2) -- ++(-1,0) node[left] {$A$};
\draw (and0.out)  -- ++(1,0) node[right] {$B$};

\node [or  port] (or0)  at (3,0) {or0};
\draw (and0.in 2) node[circ]{} |- (or0.in 1);
\draw (or0.in 2) -- (or0.in 2 -| and0.out)
    to[short, -*] (and0.out);

% You can "drop" a pole in several positions in a |- or -|
% path, either by using the default position for "nodes on the path"
% positioning...
\draw (4,2) node[circ]{} -|        % this is at pos=0
    node[circ, color=blue]{} (5,0) % this is at pos=0.5
    node[circ, color=red]{};       % this is at pos=1
% or explicitly with `pos`
\draw (4,1.5) -| (4.5, 0)
    node[pos=0, circ]{}
    node[pos=0.5, circ, color=blue]{}  
    node[pos=1, circ, color=red]{};
\end{circuitikz}
\end{document}

在此处输入图片描述

相关内容