2

I'm just learning how to use circuitikz and I'm trying to draw the following circuit diagram

enter image description here

Here's what I've got so far

enter image description here

\begin{circuitikz}
  \draw (0,0) node[ocirc,ground]{$-m$}
  to[short] (1,0)
  to[R=$text$] (2,0) 
  to[short] (3,0)
  to[R=$text$] (4,0) 
  to[short] (5,0)
  to[R=$\ldots$] (6,0)
  to[short] (7,0)
  to[R=$text$] (8,0) 
  to[short] (9,0)
  to[R=$text$] (10,0) 
  to[short] (11,0)
  to[R=$\ldots$] (12,0)
  to[short] (13,0)
  to[R=$text$] (14,0) 
  to[short] (15,0)
  to[R=$text$] (16,0) 
  to[short] (17,0)
  to[short] (17,2) 
  to[V=$1V$] (0,2)
  to[short] (0,2)
  to[short] (0,0);
\end{circuitikz}

I'd really appreciate some help to resolve the following issues:

  1. Adding nodes between the resistors with labels.
  2. Making the whole thing fit on the page!
  3. Having an ellipsis as the node (rather than having a resistor there like I do now)
  4. Putting the leftmost label on the left rather than where it falls now.

Thanks!

3
\documentclass[margin=3mm]{article}
\usepackage{circuitikz}

\begin{document}
    \begin{circuitikz}
\draw (0,0) node[left=1mm] {$n$}     
                to [R=$+e_x-$,*-*]  ++ (1.5,0) node[below=3mm] {$-n+1$}
                to [R=$+e_x-$, -*]  ++ (1.5,0) node[below=3mm] {$-n+2$} coordinate[right=15mm]  (aux1)
      (aux1) node[below=3mm] {$-1$}
                to [R=$+e_x-$,*-*]  ++ (1.5,0) node[below=3mm] {$0$}
                to [R=$+e_x-$, -*]  ++ (1.5,0) node[below=3mm] {$1$}    coordinate[right=15mm]  (aux2)
      (aux2) node[below=3mm] {$n-2$}
                to [R=$+e_x-$,*-*]  ++ (1.5,0) node[below=3mm] {$n-1$}
                to [R=$+e_x-$, -*]  ++ (1.5,0) node[below=3mm] {$n$}    coordinate[above=15mm]  (aux3)
%
      (0,0) -- ++ (0,1.5)
            to [battery2, l=$+e_x-$,invert]   (aux3) -- ++ (0,-1.5)
      (0,0) -- ++ (0,-0.5) node [ground] {};
\path   (aux1) -- node {\huge$\dots$}    ++  (-1.5,0)
        (aux2) -- node {\huge$\dots$}    ++  (-1.5,0);
   \end{circuitikz}
\end{document}

gives

enter image description here

labels of resistors and battery in your sketch are not well readable. i read them as +e_x-, but i'm not sure in this. however you can easy change them to what you like to have.

1

nodes can be placed at coordinates between which resistors are drawn. Now node shape, label and placement of the label can be controlled.

The diagram can be scaled with the scale= option. Note that transform shape is also used along with it. Remove it and see what it is doing. ;)

See the example below:

\documentclass[border=3mm]{standalone}
\usepackage{circuitikz}
\usetikzlibrary{shapes}
\tikzset{elps/.style={fill,scale=0.5,ellipse, text width=1pt,text height=3pt}}
\ctikzset{bipoles/length=0.9cm}
\begin{document}
\begin{circuitikz}[scale=0.5,transform shape]
  \draw (0,0) node[ground]{};
  \draw (0,0) node[elps,label={[left=3mm]$-m$}]{}
  to[R=$text$] ++(2,0) node[elps,label={[below=3mm]$-m+1$}]{}
  to[R=$text$] ++(2,0) node[elps,label={[below=3mm]$-m+2$}]{}
  to[R=$\ldots$] ++(2,0)node[elps,label={[below=3mm]$1$}]{}

  to[R=$text$] ++(2,0) node[elps,label={[below=3mm]$0$}]{}
  to[R=$text$] ++(2,0) node[elps,label={[below=3mm]$-1$}]{}
  to[R=$\ldots$] ++(2,0) node[elps,label={[below=3mm]$m-2$}]{}

  to[R=$text$] ++(2,0) node[elps,label={[below=3mm]$m-1$}]{}
  to[R=$text$] ++(2,0) node[elps,label={[below=3mm]$m$}]{}

  to[short] ++(0,2) 
  to[V=$1V$] (0,2)
  to[short] (0,0);
\end{circuitikz}
\end{document}

enter image description here

Note that I have also replaced few absolute coordinates with relative coordinates using ++(x,y); removed few unwanted shorts and changed the bipoles length.

  • This is great thanks so much! The only thing I wonder about is whether it's possible to have the ellipsis in place of the resistor in the circuit? It's not a big deal but is it possible? :) – jason Dec 20 '18 at 20:22
  • @jason it is possible. Using the library decorations.markings is an option. – nidhin Dec 21 '18 at 5:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.