5

The following is what I have tried.

\documentclass[12pt,letterpaper]{article}
\usepackage[left=20mm,top=30mm,bottom=30mm,right=20mm]{geometry}

\usepackage{tikz}  % for drawing pictures
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{arrows.meta}


\usepackage[siunitx]{circuitikz} % circuit package and  include electrical units in our labels

\begin{document}

\begin{figure}[H]
\centering
\begin{circuitikz}[american,]
\ctikzset{tripoles/mos style/arrows}
\def\killdepth#1{{\raisebox{0pt}[\height][0pt]{#1}}}
%\path (0,0) -- (2,0); % bounding box

\draw 
(-3,9)  -- (3,9) node[label=right: $V_{dd} \SI{}{}$] {}

(2,4) to [resistor, a^ = $R_{D2}$] (2,1)

(-2,9) to [resistor, a^ = $R_{D1}$] (-2,5.5)

(-2,3.5) to [resistor, a^ = $R_{S}$] (-2,1.5)

(-2,1.5) to (-2,1) node[ground](GND){} 

(-2,4.5) -- (-2,3.5)


(2,9) -- (2,6.5)
(2,6) node[pmos] (M2) {$M_2$} 
%(0,5) node[anchor=east] {$V_{bias}$}[short, o-] to (M2.gate) node[] {}
%(M2.source) node[] {} -- (M1.drain) node[] {}
(M2.drain) node[right] {} -- (2,4) to  [short, *-o, name=S] ++ (2,0) node[right]{$V_{out}$}
(2,1) node[ground](GND){}


(-2,5) node[nmos] (M1) {$M_1$}
(-4,5)  [short, o-]  node[left]{$V_{in}$} to (M1.gate) ;

\draw (-2,4)[short, *-] to [resistor, a^ = $R_{F}$] (2,4);

\draw     (-2,6) to [short,l_=${X}$, *-] (1,6);

     
%\draw  [short, -](5,1) to  [short, *-*, name=S] ++(3,0)node[right]{$V_{out}$};

%\draw  [short, *-] (-2,0) to [resistor, a = $R_2$] (-2,-3);   

%\draw (5,6) to (5,4) node[nmos] (M2) {$M_2$} (5,3) to (5,1);
   

   
   
\end{circuitikz}
\caption{Voltage-Voltage Feedback} \label{fig:volt_volt_loop}
\end{figure}

\end{document}

I got this one from the latex above.

enter image description here

However, I have no idea to draw a dashed line box and text label (Feedback network) like the following.

enter image description here

1 Answer 1

8

Here's a way to do it, drawing a closed path, using absolute coordinates. Some may be easier to formulate and modify using (some) relative coordinates, too.

Major points:

  • drawing a help grid, to better see your coordinates
  • drawing a closed path using cycle
  • adding a style called dbx to format the dashed outline of the box
  • some other minor changes, see % <<<

result

\documentclass[12pt,letterpaper]{article}
\usepackage[left=20mm,top=30mm,bottom=30mm,right=20mm]{geometry}

\usepackage{tikz}  % for drawing pictures
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{arrows.meta}


\usepackage[siunitx]{circuitikz} % circuit package and  include electrical units in our labels

\begin{document}

\begin{figure}[]
 \centering
 \begin{circuitikz}[american,
    dbx/.style={dashed, draw}, % <<<
 ]
    \ctikzset{tripoles/mos style/arrows}
    \def\killdepth#1{{\raisebox{0pt}[\height][0pt]{#1}}}
    %\path (0,0) -- (2,0); % bounding box
    
    \draw 
    (-3,9)  -- (3,9) node[label=right: $V_{dd} \SI{}{}$] {}
    
    (2,4) to [resistor, a^ = $R_{D2}$] (2,1)
    
    (-2,9) to [resistor, a^ = $R_{D1}$] (-2,5.5)
    
    (-2,3.5) to [resistor, a^ = $R_{S}$] (-2,1.5)
    
    (-2,1.5) to (-2,1) node[ground](GND){} 
    
    (-2,4.5) -- (-2,3.5)
    
    
    (2,9) -- (2,6.5)
    (2,6) node[pmos] (M2) {$M_2$} 
    %(0,5) node[anchor=east] {$V_{bias}$}[short, o-] to (M2.gate) node[] {}
    %(M2.source) node[] {} -- (M1.drain) node[] {}
    (M2.drain) node[right] {} -- (2,4) to  [short, *-o, name=S] ++ (2,0) node[right]{$V_{out}$}
    (2,1) node[ground](GND){}
    
    
    (-2,5) node[nmos] (M1) {$M_1$}
    (-4,5)  [short, o-]  node[left]{$V_{in}$} to (M1.gate) ;
    
    \draw (-2,4)[short, *-] to [resistor, a = $R_{F}$] (2,4); % <<<
    
    \draw     (-2,6) to [short,l_=${X}$, *-] (1,6);


    % ~~~ let's see, where the coordinates are (comment out later) ~~~~  
    \draw[teal!30] (0,0) grid (-3,5);
    
    % ~~~ drawing a closed path, here in absolute coords ~~~
    \draw[dbx] (-3,0) -- (-3,4.4) -- (1,4.4) 
                      -- (1,3) -- (-1,3) -- (-1,0) -- cycle;
       
       
 \end{circuitikz}
 \caption{Voltage-Voltage Feedback} \label{fig:volt_volt_loop}
