1

This code

\documentclass{article}

\usepackage{tikz}
\usepackage{circuitikz}

\begin{document}

\begin{figure}[h!]
  \begin{center}
  \begin{circuitikz}
  \draw (0,0) to[C=$ASCII_TEXT$] (2,0); % The capacitor
  \end{circuitikz}
    \caption{My first circuit.}
  \end{center}
\end{figure}

\end{document}

produces the correct result (no errors, no warnings, dvi output OK)

BUT this code

\documentclass{article}

\usepackage{tikz}
\usepackage{circuitikz}

\begin{document}

\begin{figure}[h!]
  \begin{center}
    \begin{circuitikz}
      \draw (0,0) to[R=$ASCII TEXT$] (2,0); % The resistor
    \end{circuitikz}
    \caption{My first circuit.}
  \end{center}
\end{figure}

\end{document}

produces correct result with a lot of, I am assuming, warnings. The dvi output is OK.

/usr/share/texlive/texmf-local/texmf-compat/tex/generic/circuitikz/pgfcirccurr ent.tex)
(/usr/share/texlive/texmf-local/texmf-compat/tex/generic/circuitikz/pgfcircpath .tex)) (./circuit1.aux) ABD: EveryShipout initializing macros ! Undefined control sequence.
\pgf@sh@bg@resistorshape ...sformationadjustments \pgfmathsetlength {\pgf@ci...

l.12       to[R=$ASCII TEXT$] (2,0) ; % The resistor
?  ! Undefined control sequence.
<argument> ...fhorizontaltransformationadjustment *0.5*\pgflinewidth 

l.12       to[R=$ASCII TEXT$] (2,0) ; % The resistor
?  ! Missing number, treated as zero.
<to be read again> 
l.12       to[R=$ASCII TEXT$] (2,0) ; % The resistor
?  ! Undefined control sequence.
<argument> ...fhorizontaltransformationadjustment *0.5*\pgflinewidth 
l.12       to[R=$ASCII TEXT$] (2,0) ; % The resistor
?  ! Missing number, treated as zero.
<to be read again> 
           p
l.12       to[R=$ASCII TEXT$] (2,0) ; % The resistor
?  [1] (./circuit1.aux) )

What I am doing wrong ?

This is the sample code from the documentation for the circuitikz http://ftp.math.purdue.edu/mirrors/ctan.org/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf

\begin{circuitikz}
\draw (0,0) to[R=$R_1$] (2,0);
\end{circuitikz}

Similar CODE works OK here https://www.overleaf.com/read/qnwsxtprwvvc

5
  • Have you tried [R, l=$ASCII TEXT$] ?
    – Jesse
    Commented Jun 24, 2016 at 2:13
  • No, I haven't. But, I tried it now. The code still produces the same warnings as before. On top of that, the dvi file (PDF file) does not contain the resistor. Just a wire.
    – Igor
    Commented Jun 24, 2016 at 2:23
  • I just tried with your code but replaced the particular line with \draw (0,0) to[R, l=$ASCII~TEXT$] (2,0); % The resistor and it works. My output has resistor symbols and text on top.
    – Jesse
    Commented Jun 24, 2016 at 3:09
  • Do you mean \verb$ASCII_TEXT$ ? Commented Jun 25, 2016 at 3:35
  • It does not matter what is written there. It can be any ASCII text. The issue at hand is: Why the code works with C (capacitor) and not with R (resistor)
    – Igor
    Commented Jun 26, 2016 at 7:10

2 Answers 2

2

The problem seems to be the horizontaltransformationadjustment-command, which is used only at the resistor (and not at capacitor or inductor) to correct the begin/end of the line.

Perhaps your tikz/pgf version is too old, it should work with texlive2015 and the latest updates. If you are using Texlive2015, update it with tlmgr, or install the current Texlive2016.

I think the centos-packages are too old, like the ubuntu ones. So just install it directly with the webinstaller from https://www.tug.org/texlive/acquire-netinstall.html

1
  • I followed @user104637's suggestion to use webinstaller. It worked without the hitch. Now I can compile the test case without warnings. The dvi/pdf output is exactly how it supposed to be. Case closed.
    – Igor
    Commented Jul 7, 2016 at 3:49
1

It works fine without any error in the TexWork having latest Miktex update. I got no warning at all. May be you need to update your packages :-)

\documentclass{article}

\usepackage{tikz}
\usepackage{circuitikz}

\begin{document}

\begin{figure}[htp!]
\begin{center}
\begin{circuitikz}
\draw (0,4) to[C=$ASCII_TEXT$] (2,4); % The capacitor
\draw (0,2) to[R=$ASCII_TEXT$] (2,2); % The resistor
\draw (0,0) to[L=$ASCII_TEXT$] (2,0); % The inductor
\end{circuitikz}
\caption{My first circuit.}
\end{center}
\end{figure}

\end{document}

Above code gives the following output: enter image description here

1
  • Yes, I should have put more info about my environment. I am using to run TeX, | am using TeX | LaTeX on Centos 7.x with latest version of the texlive. In other words. I do not know how to update TeX (texlive).
    – Igor
    Commented Jun 24, 2016 at 5:51

You must log in to answer this question.

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