1

I'd like to solely change the color of the bipole (and, if possible, also of the line). The labels as well as the current arrow should stay black. Is there any possibility to achive this? In the following MWE, the current arrow is still red, which is unwanted.

\documentclass{standalone}
\usepackage{tikz}
\usepackage[european,cuteinductors,fetbodydiode,straightvoltages]{circuitikz}

\begin{document}
    \begin{tikzpicture}[scale=0.6, arrowmos]
        \draw [color=red] (0,0) to[R,R=\textcolor{black}{$R_1$}, i_=\textcolor{black}{$i_1$}, bipole current append style={color=black}] (4,0);
    \end{tikzpicture}
\end{document}

enter image description here

3

1 Answer 1

2

For example, you can suppress the output of the current symbol and add it manually afterward.

\documentclass{standalone}
\usepackage{tikz}
\usepackage[european,cuteinductors,fetbodydiode,straightvoltages]{circuitikz}

\begin{document}
    \begin{tikzpicture}[scale=0.6, arrowmos]
        \draw [color=red] (0,0) to[R,l=\textcolor{black}{$R_1$},
           i_=\textcolor{black}{$i_1$}, no i symbols, name=blah] (4,0);
        \node[currarrow] at (blah-Ipos) {};
    \end{tikzpicture}
\end{document}

enter image description here

In this case, there is no need to add rotation, but if needed, there is an example in the manual on page 207 (notice that page will change with different versions of the manual):

enter image description here

So, for example:

\documentclass{standalone}
\usepackage{tikz}
\usepackage[european,cuteinductors,fetbodydiode,straightvoltages]{circuitikz}

\begin{document}
    \begin{tikzpicture}[scale=0.6, arrowmos]
        \draw [color=red] (0,0) to[R,l=\textcolor{black}{$R_1$},
           i_=\textcolor{black}{$i_1$}, no i symbols, name=blah] (4,0) 
           to[R,l=\textcolor{black}{$R_2$},
           i_=\textcolor{black}{$i_2$}, no i symbols, name=blah2] (7,3);
        \node[currarrow] at (blah-Ipos) {};
        \node[currarrow, rotate=\ctikzgetdirection{blah2-Iarrow}] at (blah2-Ipos) {};
    \end{tikzpicture}
\end{document}

enter image description here

However, if you use this a lot, probably a macro like the one in the manual's example is better:

\documentclass{standalone}
\usepackage{tikz}
\usepackage[european,cuteinductors,fetbodydiode,straightvoltages]{circuitikz}
%%% "fc" mnemonics: fixed color
\newcommand\textfc[1]{\textcolor{black}{#1}}
\newcommand\fcI[1]{\node[currarrow,
    rotate=\ctikzgetdirection{#1-Iarrow}] at (#1-Ipos) {}}

\begin{document}
    \begin{tikzpicture}[scale=0.6, arrowmos]
        \draw [color=red] (0,0) to[R=\textfc{$R_1$},
           i_=\textfc{$i_1$}, no i symbols, name=blah] (4,0) 
           to[R,l=\textfc{$R_2$},
           i_=\textfc{$i_2$}, no i symbols, name=blah2] (7,3);
        \fcI{blah};
        \fcI{blah2};
    \end{tikzpicture}
\end{document}

...and as a bonus, if you decide to have the text, say, blue, you have to change it just in one place.

2
  • Thanks, however, as you already noted, I also have bipoles with rotation. The rotation is not set by a fixed angle but is given by the two coordinates that the bipole connects. I have not seen an example on page 206 of the circuitikz manual 1.6.3 but I tried to add the rotation=... which works but is cumbersome because I'd have to try around a lot to get the correct degree value.
    – Steradiant
    Commented Sep 15, 2023 at 12:29
  • @Steradiant for that there is the \ctikzgetdirection{} macro that returns the rotation angle of the bipole... see my update.
    – Rmano
    Commented Sep 15, 2023 at 16:53

You must log in to answer this question.

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