\end{figure}

\end{document}

P.S.: labeling said box

  • put a node after one of the points; here it's the 2nd, i.e. below the left gate
  • put label text there, using \\ for a line break
  • adding style fbt (like format box text)
  • anchor east, to have text to the left
  • align=center to account for the \\s
  • pos=0.6, shifting it 60 % between the first two points
  • font=\bfseries if you want a bold font

Remember, circuitikz is built on Tikz, so you still can use Tikz syntax and concepts. I suggest to look up all my commands in the pgfmanual.

...
 \begin{circuitikz}[american,
    dbx/.style={dashed, draw}, % <<<
    fbt/.style={anchor=east,align =center,pos=0.6,font=\bfseries},
 ]
...
    % ~~~ drawing a closed path, here in absolute coords ~~~
    \draw[dbx] (-3,0) -- (-3,4.4)node[fbt]{Feedback\\Network}
                      -- (1,4.4) 
                      -- (1,3) -- (-1,3) -- (-1,0) -- cycle;
...

withLabel

Full code:

\documentclass[12pt,letterpaper]{article}
\usepackage[left=20mm,top=30mm,bottom=30mm,right=20mm]{geometry}

\usepackage{tikz}  % for drawing pictures
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{arrows.meta}


\usepackage[siunitx]{circuitikz} % circuit package and  include electrical units in our labels

\begin{document}

\begin{figure}[]
 \centering
 \begin{circuitikz}[american,
    dbx/.style={dashed, draw}, % <<<
    fbt/.style={anchor=east,align =center,pos=0.6,font=\bfseries},
 ]
    \ctikzset{tripoles/mos style/arrows}
    \def\killdepth#1{{\raisebox{0pt}[\height][0pt]{#1}}}
    %\path (0,0) -- (2,0); % bounding box
    
    \draw 
    (-3,9)  -- (3,9) node[label=right: $V_{dd} \SI{}{}$] {}
    
    (2,4) to [resistor, a^ = $R_{D2}$] (2,1)
    
    (-2,9) to [resistor, a^ = $R_{D1}$] (-2,5.5)
    
    (-2,3.5) to [resistor, a^ = $R_{S}$] (-2,1.5)
    
    (-2,1.5) to (-2,1) node[ground](GND){} 
    
    (-2,4.5) -- (-2,3.5)
    
    
    (2,9) -- (2,6.5)
    (2,6) node[pmos] (M2) {$M_2$} 
    %(0,5) node[anchor=east] {$V_{bias}$}[short, o-] to (M2.gate) node[] {}
    %(M2.source) node[] {} -- (M1.drain) node[] {}
    (M2.drain) node[right] {} -- (2,4) to  [short, *-o, name=S] ++ (2,0) node[right]{$V_{out}$}
    (2,1) node[ground](GND){}
    
    
    (-2,5) node[nmos] (M1) {$M_1$}
    (-4,5)  [short, o-]  node[left]{$V_{in}$} to (M1.gate) ;
    
    \draw (-2,4)[short, *-] to [resistor, a = $R_{F}$] (2,4); % <<<
    
    \draw     (-2,6) to [short,l_=${X}$, *-] (1,6);


    % ~~~ let's see, wherer the coordinates are (comment out later) ~~~~  
    \draw[teal!30] (0,0) grid (-3,5);
    
    % ~~~ drawing a closed path, here in absolute coords ~~~
    \draw[dbx] (-3,0) -- (-3,4.4)node[fbt]{Feedback\\Network}
                      -- (1,4.4) 
                      -- (1,3) -- (-1,3) -- (-1,0) -- cycle;
       
       
 \end{circuitikz}
 \caption{Voltage-Voltage Feedback} \label{fig:volt_volt_loop}
\end{figure}

\end{document}
2
  • Any method to add text (feedback network) to dashed line to the box?
    – kile
    Commented Mar 25 at 7:11
  • Kindly see my new P.S. section.
    – MS-SPO
    Commented Mar 25 at 7:25

You must log in to answer this question.

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