1

I'm trying to draw just one JK flip flop using Circuitikz, but Overleaf does not compile it properly:

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{circuitikz}

\tikzset{
% async
latch/.style={flipflop, flipflop def={t1=D, t6=Q, t3=CLK, 
t4=\ctikztextnot{Q}}},
flipflop SR/.style={flipflop, flipflop def={t1=S, t3=R, t6=Q, 
t4=\ctikztextnot{Q}}},
% sync
flipflop D/.style={flipflop, flipflop def={t1=D, t6=Q, c3=1, 
t4=\ctikztextnot{Q}}},
 flipflop T/.style={flipflop, flipflop def={t1=T, t6=Q, c3=1, 
t4=\ctikztextnot{Q}}},
flipflop JK/.style={flipflop,
flipflop def={t1=J, t3=K, c2=1, t6=Q, t4=\ctikztextnot{Q}}},
% additional features
add async SR/.style={flipflop def={%
tu={\ctikztextnot{SET}}, td={\ctikztextnot{RST}}}},
dot on notQ/.style={flipflop def={t4={Q}, n4=1}},
 }


 \begin{document}

 \begin{circuitikz}
  \draw 
  (0,0) node[flipflop JK]{JK}
  ;
  \end{circuitikz}

  \end{document}

I am following CircuiTikZ documentation but nothing comes clear.

1
  • Flip-flops have been added to v1.0.0-pre1. I did a fast check with \pgfcircversion and overleaf is still to 0.8.3, which is quite old. You need to download the circuitikzgit.sty file from circuitikz.github.io/circuitikz, add it to your project, and us it as explained in that page.
    – Rmano
    Commented Dec 23, 2019 at 12:34

1 Answer 1

3

Overleaf is using a stable, but quite old, versions of lot of TeX packages. In the case of circuitikz, as of today, the shipped version is 0.8.3, which is almost one and a half year old.

Fortunately, circuitikz provides a way to download whichever version you want as a single file. Go to the page https://circuitikz.github.io/circuitikz/ and download the version you want (in this case, right-click on "version 1.0.10-pre1" and save it in your PC somewhere as circuitikzgit.sty).

Now you can upload it to overleaf, in the same directory as your project, and use it by changing the \usepackage from circuitikz to circuitikzgit.

screenshot of an overleaf session

BTW, if you are using the default version of the flip-flops, you do not need to re-define them as in your example.

You must log in to answer this question.