# Drawing Schematics With TikZ And CircuitikZ

## QuickLatex Setup

The code below shows the basic setup to draw a Circuitikz diagram in a Wordpress post using the QuickLatex plugin.

Add the actual Circuitikz code between the end of the preamble and the end of the tikzpicture elements.

Sometimes in can be beneficial to add a background to the circuit drawing. This is true when using QuickLatex with Wordpress to render Circuitikz (as this site does), as by default it uses a transparent background, which is good for inline equations, but not so much for circuit drawings.

Tailor the corners of the rectangle to provide the correct size background for your circuit drawing.

## Capacitors

The three types of capacitors used are easily drawn.

 \begin{tikzpicture}[+preamble]\usepackage{tikz}\usepackage[siunitx]{circuitikz}[/preamble]% Draw a non-polarized capacitor.\draw (0,0) to [C, l=$C$] (0,2);\end{tikzpicture} \begin{tikzpicture}[+preamble]\usepackage{tikz}\usepackage[siunitx]{circuitikz}[/preamble]% Draw a polarized capacitor.\draw (0,0) to [pC, l=$C$] (0,2);\end{tikzpicture} \begin{tikzpicture}[+preamble]\usepackage{tikz}\usepackage[siunitx]{circuitikz}[/preamble]% Draw a variable capacitor.\draw (0,0) to [vC, l=$C$] (0,2);\end{tikzpicture} Unpolarised capacitor. Polarised capacitor. Variable capacitor.

## Op-Amps And Comparators

Op-amps and caparators share the same symbol.

## Dashed Lines

It took me awhile to get dashed lines to work, here is the correct way to draw them:

Make sure to use a separate draw command for dashed lines, rather than tacking it onto another one, otherwise you will find all lines in that draw command will become dashed.