1

This question already has an answer here:

I was writing a book and used to draw some circuits on it. Now I'm working in a bachelor thesis and when I try to copy/paste the same drawing (using the same packages) it doesn't work.

   \documentclass[
        % -- memoir class options --
        12pt,               % tamanho da fonte
        openright,          % capítulos começam em pág ímpar (insere página vazia caso preciso)
        oneside,            % para impressão em verso e anverso. Oposto a oneside % modifcado
        a4paper,            % tamanho do papel
        english,            % idioma adicional para hifenização
        french,             % idioma adicional para hifenização
        spanish,            % idioma adicional para hifenização
        brazil              % o último idioma é o principal do documento
        ]{abntex2}

        \usepackage{graphicx}           % Inclusão de gráficos
        \usepackage{amsmath,indentfirst}            % for matrices
        \usepackage{algorithm}
        \usepackage{listings}
        \usepackage{subcaption}                     % Customizing Listing
        \usepackage{tabu}
        \usepackage{siunitx}
        \usepackage{pgfplots}                       % axis
        \usepackage{polynom}                        % for \polylongdiv{}
        \usepackage{esint}
        \usepackage{amssymb}                       
        \usepackage{array}
        \usepackage{steinmetz}
        \usepackage{circuitikz}
        \usepackage{tikz}

        \usetikzlibrary{shapes.geometric, arrows, shapes.arrows,decorations.pathmorphing, matrix,chains,scopes,positioning,fit,shapes.gates.logic.US, shapes.gates.logic.IEC, calc,
        decorations.markings,arrows.meta,bending}

\begin{document}

        \begin{center}
        \begin{tikzpicture}
        \draw (0,0) to[short,o-] (0.7,0) to[/tikz/circuitikz/bipoles/length=0.9cm,R] (2,0) to[/tikz/circuitikz/bipoles/length=0.9cm,L] (3.3,0)  to[short,-*] (4,0) to[short,-*] (5.4,0) to[/tikz/circuitikz/bipoles/length=0.9cm,L] (6.7,0)
            (6.7,-2.5) to[/tikz/circuitikz/bipoles/length=0.9cm,vR] (6.7,0)
            (4,0) -- (4,-0.5) -- (4.4, -0.5)
            to[/tikz/circuitikz/bipoles/length=0.9cm,L] (4.4,-2) -- (4,-2) -- (4,-2.5) to[short,-*] (5.4,-2.5) -- (6.7,-2.5)
            (4,-0.5) -- (3.6, -0.5) to[/tikz/circuitikz/bipoles/length=0.9cm,R] (3.6,-2) -- (4,-2) to[short,-*] (4,-2.5) to[short,-o] (0,-2.5);

        \draw (-0.15,0.6) node {$\hat{I}_1$};
        \draw (4.8,0.6) node {$\hat{I}_2$};
        \draw (0,-0.3) node {$+$};
        \draw (0,-1.1) node {$\hat{V}_1$};
        \draw (0,-2.3) node {$-$};
        \draw (1.25,0.4) node {$R_1$};
        \draw (2.55,0.4) node {$X_1$};
        \draw (6.05,0.4) node {$X_2$};
        \draw (7.3,-1.25) node {$\displaystyle{\frac{R_2}{s}}$};
        \draw (3.1,-1) node {$G_c$};
        \draw (5,-1) node {$B_m$};
        \draw (5.5,-0.4) node {$+$};
        \draw (5.5,-1.1) node {$\hat{E}_2$};    
        \draw (5.5,-2.3) node {$-$};
        \draw (2.9,-1.7) node {$\hat{I}_c$};    
        \draw (5.05,-1.7) node {$\hat{I}_m$};

        \draw (-0.5,0.25) -- (0,0.25)
            (3.27,-1.35) -- (3.27,-1.85)
            (4.68,-1.35) -- (4.68,-1.85);

        \draw[-latex] (4.55,0.25) -- (5.05,0.25);

        \draw[fill=black] (0,0.3) -- (0,0.2) -- (0.15,0.25) -- cycle;
        \draw[fill=black] (4.6,-1.85) -- (4.75,-1.85) -- (4.68,-1.98) -- cycle;
        \draw[fill=black] (3.20,-1.85) -- (3.34,-1.85) -- (3.27,-1.99) -- cycle;

        \end{tikzpicture}
        \end{center}

    \end{document}

The original drawing:

enter image description here

The error types:

! Package tikz Error: + or - expected.See the tikz package documentation for explanation.Type H for immediate help.... \draw (0,0) to[short,o-] (0.7,0)

! Package tikz Error: Giving up on this path. Did you forget a semicolon?.See the tikz package documentation for explanation.Type H for immediate help.... \draw (0,0) to[short,o-] (0.7,0)

! Undefined control sequence.\pgf@let@token ...ape, rotate=\pgf@circ@direction, yscale=\ctikzvalof {mirr... \draw (0,0) to[short,o-] (0.7,0)

! Argument of \pgf@circ@stripdecimals has an extra }.\par \draw (0,0) to[short,o-] (0.7,0)

! Missing number, treated as zero.p \draw (0,0) to[short,o-] (0.7,0)

and a lot more =/ What could I do?

marked as duplicate by egreg, Paulo Cereda, CarLaTeX, Community Jan 24 '18 at 14:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    It worked fine for me, using \documentclass{article}. – John Kormylo Jan 22 '18 at 16:36
  • It works with up-to-date packages, so I would guess that the computer where this doesn't work has older versions of circuitikz or pgf, and if that is the case then updating would solve it. To figure out which versions you have on the two computers, you can add \listfiles before \documentclass, and look at the *File list* near the end of the .log file. You don't need all the text to get that though, make a document such as \listfiles \documentclass{...} <all of your packages etc.> \begin{document} foo \end{document} and compile that, then look at the .log file. – Torbjørn T. Jan 23 '18 at 17:29
  • 1
    Hi! We need to know more about the other document. :) – Paulo Cereda Jan 24 '18 at 13:38
  • 1
    Hm I see French and Spanish there! It's probably related to the TikZ shortandoff-on thingy... Try adding \usetikzlibrary{babel}, out of curiosity... – Paulo Cereda Jan 24 '18 at 13:40
  • 1
    Glad it worked! We ducks are very good at solving problems. :) Some languages change category codes which might potentially interfere with TikZ diagrams, that's why they decided to include a babel library that addresses this issue. – Paulo Cereda Jan 24 '18 at 13:53

Browse other questions tagged or ask your own question.