3

I would like to use circuitikz with TikZ. However, I find that circuitikz modifies or does not recognize TikZ labels. The author of circuitiz has commented that in the "released version of CircuiTikz (0.2.3) the problem has been fixed." But the problem still exists.

Does a workaround or solution exists for the label conflict of circuitikz and tikz?

Here is a simple example using TikZ v2.10 and circuitikz v0.23. Instead of getting a resistor labeled R1 below it, I get a resistor labeled info above it when circuitikz is active. It makes no difference which environment is used, tikzpicture or circuitikz.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC}
\usepackage{circuitikz}
\usepackage{siunitx}
\begin{document}
\begin{tikzpicture}[circuit ee IEC,
    set resistor graphic    = var resistor IEC graphic]
\draw (0,0) to[resistor={info'={$R_1$}}] (2,0);
\end{tikzpicture}
\end{document}
10
  • The problem is not that Circuitikz redefines the info style, but that it redefines the resistor style, and arguments to it aren't processed as options anymore. Do you need a way to get a label below the resistor when circuitikz is active and you are in a tikzpicture, or could you switch to a circuitikz environment and use the circuitikz syntax of l_=<label> for a label?
    – Jake
    May 31, 2011 at 8:59
  • @xport. I just discovered your comment! So, thanks for the clarification regarding the redefinition that circuitikz makes with resistor style. I thought that tikz and circuitikz could be used interchangeably with ease. Not, so by my experience. However, I do appreciate some of the features of the circuitikz syntax like l_=<label>.
    – zun
    Aug 17, 2011 at 7:34
  • @zun: I don't know much about TikZ. I use PSTricks. The comment does not belong to me. :-) Aug 17, 2011 at 8:06
  • I prefer to use the circuits library of TikZ (version 2.10). I find it's much nicer than circuitikz. :)
    – Count Zero
    Sep 24, 2011 at 11:29
  • @Jake: Could you provide an answer based on the additional information in zun's comment from Aug 17 (that was wrongly directed at xport)?
    – lockstep
    Dec 4, 2011 at 14:10

2 Answers 2

4

While to late, for future people stumbling across this, when deciding between tikz's circiuts and circuitikz, one does no have to choose anymore, since a package option compatability was added, that prefixes all circuitikz styles with an asterisk *.

From the circuitikz manual

TikZ’s own circuit library, which is based on CircuiTikZ, (re?)defines several styles used by this library. In order to have them work together I added the compatibility package option, which basically prefixes the names of all CircuiTikZ to[] styles with an asterisk

1

Though I have not found a direct workaround or solution to my original question regarding the label conflict between tikz and circuitikz, I have been using the following method for many months. Others, I'm certain, use the same idea, as it's based on the circuitikz manual. I use the circuitikz (and tikz) package, but rely principally on the circuitikz library.

\documentclass{article}
\usepackage{tikz}
\usepackage[siunitx,european,american]{circuitikz}

\begin{document}
\begin{tikzpicture}
\draw (0,0) to[R,l_=$R_1$] (2,0);
\draw (0,1) to[R,l=$R_2$]  (2,1);
\end{tikzpicture}
\end{document}

You must log in to answer this question.

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