2

Below is what I have so far

\documentclass[convert = false]{standalone}
\usepackage[american]{circuitikz}
\usepackage[utf8]{inputenx}%  http://ctan.org/pkg/inputenx
% Euler for math | Palatino for rm | Helvetica for ss | Courier for tt
\renewcommand{\rmdefault}{ppl}% rm
\linespread{1.05}% Palatino needs more leading
\usepackage[scaled]{helvet}% ss //  http://ctan.org/pkg/helvet
\usepackage{courier}% tt // http://ctan.org/pkg/courier
\usepackage{eulervm}  %  http://ctan.org/pkg/eulervm
% a better implementation of the euler package (not in gwTeX)
\normalfont%
\usepackage[T1]{fontenc}%  http://ctan.org/pkg/fontenc
\usepackage{textcomp}%  http://ctan.org/pkg/textcomp

\begin{document}
\begin{circuitikz}[scale = 2]
  \draw                                    (1, 1.5)
        to[short]                          (2, 1.5)
        to[open, v^ = $y(t)$, o-o]         (2, 0)
        to[short]                          (1, 0);
  %
  \draw                                    (-2, 0)
        to[short]                          (1, 0)
        to[C, l_ = $C$, *-*]               (1, 1.5)
        to[L = $L$]                        (-1, 1.5)
        to[R = $R$]                        (-2, 1.5);

\end{circuitikz}
\end{document}

Produces

enter image description here

I can't figure out how to add the C = 1<\farad> as well as for R and L. Additionally, I don't know how to complete the circuit. Below you will see the circuit I am trying to create.

enter image description here


Edit 1:

I have been able to complete the circuit diagram.

  1. How do I switch the american voltage source + and -?

  2. Also, how do I move x(t) to the left hand side?

  3. Can I move L and R so that they are above? Apparently L, l_ moves it above. I don't know why since to me l should be left and underscore should mean below.

enter image description here

\documentclass[convert = false]{standalone}
\usepackage[american]{circuitikz}
\usepackage[utf8]{inputenx}%  http://ctan.org/pkg/inputenx
% Euler for math | Palatino for rm | Helvetica for ss | Courier for tt
\renewcommand{\rmdefault}{ppl}% rm
\linespread{1.05}% Palatino needs more leading
\usepackage[scaled]{helvet}% ss //  http://ctan.org/pkg/helvet
\usepackage{courier}% tt // http://ctan.org/pkg/courier
\usepackage{eulervm}  %  http://ctan.org/pkg/eulervm
% a better implementation of the euler package (not in gwTeX)
\normalfont%
\usepackage[T1]{fontenc}%  http://ctan.org/pkg/fontenc
\usepackage{textcomp}%  http://ctan.org/pkg/textcomp

\begin{document}
\begin{circuitikz}[scale = 2]
  \draw                                           (1, 1.5)
        to[short]                                 (2, 1.5)
        to[open, v^ = $y(t)$, *-*]                (2, 0)
        to[short]                                 (1, 0);
  %
  \draw                                           (-1.5, 0)
        to[short]                                 (1, 0)
        to[C, l_ = $C$]                           (1, 1.5)
        to[L = $L$]                               (-.5, 1.5)
        to[R = $R$]                               (-1.5, 1.5)
        to[american voltage source, v^ = $x(t)$]  (-1.5, 0);
\end{circuitikz}
\end{document}

Edit 2:

So I added \usepackage{siunitx} but the below doesn't work

  • to[C, l_ = $C = \SI{1}{\farad}$]
  • to[C, l_ = $C$= 1<\farad>]
2

4 Answers 4

3
  1. I defined a new style for a component similar to american voltage source, but having the + and - inverted. This style is called american voltage source inv.

  2. Instead of v^= $x(t)$, use v_= $x(t)$.

  3. You've answered it yourself: l_=<label>.

  4. Use an extra pair de braces to enclose the inner equal sign, as in l_=${R=\SI{1}{\ohm}}.

The code:

\documentclass{article}
\usepackage[american]{circuitikz}
\usepackage[utf8]{inputenx}%  http://ctan.org/pkg/inputenx
% Euler for math | Palatino for rm | Helvetica for ss | Courier for tt
\renewcommand{\rmdefault}{ppl}% rm
\linespread{1.05}% Palatino needs more leading
\usepackage[scaled]{helvet}% ss //  http://ctan.org/pkg/helvet
\usepackage{courier}% tt // http://ctan.org/pkg/courier
\usepackage{eulervm}  %  http://ctan.org/pkg/eulervm
% a better implementation of the euler package (not in gwTeX)
\normalfont%
\usepackage[T1]{fontenc}%  http://ctan.org/pkg/fontenc
\usepackage{textcomp}%  http://ctan.org/pkg/textcomp
\usepackage{siunitx}

