0

I have this circuit created with circuitikz that simply represent a current generator with the direction of the current and its label.

\begin{circuitikz}[american]
  \draw (0,0) to[ioosource, i_=$i_{in}$] +(0,-2) node[ground]{};
\end{circuitikz}

The result is this:

enter image description here

But I would like to have the label of the current next to the current generator symbol like in this case:

\begin{circuitikz}[american]
  \draw (0,0) to[ioosource, l_=$i_{in}$] +(0,-2) node[ground]{};
\end{circuitikz}

enter image description here

But as you can see if I do in this way the arrow of the current is no more present. How can I solve this problem?

2
  • please see the answer below -- adjust xshift and yshift to taste
    – js bibra
    Mar 10, 2021 at 0:16
  • 2
    would you like to accept and upvote the answer
    – js bibra
    Mar 10, 2021 at 3:38

3 Answers 3

6

By use of annotation a (or label l) and invisible current flow symbol label:

\documentclass[border=3.141592]{standalone}
\usepackage{circuitikz}

\begin{document}
\begin{circuitikz}[american]
  \draw (0,0) to[ioosource, a=$i_{\mathrm{in}}$, i=~]   ++(0,-2) node[ground]{};
\end{circuitikz}
\end{document}

enter image description here

4
\documentclass[10pt,a4paper]{article}
\usepackage{circuitikz}
\begin{document}
    \begin{circuitikz}[american]
        \draw (0,0) to[ioosource, i=$$]node[xshift=-4pt,yshift=0.7cm,left]{$i_{in}$} +(0,-2) node[ground]{};
    \end{circuitikz}
\end{document}

second method -- with angle and label

enter image description here

\documentclass[10pt,a4paper]{article}

\usepackage{circuitikz}
\begin{document}
    \begin{circuitikz}[american]
        \draw (0,0) to[ioosource, i=$$]node[outer sep=4mm, label=120:$i_{in}$]{} +(0,-2) node[ground]{};
    \end{circuitikz}
\end{document}
2

Not exactly what is asked, but as a totally shameful cheat:

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\begin{document}
\begin{circuitikz}[american]
    \draw (0,0) to[voosource, v_=$i_{in}$, voltage=straight] +(0,-2) node[ground]{};
\end{circuitikz}
\end{document}

enter image description here

...cheat that, for cleanliness, I would hide under the carpet in a style:

\documentclass[border=10pt]{standalone}
\usepackage[siunitx, RPvoltages]{circuitikz}
\tikzset{ioosource external i/.style={
        voosource, v_={#1}, voltage=straight,
    }
}
\begin{document}
\begin{circuitikz}[american]
    \draw (0,0) to[ioosource external i=$i_{in}$] +(0,-2) node[ground]{};
\end{circuitikz}
\end{document}

(same output)

You must log in to answer this question.

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