2

I'm using the tikz circuit library for my drawings. But I just realized that I need Transistors. These exist for circuitikz, but not in the tikz library. Is there a way to only use the circuitikz shapes without loading the complete circuitikz package?

The problem is that I already have existing drawings, done with the tikz library, and circuitikz is creating conflicts if used in the same document (related:Does a workaround or solution exists for the label conflict of circuitikz and TikZ?). I would like to avoid redrawing the circuits done with the tikz circuit library.

For example this code would break:

\documentclass[tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC}
\usetikzlibrary{positioning}

\usepackage{circuitikz}
\begin{document}

    \begin{tikzpicture}[circuit ee IEC]

        \draw (0,0) to [diode={name=LED}] (0,2);
        \node[right of=LED] {LED};
    \end{tikzpicture}

\end{document}

1 Answer 1

3

Tripoles are normal TikZ nodes, and they are defined in pgfcirctripoles.sty.

You could try inputting only that file, but unfortunately it has several dependencies on other files from the CircuiTikZ distribution.

So yeah, if you want you can extract certain node shapes from that file, but then you'll have to dig around for the definitions of needed macros/keys. Long and boring.

Anyway, if the problem is just that CircuiTikZ redefines resistor (well, actually my resistor was there before there was a circuit library in TikZ ;) ) you could just edit this line

\tikzset{resistor/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l=#1}}

into

\tikzset{R/.style= {\circuitikzbasekey, /tikz/to path=\pgf@circ@resistor@path, l=#1}}

then remove this line

\tikzset{R/.style= {resistor = #1}}

(both from circuitikz1.code.tex), and then the syntax to[R] should work with no more overriting of TikZ's resistor.

Perhaps I will introduce a package option that does something of that sort in the next release.

4
  • thx for the info. I tried the manual patch, but it is still broken. Looks like there is also a problem with the name key. It would be great if there would an option for compatibility (even if CircuiTikZ was first). So you are the author of the CircuiTikZ package? You might want to add yourself here: meta.tex.stackexchange.com/questions/1181/… and put some info in your profile.
    – someonr
    Nov 29, 2013 at 2:05
  • I added an example for the name key to the question
    – someonr
    Nov 29, 2013 at 2:32
  • 2
    OK, I added a compatibility mode and it seems to work. You can find the updated files here dropbox.com/s/ntf79tdkskkqlu1/circuitikz.zip Can you test it out for me a bit? :)
    – kenshin
    Nov 29, 2013 at 11:50
  • Great! Just perfect timing, because this weekend I have to draw circuits anyway :D. Just a quick test: my document was successfully compiled thanks to the new compatibility option. Will report any problem ;)
    – someonr
    Nov 29, 2013 at 13:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .