4

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

1
  • 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. May 19, 2014 at 10:53

1 Answer 1

6

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

2
  • Thanks, but what if I wish to add other items to my circuit that I do not want to be blue?
    – Jenni
    May 19, 2014 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, 2014 at 11:14

You must log in to answer this question.

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