0

Please kindly help. I can't get a hang on this using latex. Kirch:

  • 2
    What have you tried so far? Where are you stuck at? Please show a minimal example code. –  Apr 11 '19 at 15:47
  • 1
    Welcome to TeX.SE, as @JouleV mentioned please show us what you have tried so-far. Because, this is not a just-do-it-for-me site. IMO: you can begin with https://tex.stackexchange.com/questions/15779/materials-for-learning-tikz, and http://www.pirbot.com/mirrors/ctan/graphics/pgf/contrib/circuitikz/doc/circuitikzmanual.pdf. – Raaja_is_at_topanswers.xyz Apr 11 '19 at 15:51
  • \usepackage[free-standing-units]{siunitx} \usepackage{circuitikz} \usepackage{tikz}

    \begin{document} \begin{circuitikz} \draw (0,0) node[op amp] (opamp) {} (opamp.-) node[left] {$2$} to [short,*-] ++(0,4) to [short,*-] ++(0,2) to R={$R1$} {} (opamp.out) node[right, anchor=north] {$6$} to (1.5,0) to R={$R1$} {} (opamp.up) --++(0,1.5) node[anchor=east, *-o]{\textnormal{-Vcc}} (-0.2,1.3) node[anchor=east]{\textnormal{4}};

    \draw (8,0) node [op amp] {};

    \end{circuitikz} \end{document}

    – Adeleye Adekunle Apr 11 '19 at 16:07
  • I am very new at this and my skills sucks for now. Just that it is needed for a project – Adeleye Adekunle Apr 11 '19 at 16:10
  • 1
    No, your code has nothing to do with this picture. –  Apr 11 '19 at 16:10
  • I have added a couple of tutorials to the manual of circuitikz, you can start from there... https://circuitikz.github.io/circuitikz/ – Rmano Apr 11 '19 at 17:38
  • 4
    I'm voting to close this question as off-topic because it is a just-do-it-for-me question. – Raaja_is_at_topanswers.xyz Apr 12 '19 at 11:27

1 Answers1

2

I take this as a TikZ exercise during my free time.

\documentclass[tikz,margin=3mm]{standalone}
\usepackage{siunitx}
\usetikzlibrary{decorations.markings,calc}
\tikzset{
    resistor/.style={
        postaction=decorate,
        decoration={
            markings,
            mark=at position 0.5 with {
            \begin{scope}[scale=2]
                \fill[white] (-7pt,1pt) rectangle (7pt,-1pt);
                \draw (-7pt,0) -- (-6pt,0) -- (-5pt,2pt) -- (-3pt,-2pt) -- (-1pt,2pt) -- (1pt,-2pt) -- (3pt,2pt) -- (5pt,-2pt) -- (6pt,0) -- (7pt,0);
                \coordinate (x) at (-6pt,0);
                \coordinate (y) at (0,0);
            \end{scope}
            }
        }
    },
    ->-/.style={
        postaction=decorate,
        decoration={
            markings,
            mark=at position #1 with {\arrow{>}}
        }
    },
    ->-/.default=0.5
}
\begin{document}
\begin{tikzpicture}[>=latex]
\draw[resistor] (0,0) -- (3,0);
\draw[->-=0.7] (0,0) -- (x);
\path (y) node[above=3pt] {$I_2$} node[below=3pt] {$R_2=\SI{2}{\ohm}$};
\draw[->-] (3,0) -- (6,0);
\draw (6,-2) -- (6,2);
\draw[->-] (6,2) -- (3.1,2);
\draw (3,2.25) -- (3,1.75) (3.1,2.08) -- (3.1,1.92) (3.05,2) node[above=0.25cm] {\SI{7}{\volt}};
\draw[resistor] (3,2) -- (0,2);
\path (y) node[above=3pt] {$I_1$} node[below=3pt] {$R_1=\SI{3}{\ohm}$};
\draw[->-] (0,2) -- (0,0);
\draw[->-] (0,-2) -- (0,0);
\draw[resistor] (0,-2) -- (3,-2);
\path (y) node[above=3pt] {$I_3$} node[below=3pt] {$R_3=\SI{4}{\ohm}$};
\draw (3,-2.25) -- (3,-1.75) (3.1,-2.08) -- (3.1,-1.92) (3.05,-2) node[below=0.25cm] {\SI{8}{\volt}};
\draw[->-] (6,-2) -- (3.1,-2);
\node[circle,draw,fill=cyan!30] at (0,0) {1};
\node[circle,draw,fill=cyan!30] at (6,0) {2};
\draw[->,cyan] ($(5,1)+(45:0.8)$) arc (45:315:0.8) node[midway,left,black] {Path 1};
\draw[->,cyan] ($(5,-1)+(-45:0.8)$) arc (-45:-315:0.8) node[midway,left,black] {Path 2};
\end{tikzpicture}
\end{document}

enter image description here

I know this code is still too long and can be improved. Any suggestions welcome!

  • I think there is another way: use pic for resistors and voltages – Black Mild Apr 13 '19 at 18:16
  • @BlackMild Yes, there are many other ways to draw this. First, of course, is using circuitikz. And my answer: take some post-actions on paths. Or your comment: use pic (which I'm not really familiar of). Or I can even draw the resistors manually. Or I think it is even possible to use node for the resistors (untested). TikZ is awesome because there are thousands of solutions to only one problem :D –  Apr 13 '19 at 18:21