
제가 Circuitikz로 그린 이 그림은 첫 번째 돌 이후로 제가 다뤘던 최초의 "복잡한" 그림입니다. 그러나 향후 프로젝트를 위해 이를 더 "수출 가능"하게 만드는 것이 가능한지, 즉 변경이 가능한지 알고 싶습니다. FlipFlops 간의 분리로 인해 지금과 달리 위치가 바뀌는 것은 많지 않습니다.
이것이 내가 쓴 것입니다:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[siunitx, RPvoltages]{circuitikzgit}
\tikzset{flipflop JK/.style={flipflop,
flipflop def={t1=Q, t3={\ctikztextnot{Q}}, t6=J, t4=K,c5=1, td=PRST,
tu=CLR},
}}
\begin{document}
\begin{center}
\begin{circuitikz}[scale=0.8, transform shape]
\node[vsourcesquareshape, rotate=90](clk){};
\draw (-3,0) node[flipflop JK,external pins width=0](FF0){};
\draw (-6,0) node[flipflop JK,external pins width=0](FF1){};
\draw (-9,0) node[flipflop JK,external pins width=0](FF2){};
\draw (-12,0) node[flipflop JK,external pins width=0](FF3){};
\draw (-15,0) node[flipflop JK,external pins width=0](FF4){};
\draw (clk.north) -- (FF0.east)node[inputarrow,rotate=180]{};
\draw (FF0.pin 1) -| (-4.5,0);
\draw (-4.5,0) -- (FF1.pin 5)node[inputarrow,rotate=180]{};
\draw (FF1.pin 1) -| (-7.5,0);
\draw (-7.5,0) -- (FF2.pin 5)node[inputarrow,rotate=180]{};
\draw (FF2.pin 1) -| (-10.5,0);
\draw (-10.5,0) -- (FF3.pin 5)node[inputarrow,rotate=180]{};
\draw (FF3.pin 1) -| (-13.5,0);
\draw (-13.5,0) -- (FF4.pin 5)node[inputarrow,rotate=180]{};
\draw (FF0.pin 1) -| (-4.5,2)node[inputarrow,rotate=90]
{\rotatebox{-90}{$Q_0$}};
\draw (FF1.pin 1) -| (-7.5,2)node[inputarrow,rotate=90]
{\rotatebox{-90}{$Q_1$}};
\draw (FF2.pin 1) -| (-10.5,2)node[inputarrow,rotate=90]
{\rotatebox{-90}{$Q_2$}};
\draw (FF3.pin 1) -| (-13.5,2)node[inputarrow,rotate=90]
{\rotatebox{-90}{$Q_3$}};
\draw (FF4.pin 1) -| (-16.5,2)node[inputarrow,rotate=90]
{\rotatebox{-90}{$Q_4$}};
\end{circuitikz}
\end{center}
\end{document}
답변1
나는 이 질문을 회로의 일부 기능을 전 세계적으로 더 쉽게 변경하려는 의도로 해석합니다. 이는 Rmano가 지적한 대로 calc를 chains
사용 하여 수행할 수 있습니다 . \foreach
플립플롭을 체인에 걸고 나머지는 루프로 만들 수 있습니다. 그러면 이러한 매개변수는 한 번만 나타나며 전역적으로 변경될 수 있습니다. 예를 들어, 플립플롭 사이의 거리는 다음과 같이 주어진다 node distance
.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[siunitx, RPvoltages]{circuitikz}
\usetikzlibrary{calc,chains}
\tikzset{flipflop JK/.style={flipflop,
flipflop def={t1=Q, t3={\ctikztextnot{Q}}, t6=J, t4=K,c5=1, td=PRST,
tu=CLR},
}}
\begin{document}
\begin{center}
\begin{circuitikz}[scale=0.8, transform shape]
\node[vsourcesquareshape, rotate=90](clk){};
% do the flip flops
\begin{scope}[start chain=going left,node distance=1.5cm,
nodes={on chain,flipflop JK,external pins width=0}]
\path foreach \X in {0,...,4}
{node(FF\X){}};
\end{scope}
% determine the midpoints between the flip flops and name them
\path foreach \X in {1,...,4}
{(FF\the\numexpr\X-1|-0,0) -- coordinate (c\X) (FF\X|-0,0)};
% add one more of the points to the left
\path let \p1=($(FF0.center)-(c1)$) in (FF4.center|-0,0)
++ (-\x1,0) coordinate (c5);
% from original code
\draw (clk.north) -- (FF0.east)node[inputarrow,rotate=180]{};
% draw the stuff between those nodes
\foreach \X in {1,...,4}
{\draw (FF\the\numexpr\X-1\relax.pin 1) -| (c\X);
\draw (c\X) -- (FF\X.pin 5)node[inputarrow,rotate=180]{};
\draw (FF\the\numexpr\X-1\relax.pin 1) -| (c\X|-0,2)node[inputarrow,rotate=90]
{\rotatebox{-90}{$Q_{\the\numexpr\X-1\relax}$}};}
% use c5
\draw (FF4.pin 1) -| (c5|-0,2) node[inputarrow,rotate=90]
{\rotatebox{-90}{$Q_4$}};
\end{circuitikz}
\end{center}
\end{document}
코드를 실행하는 방법을 알려준 Rmano에게 큰 감사를 드립니다. circuitikz
CTAN 의 최신 버전을 사용하고 있습니다 . 그리고 죄송합니다. 저는 이 내용을 뒷면에 어떻게 넣는지 말씀드릴 수 없으며, 뒷면에 있는 문제를 해결하는 방법에 대해서도 아는 바가 없습니다.