3

I wish to make a component (capacitor) in my circuit a different color (blue).

When I use the code:

\begin{document}
\usepackage{circuitikz}
\begin{center}
\begin{circuitikz} 
\draw(0,0) to [C,l_=$C$,*-*,color=blue](0,2);
\end{circuitikz}
\end{center}
\end{document}

This happens:

But I want the lines going to the capacitor to be blue too and not black. How do I do this if I wish to add additional components to my circuit later on and want those to be black?

Can I also make the label C blue too?

Thanks

  • Welcome to TeX.SX! A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}) or hit Ctrl+K. – Claudio Fiandrino May 19 '14 at 10:53
4

If you add the option [blue] to your draw command, everything should be fine. If you want to revert to the default color, you end the blue draw command with a semicolon and begin a new draw command without the blue color options.

\documentclass{standalone}
\usepackage{circuitikz}

\begin{document}

\begin{circuitikz}
    \draw[blue] (0,0) to [C,l_=$C$,*-*,color=blue] (0,2);
    \draw (2,0) to [C,l_=$C$,*-*] (2,2);
\end{circuitikz}

\end{document}

Capacitors

  • Thanks, but what if I wish to add other items to my circuit that I do not want to be blue? – Jenni May 19 '14 at 11:10
  • @Jenni, then you don't use the color options for subsequent draw commands. Example: \draw[blue] <blue component>; \draw <standard, black component>; – eiterorm May 19 '14 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.