Circuitikz – Customizing Thickness and Colors in Circuitikz

circuitikzcolornodes

I am drawing a simple circuit with circuitikz package. I am struggling with colors and thickness.

\documentclass{report}
\usepackage{circuitikz}
\begin{document}

      \begin{center}
       \begin{circuitikz}[scale=1.2]
          \draw[thick]
      (0,3) node[left]{\textbf{RE \ }} to [R, l=$R_e$,color=red,*-] (3,3)
      (3,3) -- (3,4)
      to [C, l=$C_d$] (6,4) -- (6,3)
      to [short, -*] node[right]{\textbf{ \ WE}} (7,3)
      (3,3) -- (3,2) to [R, l_=$R_t$] (6,2) -- (6,3);
      \draw[gray,thin,dashed](2.8,1) rectangle (6.2,5)
      node[pos=0,below,xshift=60]{Metal};
       \draw[cyan,thin,dashed](0.5,1) rectangle (2.5,5)
      node[pos=0,below,xshift=35]{Solution};
        \end{circuitikz} 
    \end{center}

\end{document}

As you can see, the right node is also red, it should be black. And the thickness parameter only affects to the circuit elements, not the lines. How can I fix that?


Well, I made some changes. The color of the node seems to be changed. However, the thicknes of the lines does not. After checking the circuitikz package documentation, it seems there is no way of changing the thickness of the lines (conductors).

Here is the new code (I have edited the question according to other users suggerences):

\documentclass{report}
\usepackage{xcolor,circuitikz}
\begin{document}

\begin{center}
   \begin{circuitikz}[scale=1.2]
  \draw[gray,thin,dashed,fill=gray!3](2.8,1) rectangle (6.2,5)
  node[pos=0,below,xshift=60]{Metal};
   \draw[cyan,thin,dashed,fill=cyan!4,opacity=0.5](0.5,1) rectangle (2.5,5)
  node[pos=0,below,xshift=35]{Solution};
  \draw[thick]
  (0,3) [short, *-] node[left]{\textbf{RE \ }} to (0.1,3)
  to [R, l=$R_e$,color=green, bipole nodes={none}{none}] (3,3)
  (3,3) -- (3,4)
  to [cC, l=$C_d$,color=red, bipole nodes={none}{none}] (6,4) -- (6,3)
  to [short, -*] node[right]{\textbf{ \ WE}} (7,3)
  (3,3) -- (3,2) to [R, l_=$R_t$, color=yellow, bipole nodes={none}{none}]     (6,2) -- (6,3); 
    \end{circuitikz} 
\end{center}
\end{document}

The result can be found below. (Since I have a bunch of packages in the original document, I hope not to forget any for this case)

Circuit obtained

Best Answer

If I extend your code fragment to an MWE (Minimal Working example) and aa wee bit change your code with every node/.append style = {font=\bfseries} to circuitikz option and add \ctikzset{bipoles/thickness=1} to scheme code body, I et the following result:

enter image description here

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

\begin{document}
       \begin{circuitikz}[
every node/.append style = {font=\bfseries}       
                        ]
\ctikzset{bipoles/thickness=1}
\draw[thick]
      (0,3) node[left]{RE} to [R, l=$R_e$,color=red,*-] (3,3)
      (3,3) -- (3,4)
      to [C, l=$C_d$] (6,4) -- (6,3)
      to [short, -*] (7,3)  node[right]{WE}
      (3,3) -- (3,2) to [R, l_=$R_t$] (6,2) -- (6,3);
      \draw[gray,thin,dashed](2.8,1) rectangle (6.2,5)
      node[pos=0,below,xshift=60]{Metal};
       \draw[cyan,thin,dashed](0.5,1) rectangle (2.5,5)
      node[pos=0,below,xshift=35]{Solution};
        \end{circuitikz} 
\end{document}
  • Your code can be further simplified, but let first clarify what is your problem. So far I guessing that culprit is in added \ctikzset.
  • Please edit your question, extend your code fragment to MWE, add image of scheme obtained by your code and by it clarify, what is the problem.

Addendum:

  • Sorry, but I was not able figured out what is your problem
  • So, my original answer above and slightly modified bel is based on guessing.
  • Both anticipate, that you lik that thickness of lines and elements are the same. This is achieved by added \ctikzset˙ with bipoles/thickness=1 (thickness of element drawing is defined relative to thickness of connections lines with given factor: 1 means the same thickness, 2 that element is draw with twice more thick lines, etc.).
  • Node on the right side of scheme is already black.
  • Node on the left is drawn as part of resistor $R_e$, so it has the sam color. To make it black, you can write it separately (see MWE below).
  • For shorter and consistent code in both MWE's are added nodes style definition.
  • Input and output nodes are writen on simpler, correct way.
  • To new MWE is added new capacitor style (as I prefer to be drawn)
  • in MWE below are for scheme used relative coordinates, for rectangle, which are drive by lines using orthogonal coordinates, are preserved for simplicity of code, absolute:

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

\begin{document}
       \begin{circuitikz}[
every node/.append style = {font=\bfseries},
  F/.style = {draw=#1, dashed},
lbl/.style = {font=\bfseries, text=#1, pos=0.25, below}
                        ]
\ctikzset{bipoles/thickness=1,
          bipoles/capacitor/height=0.4,
          bipoles/capacitor/width=0.1
          }
\draw[thick]
      (0,0) node[left] {RE}
            to [short, o-]          ++ (0.5,0)
            to [R=$R_e$,color=red]  ++ (1.5,0)
            to [short, -*]          ++ (0.7,0) coordinate (A)
            -- ++ (0,1)
            to [C=$C_d$]            ++ (1.5,0)
            -- ++ (0,-1) coordinate (B)
            to [short, *-o]         ++ (1,0)  node[right] {WE}
      (A)   -- ++ (0,-1)
            to [R=$R_t$]            ++ (1.5,0)
            -- ++ (0,1);
\draw[F=cyan]   (0.5,-1.5) -| ++ (1.5,3.5) node[lbl=cyan] {Solution} -| cycle;
\draw[F=gray]   (2.5,-1.5) -| ++ (2.0,3.5) node[lbl=gray] {Metal}    -| cycle;
        \end{circuitikz}
\end{document}
Related Question