4

I'm trying to recreate a small part of a circuit diagram for a lab report. I'm still a beginner to circuitikz and making tikz diagrams in general, but I think I'm starting to wrap my ahead around creating basic circuits. I've made the following diagram which has everything set out as I want, but the inductor label "L" is duplicated at the Vin node and I'm not sure why: enter image description here

This is what I've got so far:

\documentclass{article}

\usepackage{circuitikz}

\begin{document}
    \begin{circuitikz}
        \draw (0,0) node[above]{$V_{in}$} to [short, o-] ++(1,0)
        [L=$L$] to ++(1,0)
        -- ++(1,0) node[right]{$V_o$}
        to [R, l=$R$] ++(0, -2);
    \end{circuitikz}
\end{document}

Here's what I'm trying to recreate:

enter image description here

4
  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem.
    – cabohah
    Commented May 4 at 11:08
  • Just updated, thank you for the tip! Commented May 4 at 11:18
  • 2
    There is a duplicate I can't find now... basically remember that circuitikz element are option to to commands, so [L=$L$] to ++(1,0) is wrong while to[L=$L$] ++(1,0) is right.
    – Rmano
    Commented May 4 at 19:08
  • @Rmano Do you copy my code? 🤣🤣🤣 +1.
    – Sebastiano
    Commented May 4 at 19:17

1 Answer 1

7

See the position of to:

enter image description here

\documentclass{article}
\usepackage{circuitikz}

\begin{document}
    \begin{circuitikz}
        \draw (0,0) node[above]{$\mathbf{V}_{\mathrm{in}}$} to [short, o-] ++(1,0)
        to [L=$L$] ++(1,0)
        -- ++(1,0) node[right]{$\mathbf{V}_0$}
        to [R, l=$R$] ++(0, -2) node[ground]{};
    \end{circuitikz}

    \begin{circuitikz}
        \draw (0,0) node[left]{$\mathbf{V}_{\mathrm{in}}$} to [short, o-] ++(1,0)
        to [L=$L$] ++(1,0)
        -- ++(1,0) 
        to [R, l=$R$] ++(0, -2) node[ground]{}
        (3,0) node[right]{$\mathbf{V}_0$};
    \end{circuitikz}
\end{document}

Another example:

\documentclass{article}
\usepackage{circuitikz}

\begin{document}
    \begin{circuitikz}
        \draw (0,0) node[above]{$\mathbf{V}_{in}$} to [short, o-] ++(1,0)
        to [L=$L$] ++(1,0)
        -- ++(1,0) node[above]{$\mathbf{V}_o$}
        to [R, l=$R$] ++(0, -2) node[ground]{};
    \end{circuitikz}
\end{document}

enter image description here

You must log in to answer this question.

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