我需要帮助调整 AND、OR 和 NOT 逻辑门的大小。
我尝试使用此命令来调整大小,但是不起作用。
\pgfextra{\ctikzset{tripoles/american and port/width=.7, tripoles/american and port/height=.59}}
完整代码如下:
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[left = 23mm, bottom = 24mm, top = 24mm, right = 29mm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{tikz}
\usepackage{circuitikz}
\usetikzlibrary{circuits.logic.US}
\usetikzlibrary{calc}
\usepackage{pgfplots}
\begin{document}
\begin{figure}[h]
\centering
\begin{tikzpicture}
\pgfextra{\ctikzset{tripoles/american and port/width=.7,
tripoles/american and port/height=.59}}
\draw[thin] (0,0) -- (0,5.6) node[above]{A};
\draw (-0.5,4.25) node[not port, rotate=270](neA){};
\draw[thin] (0,5.25) -- (-0.5, 5.25);
\draw[thin] (-0.5,5.25) -- (neA.in);
\draw[thin] (neA.out) -- (-0.5,0);
\draw[thin] (1.05,0) -- (1.05,5.6) node[above]{B};
\draw (0.55,4.25) node[not port, rotate=270](neB){};
\draw[thin] (1.05,5.25) -- (0.55,5.25);
\draw[thin] (0.55,5.25) -- (neB.in);
\draw[thin] (neB.out) -- (0.55,0);
\draw[thin] (1.75,0) -- (1.75,5.6) node[above]{E};
\draw (2.9,3.85) node[and port, number inputs = 4] (ikolo1) {};
\draw (2.9,2.8) node[and port, number inputs = 4] (ikolo2) {};
\draw (2.9,1.75) node[and port, number inputs = 4] (ikolo3) {};
\draw (2.9,0.7) node[and port, number inputs = 4] (ikolo4) {};
\draw(-1.4,3.6) node[left = 4mm]{$D_0$} -- (ikolo1.in 4);
\draw(1.75,3.725) [*-] -- (ikolo1.in 3);
\draw(0.55, 3.85) [*-] -- (ikolo1.in 2);
\draw(-0.5,3.975) [*-] -- (ikolo1.in 1);
\draw(-1.4,2.55) node[left = 4mm]{$D_1$} -- (ikolo2.in 4);
\draw(1.75,2.675) [*-] -- (ikolo2.in 3);
\draw(0.55, 2.8) [*-] -- (ikolo2.in 2);
\draw(-0.5,2.925) [*-] -- (ikolo2.in 1);
\draw(-1.4,1.5) node[left = 4mm]{$D_2$} -- (ikolo3.in 4);
\draw(1.75,1.625) [*-] -- (ikolo3.in 3);
\draw(0.55, 1.75) [*-] -- (ikolo3.in 2);
\draw(-0.5,1.875) [*-] -- (ikolo3.in 1);
\draw(-1.4,0.45) node[left = 4mm]{$D_3$} -- (ikolo4.in 4);
\draw(1.75,0.575) [*-] -- (ikolo4.in 3);
\draw(0.55, 0.7) [*-] -- (ikolo4.in 2);
\draw(-0.5,0.825) [*-] -- (ikolo4.in 1);
\draw (5.4,2.825) node[or port, number inputs = 4] (ilikolo) {};
\draw(ikolo1.out) -| (ilikolo.in 1);
\draw(ikolo2.out) -| (ilikolo.in 2);
\draw(ikolo3.out) -| (ilikolo.in 3);
\draw(ikolo4.out) -| (ilikolo.in 4);
\draw[short](ilikolo.out) -- (6.55,2.825) node[right = 4mm] {Y};
\end{tikzpicture}
\caption{Implementacija multipleksera 4/1 sa osnovnim logičkim kolima}
\label{Sličica:fig3}
\end{figure}
\end{document}
我正在尝试获取下一个(门 | 宽度 | 高度):(AND | 0.7 | 0.59),(OR | 0.82 | 0.56),(NOT | 0.37 | 0.6)
这是我想要实现的图像:
我认为这可能可以通过盒子实现,但我不知道如何实现它们。
答案1
大多数情况下,您需要使用相对坐标而不是绝对坐标。
不可否认的是,一些改变纯属无端。
\documentclass{standalone}
%\usepackage[utf8]{inputenc}
%\usepackage[T1]{fontenc}
%\usepackage[english]{babel}
\usepackage{tikz}% redundant
\usepackage{circuitikz}
%\usetikzlibrary{circuits.logic.US}
\usetikzlibrary{calc}% redundant
\usepackage{pgfplots}% not used
\begin{document}
\begin{tikzpicture}
%\ctikzset{tripoles/american and port/width=.7}
%\ctikzset{tripoles/american and port/height=.59}
\ctikzset{logic ports/scale=0.6}
\draw[thin] (0,0) -- (0,5.6) node[above]{A};
\draw (-0.5,4.5) node[not port, rotate=270](neA){};
\draw[thin] (0,5.25) node[circ]{} -| (neA.in);
\draw[thin] (neA.out) -- (-0.5,0);
\draw[thin] (1.05,0) -- (1.05,5.6) node[above]{B};
\draw (0.55,4.5) node[not port, rotate=270](neB){};
\draw[thin] (1.05,5.25) node[circ]{} -| (neB.in);
\draw[thin] (neB.out) -- (0.55,0);
\draw[thin] (1.75,0) -- (1.75,5.6) node[above](E){E};
\draw (2.9,3.85) node[and port, number inputs = 4] (ikolo1) {};
\draw (2.9,2.8) node[and port, number inputs = 4] (ikolo2) {};
\draw (2.9,1.75) node[and port, number inputs = 4] (ikolo3) {};
\draw (2.9,0.7) node[and port, number inputs = 4] (ikolo4) {};
\draw (ikolo1.in 4) -- ++(-3.5,0) node[left]{$D_0$};
\draw (E |- ikolo1.in 3) to[short, *-] (ikolo1.in 3);
\draw(neB |- ikolo1.in 2) to[short, *-] (ikolo1.in 2);
\draw(neA |- ikolo1.in 1) to[short, *-] (ikolo1.in 1);
\draw (ikolo2.in 4) -- ++(-3.5,0) node[left]{$D_1$};
\draw (E |- ikolo2.in 3) to[short, *-] (ikolo2.in 3);
\draw(neB |- ikolo2.in 2) to[short, *-] (ikolo2.in 2);
\draw(neA |- ikolo2.in 1) to[short, *-] (ikolo2.in 1);
\draw (ikolo3.in 4) -- ++(-3.5,0) node[left]{$D_2$};
\draw (E |- ikolo3.in 3) to[short, *-] (ikolo3.in 3);
\draw(neB |- ikolo3.in 2) to[short, *-] (ikolo3.in 2);
\draw(neA |- ikolo3.in 1) to[short, *-] (ikolo3.in 1);
\draw (ikolo4.in 4) -- ++(-3.5,0) node[left]{$D_3$};
\draw (E |- ikolo4.in 3) to[short, *-] (ikolo4.in 3);
\draw(neB |- ikolo4.in 2) to[short, *-] (ikolo4.in 2);
\draw(neA |- ikolo4.in 1) to[short, *-] (ikolo4.in 1);
\path ($(ikolo2.out)!0.5!(ikolo3.out)$) ++(1.5,0) node[or port, number inputs = 4] (ilikolo) {};
\draw(ikolo1.out) -| (ilikolo.in 1);
\draw (ilikolo.in 2) -- ++(-0.5,0) |- (ikolo2.out);
\draw (ilikolo.in 3) -- ++(-0.5,0) |- (ikolo3.out);
\draw(ikolo4.out) -| (ilikolo.in 4);
\draw (ilikolo.out) node[right] {Y};
\end{tikzpicture}
\end{document}