![结果](https://linux22.com/image/368201/%E7%BB%93%E6%9E%9C.png)
有人知道克劳德·香农论文中图 1、2 和 3 的代码吗?继电器和开关电路的符号分析“?
我见过 ”综合 LaTeX 符号列表“和”Circuitikz – 使用 TikZ 绘制电网络”包,但就我目前所见,我真的看不出如何生成类似叉子和多图的双向带圆圈线端,这在本质上非常简单,但没有明确的构造符号或代码。
答案1
picture
, 钛钾Z、图 3 的 Metapost 版本。所有三种变体都可以根据需要进行缩放。
两个小免责声明:
- 这里没有关于图中标签的放置和居中等花哨的自动化操作,只是手动进行一些调整。
- 对于我来说,Metapost 版本无法正确居中。我对 Metapost 还不是很熟悉,所以我还不知道原因。
结果
Metapost 版本的比例与此处的其他两个版本不同。如前所述,这可以调整。我lipsum
在其周围添加了一些文本,以查看它在页面上的显示效果;显然这并不是严格要求的。
代码
我把这三者都放在一个文档中。如果您要使用 Metapost 版本,请使用 进行编译lualatex
。
\documentclass[a4paper]{article}
\usepackage{lipsum}
\usepackage{mflogo}
\usepackage{tikz}
\usepackage{luamplib}
\begin{document}
\lipsum[1]
\setlength\unitlength{0.5cm} % Adjust as needed
\begin{figure}
\centering
\begin{picture}(5,3)(2.5,0.5)
\put(0,2){\line(1,0){1}}
\put(1,2){\circle*{0.1}}
\put(1,2){\line(0,1){1}}
\put(1,2){\line(0,-1){1}}
\put(1,3){\line(1,0){1}}
\put(1,1){\line(1,0){1}}
\put(2.05,3){\circle{0.1}}
\put(2.95,3){\circle{0.1}}
\put(2.05,1){\circle{0.1}}
\put(2.95,1){\circle{0.1}}
\put(4,2){\line(0,1){1}}
\put(4,2){\line(0,-1){1}}
\put(3,3){\line(1,0){1}}
\put(3,1){\line(1,0){1}}
\put(4,2){\circle*{0.1}}
\put(4,2){\line(1,0){1}}
\put(2.41,3.25){$x$}
\put(2.41,0.55){$y$}
\put(5.2,1.9){$=$}
\put(5.65,2){\line(1,0){1}}
\put(6.70,2){\circle{0.1}}
\put(7.60,2){\circle{0.1}}
\put(7.65,2){\line(1,0){1}}
\put(6.85,2.25){$x \cdot y$}
\end{picture}
\caption{Interpretation of multiplication. (\texttt{picture} environment)}
\end{figure}
\lipsum[2]
\begin{figure}
\centering
\begin{tikzpicture}[scale=0.5] % adjust as needed
\draw (0,0) -- (1, 0) -- (1, 1) -- (2, 1)
(1, 0) -- (1,-1) -- (2,-1)
(3, 1) -- (4, 1) -- (4, 0) -- (5,0)
(3,-1) -- (4,-1) -- (4, 0)
(2.1, 1) circle (0.1)
(2.1,-1) circle (0.1)
(2.9, 1) circle (0.1)
(2.9,-1) circle (0.1)
(2.5, 1.3) node {$x$}
(2.5,-1.3) node {$y$}
;
\fill (1,0) circle (0.1)
(4,0) circle (0.1)
;
\node at (5.25,-0.02) {$=$};
\draw (5.75,0) -- ++(1,0)
++(1,0) -- ++(1,0)
(6.85,0) circle (0.1)
(7.65,0) circle (0.1)
(7.25,0.3) node {$x \cdot y$}
;
\end{tikzpicture}
\caption{Interpretation of multiplication. (Ti\emph{k}Z version) }
\end{figure}
\mplibtextextlabel{enable}
\begin{figure}
\centering
\begin{mplibcode}
u=10mm; % scaling
beginfig(1);
draw (0,0) -- (1u,0) -- (1u,1u) -- (2u,1u);
draw (1u,0) -- (1u,-1u) -- (2u,-1u);
draw (3u,1u) -- (4u,1u) -- (4u,0) -- (5u,0);
draw (3u,-1u) -- (4u,-1u) -- (4u,0);
filldraw fullcircle scaled (0.1u) shifted (1u,0);
draw fullcircle scaled (0.1u) shifted (2.05u,1u);
draw fullcircle scaled (0.1u) shifted (2.05u,-1u);
draw fullcircle scaled (0.1u) shifted (2.95u,1u);
draw fullcircle scaled (0.1u) shifted (2.95u,-1u);
filldraw fullcircle scaled (0.1u) shifted (4u,0);
label.top(btex $x$ etex,(2.5u,1u));
label.bot(btex $y$ etex,(2.5u,-1u));
label(btex $=$ etex,(5.25u,0));
draw (5.5u,0) -- (6.75u,0);
draw (7.75u,0) -- (8.75u,0);
draw fullcircle scaled (0.1u) shifted (6.8u,0);
draw fullcircle scaled (0.1u) shifted (7.7u,0);
label.top(btex $x \cdot y$ etex,(7.25u,0));
endfig;
\end{mplibcode}
\caption{Interpretation of multiplication. (\MP{} version) }
\end{figure}
\end{document}