如何声明自定义坐标

如何声明自定义坐标

我创建了这个示例图,其中所有内容都与第一个和门的输入对齐。是否可以用([xshift=-15mm]bothNegated.bin 1)之前声明的自定义表达式替换这些,这样就不必一遍又一遍地重复相同的命令?

我正在使用电路图套餐反向输入仅,其余部分与circuitikz相同。

我曾尝试在交叉口使用一个节点,但线路([xshift=-5mm]bothNegated.bin 1) |- node[circ,midway]{} (notB.in 1)并未连接到通向顶部和大门的线路。

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikzgit}
\begin{document}
 \begin{circuitikz} \draw

(2,0) node[and port] (bothTrue) {}
(2,2) node[and port] (notB) {}
(2,4) node[and port] (notA) {}
(2,6) node[and port] (bothNegated) {}


([xshift=-15mm]bothNegated.bin 1) node[anchor=east] (Anode) {A}

([xshift=-15mm]bothNegated.bin 1) -| (bothNegated.in 1)
([xshift=-5mm]bothNegated.bin 1) node[circ]{} |-  (bothTrue.in 1) 

([xshift=-5mm]bothNegated.bin 1) |- node[circ,midway]{} (notB.in 1)
([xshift=-5mm]bothNegated.bin 1) |- node[circ,midway]{} (notA.in 1)



([xshift=-15mm]bothNegated.bin 2) node[anchor=east] {B}
([xshift=-15mm]bothNegated.bin 2) -| (bothNegated.in 2)
([xshift=-10mm]bothNegated.bin 2) node[circ]{} |-  (bothTrue.in 2)

([xshift=-10mm]bothNegated.bin 2) |- node[circ,midway]{} (notA.in 2)
([xshift=-10mm]bothNegated.bin 2) |- node[circ,midway]{} (notB.in 2)



(bothNegated.bin 2) node[ocirc, left] {}
(bothNegated.bin 1) node[ocirc, left] {}
(notA.bin 2) node[ocirc, left] {}
(notB.bin 1) node[ocirc, left] {}


;\end{circuitikz}

\end{document}

样本

答案1

您可以像这样定义坐标:

\coordinate (c1) at ([xshift=-15mm]bothNegated.bin 1);
\coordinate (c2) at ([xshift=-15mm]bothNegated.bin 2);

在此处输入图片描述

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikzgit}
\begin{document}
 \begin{circuitikz} 
\draw
(2,0) node[and port] (bothTrue) {}
(2,2) node[and port] (notB) {}
(2,4) node[and port] (notA) {}
(2,6) node[and port] (bothNegated) {};

\coordinate (c1) at ([xshift=-15mm]bothNegated.bin 1);
\coordinate (c2) at ([xshift=-15mm]bothNegated.bin 2);

\draw
(c1) node[anchor=east] (Anode) {A}

(c1) -| (bothNegated.in 1)
([xshift=10mm]c1) node[circ]{} |-  (bothTrue.in 1) 
([xshift=10mm]c1) |- node[circ,midway]{} (notB.in 1)
([xshift=10mm]c1) |- node[circ,midway]{} (notA.in 1)

(c2) node[anchor=east] {B}
(c2) -| (bothNegated.in 2)
([xshift=5mm]c2) node[circ]{} |-  (bothTrue.in 2)

([xshift=5mm]c2) |- node[circ,midway]{} (notA.in 2)
([xshift=5mm]c2) |- node[circ,midway]{} (notB.in 2)

(bothNegated.bin 2) node[ocirc, left] {}
(bothNegated.bin 1) node[ocirc, left] {}
(notA.bin 2) node[ocirc, left] {}
(notB.bin 1) node[ocirc, left] {};
\end{circuitikz}

\end{document}

相关内容