2

Are the "standard" tikz circuit library and circuitikz incompatible?
Consider the following MWE:

\documentclass{article} 
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{pgfplots}\pgfplotsset{compat=1.9} 
\usepackage[siunitx]{circuitikz}
\usetikzlibrary{positioning, shapes, fadings, calc, 
    % circuits, circuits.ee.IEC
}
\begin{document}

    %Standard libraries battery: 
    %
    %\begin{tikzpicture}[baseline, huge circuit symbols, circuit ee IEC,
    %        elec/.style={circle, inner sep=2pt, draw=blue, fill=blue},
    %    ]
    %    \node (E) [battery, info=135:$E$] at (0,3.4) {};
    % \end{tikzpicture}
    
   
   tikz circuit: 
    
    \begin{circuitikz}[
            american,
       ]
        \draw (0,0) to[R] (0,2);
    \end{circuitikz}
\end{document}

The output is as expected:

only tikzcircuit

but if I uncomment the commented parts, I have:

both active

...and if I add a labels for example I often have errors in one of the two environments. Is there a way to use both of the circuit facilities in the same document of I have simply to choose one?

Thanks!

1
  • 1
    Circuitiz is TikZ. The problem is that the circuits.ee.IEC library is incompatible with the circuitikz definitions. Originally circuitz components were spelled differently (R vs. resistor), but now both names do the same thing. – John Kormylo Feb 6 '16 at 18:33
3

Actually, one could use this trick to load any tikzlibrary temporarily.

\documentclass{article} 
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}\pgfplotsset{compat=1.9} 
\usepackage[siunitx]{circuitikz}

\begin{document}

    circuit ee IEC

\bgroup% local definitions
\usetikzlibrary{circuits.ee.IEC}
    \begin{circuitikz}[circuit ee IEC]
      \node (E) [battery, info=135:$E$] at (0,3.4) {};
    \end{circuitikz}
\egroup

   circuitikz components

    \begin{tikzpicture}[american]
        \draw (0,0) to[R] (0,2);
    \end{tikzpicture}

\end{document}

circuits

2
  • For some reason it is not working in beamer... grrrr. – Rmano Feb 7 '16 at 11:27
  • It worked fine for me. Just be careful not to load the circuit tikzlibraries globally. – John Kormylo Feb 7 '16 at 16:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.