# Supply rails in circuitikz

I am trying to draw the circuit below, however I am having difficulty in drawing the connections to the supply rails. I've abused the sground node since it is the same as the typical symbol for power supply connections.

As you can see, the

For the node labelled VSS, I can use the sground node without any problem, but for nodes labelled VDD, I have to invert it, which I am doing by setting the y-axis scale to -1. This has the side-effect of inverting the associated label:

(0, 10) node [sground, yscale = -1] () {$V_{DD}$}


How can I achieve this without inverting the text?

The full source is below.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% JFET differential Amplifier
%

\documentclass[10pt, a4paper] {article}
\usepackage[siunitx, americanvoltages] {circuitikz}

\begin{document}
\begin{tikzpicture}

\draw[color = black, thick]

(0, 10) node [sground, yscale = -1] () {$V_{DD}$}
(0, 8) to [R, l = $R_{D1}$] (0, 10) {}
(0, 8) to [short, *-o] (1, 8) {}
(0, 7) to [Tnjfet, l = $Q_1$] (0, 8) {}
(-0.9, 7.23) to [short, -o] (-1.5, 7.23) {}
(0, 7) to [short] (0, 6)

(4, 10) node [sground, yscale = -1] () {$V_{DD}$}
(4, 8) to [R, l = $R_{D2}$] (4, 10) {}
(4, 8) to [short, *-o] (3, 8) {}
(4, 7) to [Tnjfet, mirror, l = $Q_2$] (4, 8) {}
(4.9, 7.23) to [short, -o] (5.5, 7.23) {}
(4, 7) to [short] (4, 6)

(0, 6) to [short] (4, 6)
(2, 6) node [circ] () {}
(2, 6) to [R, l = $R_{SS}$] (2, 4)
(2, 4) node [sground] () {$V_{SS}$}

;

\end{tikzpicture}
\end{document}

• Can you add a minimal example of the code used for the image? Possibly reflecting also the label will do (double reflection = identity). – egreg May 24 '15 at 11:08
• I newer seen ground symbol for using for anything else as for ground. For positive supply voltage is usually used a circle. – Zarko May 24 '15 at 11:10
• @egreg I've updated the question to include the complete source. How do you suggest I reflect the label? – bhillam May 24 '15 at 11:29
• @Zarko the open (unfilled) circle seems to be the convention in tekz, but there are others who use an arrow (filled or unfilled) or a bar (rground symbol in circuitikz). Personally I prefer the arrow for power rails and open circles for input and output signals. Maybe that's just me. – bhillam May 24 '15 at 11:29
• Assuming you really want to use that node shape, I'd put it without label and name it, and then add another node, anchored to it, without the 'yscale' – kenshin May 24 '15 at 11:48

This happens because the ground nodes and their variants are not really designed to have node text anchored to them: in addition to the upside down text, in both the inverted and non-inverted sground nodes in your example, the spacing is less than optimal when compared with the spacing around other node texts. Notice that, in the package manual, every use of ground (or its variants) comes with an empty node text ({}).

What I always do is leave the node texts empty for ground nodes and simply add another node (to the right or left or any other direction as appropriate) right at the same spot, which will then be spaced out from the circuit a little better.

Also, I'd suggest that instead of typing sground,yscale=-1 for each of these, define in one spot something like:

\tikzset{srail/.style={sground,yscale=-1}}


This way, you can simply use srail for all of these components and it's easier to update if you change your mind about the style of this component later. (You could even change your mind and decide to declare an entirely new shape with this method.)

Here's how I would approach it:

\documentclass[tikz]{standalone}
\usepackage[siunitx, americanvoltages] {circuitikz}
\tikzset{srail/.style={sground,yscale=-1}}

\begin{document}
\begin{tikzpicture} \draw
node [srail] {}
node[right] {$V_{DD}$}
to[R=1.8<\kilo\ohm>] ++(0,-2)
node [sground] {}
node[right] {$V_{SS}$}
;\end{tikzpicture}
\end{document}


• I had trouble deciding which answer to choose between you and @Alenanno - both are excellent and helped solved my problem. Sadly I cannot award the points to both of you. – bhillam May 26 '15 at 12:18

You can set a style called sgroundr and apply the rotation to it, then use labels instead of the node text. The rotation does not affect them.

## Code

\documentclass[margin=10pt]{standalone}
\usepackage[americanvoltages]{circuitikz}
\usepackage{siunitx}

\tikzset{
sgroundr/.style={sground, rotate=180},
}

\begin{document}
\begin{tikzpicture}

\draw[color = black, thick]

(0, 10) node [sgroundr, label=right:$V_{DD}$] {}
(0, 8) to [R, l = $R_{D1}$] (0, 10) {}
(0, 8) to [short, *-o] (1, 8) {}
(0, 7) to [Tnjfet, l = $Q_1$] (0, 8) {}
(-0.9, 7.23) to [short, -o] (-1.5, 7.23) {}
(0, 7) to [short] (0, 6)

(4, 10) node [sgroundr, label=right:$V_{DD}$] {}
(4, 8) to [R, l = $R_{D2}$] (4, 10) {}
(4, 8) to [short, *-o] (3, 8) {}
(4, 7) to [Tnjfet, mirror, l = $Q_2$] (4, 8) {}
(4.9, 7.23) to [short, -o] (5.5, 7.23) {}
(4, 7) to [short] (4, 6)

(0, 6) to [short] (4, 6)
(2, 6) node [circ] () {}
(2, 6) to [R, l = $R_{SS}$] (2, 4)
(2, 4) node [sground] () {$V_{SS}$}
;
\end{tikzpicture}
\end{document}

• Ooooh, nice! I didn't think of that method! (+1) – Paul Gessler May 24 '15 at 17:58