3

I use standalone, but sometimes it works for me and sometimes not, why it is not working in the below code.

\documentclass[tikz,circuitikz]{standalone}
\usepackage{xcolor}
\definecolor{lava}{rgb}{0.81, 0.06, 0.13}
\definecolor{myblue}{rgb}{0.0, 0.30, 0.60}
\usepackage{tikz-3dplot} 
\usetikzlibrary{angles, arrows.meta,}  
\usepackage[siunitx,cuteinductors,americanvoltages,americancurrents]{circuitikz}  
   \begin{document}     
        \begin{circuitikz}
        \draw (0,6) 
         to[V,name=V,o-o,i={$\mathbf{I}$},thick] (0,0)(0,6)
        to[R, l=$R_1$,name=R1,o-o] (3,6)
        to[C, l=$C_1$,name=C1,o-o] (6,6)
         (6,6)
         to[generic, l_=$\mathbf{Z}_b$,i={$\mathbf{I}$},name=R2,o-o]  (6,0)
        to[short,o-o] (0,0); 
         \node[below, xshift=43pt, yshift=10pt]  at (C1.n) {$v_b(t)$};             
         \node[below, xshift=2pt, yshift=-14pt] at (R1.n) {$30$  $\Omega$};
         \node[below,rotate=90] at (R2.n) {$74.1614 - j6.7508 \Omega$};
         \node[below, xshift=2pt, yshift=-24pt] at (C1.n) {$ - j106.1033 \, \Omega$};
         \node[below, xshift=60pt, yshift=8pt] at (V.n) {$v_s(t)=200 $ V };      
        \end{circuitikz}
        \end{document}

Diana
  • 1,285
  • 7
  • 12
  • Not related: why you don't use circuitikz labels and annotation for the, well, labels and annotations? it will streamline your code a lot; I understand you lose flexibility, but in this case, you can have almost the same thing... – Rmano Feb 02 '21 at 08:24
  • 1
    The [tikz] option of standalone may save you from typing \includepackage{tikz}, but it also add [multi=tikzpicture] which will cause problems if you attempt to add anything except a tikzpicture. OTOH, one can use \begin{tikzpicture} instead of \begin{circuitikz} (they are in fact equivalent). – John Kormylo Feb 02 '21 at 15:18
  • Why this question was closed? – Diana Feb 05 '21 at 10:01

1 Answers1

4

In general, because there are unnecessary code. In particular, because the document options tikz,circuitikz should be removed and the unnecessary tikz-3dplot need load tikz first (with \usepackage or \RequirePackage).

mwe

\documentclass
%[tikz,circuitikz]
[border=3mm]{standalone}
%\usepackage{xcolor}
%\definecolor{lava}{rgb}{0.81, 0.06, 0.13}
%\definecolor{myblue}{rgb}{0.0, 0.30, 0.60}
%\usepackage{tikz-3dplot} 
%\usetikzlibrary{angles, arrows.meta,}  
\usepackage[siunitx,cuteinductors,americanvoltages,americancurrents]{circuitikz}  
   \begin{document}     
        \begin{circuitikz}
        \draw (0,6) 
         to[V,name=V,o-o,i={$\mathbf{I}$},thick] (0,0)(0,6)
        to[R, l=$R_1$,name=R1,o-o] (3,6)
        to[C, l=$C_1$,name=C1,o-o] (6,6)
         (6,6)
         to[generic, l_=$\mathbf{Z}_b$,i={$\mathbf{I}$},name=R2,o-o]  (6,0)
        to[short,o-o] (0,0); 
         \node[below, xshift=43pt, yshift=10pt]  at (C1.n) {$v_b(t)$};             
         \node[below, xshift=2pt, yshift=-14pt] at (R1.n) {$30$  $\Omega$};
         \node[below,rotate=90] at (R2.n) {$74.1614 - j6.7508 \Omega$};
         \node[below, xshift=2pt, yshift=-24pt] at (C1.n) {$ - j106.1033 \, \Omega$};
         \node[below, xshift=60pt, yshift=8pt] at (V.n) {$v_s(t)=200 $ V };      
        \end{circuitikz}
        \end{document}
Fran
  • 80,769