答案1
作为起点:
\documentclass{article}
\usepackage{circuitikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) to [short,o-] ++ (1,0) node[right] (p) {$p$}
(p.east) -- ++ (1,0) node[right] (q) {$q$}
(q.east) to [short,-o] ++ (1,0);
\end{tikzpicture}
\begin{tikzpicture}
\draw (0,0) to [short,o-] ++ (1,0) coordinate (a)
(a) |- ++ (1, 0.5) node[right] (p) {$p$}
(p.east) -| ++ (1,-0.5) coordinate (b)
(b) to [short,-o] ++ (1,0)
(a) |- ++ (1,-0.5) node[right] (q) {$q$}
(q) -| (b);
\end{tikzpicture}
\end{document}
编辑: 考虑的是@rmano 的评论。
答案2
另一种方法可以实现相同的效果。主要是。使用的tikz
节点形状。node[ocirc]{}
circuitikz
\documentclass[border=3mm]{standalone}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
\draw
(0,0)node[ocirc]{}
-- node[fill=white]{$p$} ++(2,0)
-- node[fill=white]{$q$} ++(2,0)node[ocirc]{}
(0,-2)node[ocirc]{}
-| ++(1,0.5)
-- node[fill=white]{$p$} ++(2,0)
|- ++(1,-0.5)node[ocirc]{}
-| ++(-1,-0.5)
-- node[fill=white]{$q$} ++(-2,0)
-- ++(0,0.5)
;
\end{circuitikz}
\end{document}