2

I have troubles obtaining the right shape of an inductor using circuitikz. I am getting a black filled rectangle instead :

circuitikz bug ?

Here is my MWE :

\documentclass{article}

\usepackage{circuitikz}
\usepackage[french]{babel}

\begin{document}

\begin{circuitikz}
\draw (0,0)to[european inductor](2,0);
\draw(0,0)to(0,-.25)to[ground](0,-.5);
\end{circuitikz}

\end{document}

I am using Windows 7 and MiKTeX 2.9, which I just updated. Thank you.

I missed the fact that the european inductor is indeed correct. It seems like the true issue is with cute inductor, or simply L : I get the following error message :

! Undefined control sequence.
\pgf@sh@bg@cuteinductorshape ...mationadjustments
\par \pgfmathsetlength {\p...
l.8 \draw (0,0) to [L] (2,0)
;
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined. 

I suspect there is a connection with this question : Miktex 2.9 pgfplots, circuitikz...

Montes
  • 21
  • In fact the inductor is just an example, because the ground doesn't work either... – Montes May 17 '18 at 16:25
  • On my TeXLive distribution your code does only compile if I remove the babel package. –  May 17 '18 at 16:26
  • 1
    @marmot Mine too. You can add \usetikzlibrary{babel} to make it work. – Phelype Oleinik May 17 '18 at 16:27
  • @Montes Looking at the documentation of circuitikz, the european inductor looks correct. – Phelype Oleinik May 17 '18 at 16:29
  • The filled rectangle is the European style (which you've selected with european inductor). You can try cute inductor or american inductor to see the other styles. Also check out the options listed in the manual to set the styles globally so you don't need to type out the style for each and every inductor in your diagrams. – Paul Gessler May 17 '18 at 16:39
  • I have edited my question considering your answers. – Montes May 17 '18 at 17:13

1 Answers1

3
  • you should add tikz library babel (it remove changes introduced by french babel in tikz code)
  • ground is node

\documentclass{article}

\usepackage[french]{babel}
\usepackage{circuitikz}
\usetikzlibrary{babel}

\begin{document}
    \begin{circuitikz}
\draw   (0,0) to [european inductor] (2,0)
        (0,0) -- (0,-0.25) node [ground] {};
    \end{circuitikz}
\end{document}

enter image description here

edit: with use L for inductor:

\documentclass{article}

\usepackage[french]{babel}
\usepackage{circuitikz}
\usetikzlibrary{babel}

\begin{document}
    \begin{circuitikz}
\draw   (0,0) to [L] (2,0)
        (0,0) -- (0,-0.25) node [ground] {};
    \end{circuitikz}
\end{document}

enter image description here

Zarko
  • 296,517
  • I can't make \usetikzlibrary{babel} work : I get ! I can't find filetikzlibrarybabel.code.tex'.`
  • – Montes May 17 '18 at 17:26
  • Which may me more serious, when I delete this line, I get `! Undefined control sequence.
  • \pgf@sh@bg@cuteinductorshapeetc. which meansL` doesn't work...

    – Montes May 17 '18 at 17:27
  • 1
    @Montes, it seems that you have outdated tikz and circuitikz packages. probably the best way is to first remove both packages from latex installation and then reinstalled and after then check if exist updates for your latex installation. you can also try just last of mentioned step. i use tikz 3.0.1a and circitikz 0.8.3 (2017/05/28). – Zarko May 17 '18 at 17:31
  • I've just reinstalled the whole latex distribution and I still get ! Package pgfkeys Error: I do not know the key '/tikz/handle active characters in code' and I am going to ignore it. + ! Undefined control sequence. \pgf@sh@bg@cuteinductorshape ...mationadjustments \par \pgfmathsetlength {\p... l.10 \draw (0,0) to [L] (2,0) ;... – Montes May 18 '18 at 09:26
  • is this the only installation of latex on your computer? which version of the package circuitikz you have now? – Zarko May 18 '18 at 09:47
  • also see https://tex.stackexchange.com/questions/86023/tikz-declare-function-and-babel-french-option – Zarko May 18 '18 at 10:59
  • I had indeed other LaTeX installations on my computer... The latest version of circuitikz is now properly used, and everything's perfect. Thanks ! – Montes May 18 '18 at 19:15
  • @Montes, i'm glad that you succeed to fix your latex installation. happy tex-ing! – Zarko May 18 '18 at 19:23