\makeatletter
\def\pgf@circ@vsourceaminv@path#1{\pgf@circ@bipole@path{vsourceAMinv}{#1}}
\tikzset{american voltage source inv/.style = {\circuitikzbasekey, /tikz/to path=\pgf@circ@vsourceaminv@path, \circuitikzbasekey/bipole/is voltage=true, v=#1}}
\pgfcircdeclarebipole{}{\ctikzvalof{bipoles/vsourceam/height}}{vsourceAMinv}{\ctikzvalof{bipoles/vsourceam/height}}{\ctikzvalof{bipoles/vsourceam/width}}{

    \pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}

    \pgfpathellipse{\pgfpointorigin}{\pgfpoint{0}{\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@left}{0}}


    \pgftext[bottom,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@down]{$-$}
    \pgftext[top,rotate=90,y=\ctikzvalof{bipoles/vsourceam/margin}\pgf@circ@res@up]{$+$}

    \pgfusepath{draw}
}
\makeatother
\begin{document}
\begin{circuitikz}[scale = 2]
  \draw                                           (1, 1.5)
        to[short]                                 (2, 1.5)
        to[open, v^ = $y(t)$, *-*]                (2, 0)
        to[short]                                 (1, 0);
  %
  \draw                                           (-1.5, 0)
        to[short]                                 (1, 0)
        to[C, l_ = ${C=\SI{1}{\farad}}$]                           (1, 1.5)
        to[L, l_= ${L=\SI{1}{\henry}}$]                               (-.5, 1.5)
        to[R ,l_=${R=\SI{1}{\ohm}}$]                               (-1.5, 1.5)
        to[american voltage source inv,v_= $x(t)$] (-1.5, 0);
\end{circuitikz}
\end{document}

enter image description here

1

I am sorry, I wanted to provide a very short solution to the figure that you originally wanted using circuitikz. Hence the code below. Plus the cute inductors that really make it good.

\documentclass[border=1mm]{standalone}
\usepackage[american,cuteinductors]{circuitikz}
\begin{document}
    \begin{circuitikz}
        \draw (0,0) to [V,l=$x(t)$](0,2)
        to [R,l=R{=}$1\Omega$](2,2)
        (2,2) to [L,l=L{=}$1H$](5,2)
        (5,2) to [C,l=C{=}$1F$](5,0)
        (5,2) to [short,-o] (7,2) node[anchor=west] {+}
        (0,0) to [short,-o] (7,0) node[anchor=west] {-};
        \node at (7.5,1) {$y(t)$};
    \end{circuitikz}
\end{document}

This gives me this :- Circuit Diagram

1

Just for typing exercise with PSTricks.

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-circ,siunitx}

\begin{document}
\begin{pspicture}(-1,0)(10,6)
    \pnodes(0,0){O}(0,5){A}(3,5){B}(6,5){C}(6,0){D}(9,5){E}(9,0){F}
    \Ucc[labelInside=2,labeloffset=1](O)(A){$x(t)$}
    \resistor[dipolestyle=zigzag](A)(B){$R=\SI{1}{\ohm}$}
    \coil[labeloffset=-.5](C)(B){$L=\SI{1}{\henry}$}
    \capacitor[labeloffset=-1.5](C)(D){$C=\SI{1}{\farad}$}
    %\tension[tensionstyle=pm](E)(F){$y(t)$} unavailable
    \uput[0](E){$+$}\uput[0](F){$-$}\pcline[linestyle=none](E)(F)\naput{$y(t)$}
    \psset{arrows=-*}\wire(C)(E)\wire(O)(F)
\end{pspicture}
\end{document}

enter image description here

Notes

Unfortunately tensionstyle=pm is not available for \tension so we have to draw the tension with \uput[0](E){$+$}\uput[0](F){$-$}\pcline[linestyle=none](E)(F)\naput{$y(t)$}.

I don't know why my request (several decades ago in PSTricks mailing list) to provide tensionstyle=pm for tension was ignored.

1

A PSTricks solution:

\documentclass{article}

\usepackage{pst-circ}
\usepackage{siunitx}

\begin{document}

\begin{pspicture}(-1.05,-0.15)(8.1,3.65)
\psset{unit = 0.5}
  \pnodes(14,0){A}(9,0){B}(0,0){C}(0,3){D}(0,6){E}(4.5,6){F}(9,6){G}(14,6){H}
  \rput(16,0){$I$}
  \wire[arrows = *-](A)(C)
  \uput[0](A){$-$}
  \Ucc[labeloffset = 1.5](C)(E){$x(t)$}
  \rput(-0.7,2.3){$-$}
  \rput(-0.7,3.7){$+$}
  \resistor[dipolestyle = zigzag](E)(F){$R = \SI{1}{\ohm}$}
  \coil[labeloffset = 1](F)(G){$L = \SI{1}{\henry}$}
  \wire[arrows = *-](H)(G)
  \uput[0](H){$+$}
  \capacitor[labeloffset = -2](B)(G){$C = \SI{1}{\farad}$}
  \rput(14,3){$y(t)$}
\end{pspicture}

\end{document}

output

Note that pst-circ is used to draw the electrical diagram and siunitx is used to typeset the physical quantities.

You must log in to answer this question.

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