Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When creating a circuit using the tikz circuits library, the objects may have a variety of different constructions. There may be labels containing fractions and there may be ordinary paths with labels. I have found that the font sizes are variable, which can make the resulting circuit difficult to read.

Here is my minimal working example:

\documentclass{standalone}

\usepackage{amsmath}

\usepackage{tikz}
\usetikzlibrary{arrows,circuits.ee.IEC,positioning}

\begin{document}

\begin{tikzpicture}[circuit ee IEC,x=2cm,y=1.5cm,
every info/.style={font=\footnotesize},
small circuit symbols,
set inductor graphic=var inductor IEC graphic,
set diode graphic=var diode IEC graphic,
set make contact graphic= var make contact IEC graphic]
% Set the font size

% Let us start with some contacts:
\foreach \contact/\x in {0/0,2/3}
{
\node [contact] (upper contact \contact) at (\x,4) {};
\node [contact] (lower contact \contact) at (\x,0) {};
}
\node [coordinate] (upper right limit) at (6,4) {};
\node [coordinate] (lower right limit) at (6,0) {};

\draw (upper contact 0) to [current direction={near start,info=$I_1$},resistor={info={$\text{R}_1$}},inductor={near end,info={$\text{jX}_1$}}] (upper contact 2);
\draw (upper contact 2) to[current direction={near start,info=$\text{I}_2$},inductor={near end,info={$\text{jX}_2$}}] (upper right limit)
    to[resistor={info={$\frac{\text{R}_2}{\text{s}}$}}] (lower right limit)
    to (lower contact 2)
    to ++(0,1) coordinate (lower fork) {}
    -- ++(-1,0) to[resistor={info={$\text{R}_\text{m}$}}] ++(0,2)
    to ++(1,0) coordinate (upper fork) {}
    to [current direction'={info=$\text{I}_\text{m}$}] (upper contact 2);
\draw (upper fork) -- ++(1,0)
    to[inductor={info={$\text{jX}_\text{m}$}}] ++(0,-2)
    to (lower fork);
\draw[color=blue,thick,->] (upper contact 0) ++(0,-0.5) -- ++(0,-1.5) node[anchor=east] (spannung) {$\text{U}_1$} -- ++(0,-1.5);
\draw[color=blue,thick,->] (upper contact 2) ++(2,-0.5) -- ++(0,-1.5) node[anchor=east] (spannung) {$\text{U}_\text{Err}$} -- ++(0,-1.5);
\draw (lower contact 2) -- (lower contact 0);

\end{tikzpicture}

\end{document}

Different font sizes...

The U1 and UErr voltage labels are larger than those of the resistances and inductances, and the R_2/s on the right is especially small.

Now, I can put font size parameters in front of the label text, just as I would in a regular LaTeX document, but the problem with this is that the starting size of every text element seems to be different, so I have to adjust the size by trial and error for every label.

If I put something like \large right at the start of the tikzpicture environment, then only the U1 and UErr labels are affected.

Is there a clean way of achieving a consistent font size for every label?

share|improve this question
1  
Well, the resistance and inductance labels are especially small because you set every info/.style={font=\footnotesize} (the part labels are called info nodes). If you remove that, and instead set every node/.style={font=\large} in your tikzpicture options, all the nodes will have the same large font size. –  Jake May 16 '12 at 16:32
    
Ouch, I didn't even SEE that. Thank you! –  Stephen Bosch May 16 '12 at 16:42
    
@Jake - the fraction on the right is still smaller. Any suggestions for addressing that? –  Stephen Bosch May 16 '12 at 16:45
    
Yup, use \dfrac instead of \frac. I've posted an answer in the meantime. –  Jake May 16 '12 at 16:47

1 Answer 1

up vote 3 down vote accepted

The small resistance and inductance labels are caused by the style every info/.style={font=\footnotesize}, which applies to the part labels. To get the same font size for all text, remove that style, and replace it with every node/.style={font=\large} in your tikzpicture options. To make the fraction use larger text, use \dfrac instead of \frac:

\documentclass[border=5mm]{standalone}

\usepackage{amsmath}

\usepackage{tikz}
\usetikzlibrary{arrows,circuits.ee.IEC,positioning}

\begin{document}

\begin{tikzpicture}[circuit ee IEC,x=2cm,y=1.5cm,
every node/.style={font=\large},
small circuit symbols,
set inductor graphic=var inductor IEC graphic,
set diode graphic=var diode IEC graphic,
set make contact graphic= var make contact IEC graphic]
% Set the font size

% Let us start with some contacts:
\foreach \contact/\x in {0/0,2/3}
{
\node [contact] (upper contact \contact) at (\x,4) {};
\node [contact] (lower contact \contact) at (\x,0) {};
}
\node [coordinate] (upper right limit) at (6,4) {};
\node [coordinate] (lower right limit) at (6,0) {};

\draw (upper contact 0) to [current direction={near start,info=$I_1$},resistor={info={$\text{R}_1$}},inductor={near end,info={$\text{jX}_1$}}] (upper contact 2);
\draw (upper contact 2) to[current direction={near start,info=$\text{I}_2$},inductor={near end,info={$\text{jX}_2$}}] (upper right limit)
    to[resistor={info={$\dfrac{\text{R}_2}{\text{s}}$}}] (lower right limit)
    to (lower contact 2)
    to ++(0,1) coordinate (lower fork) {}
    -- ++(-1,0) to[resistor={info={$\text{R}_\text{m}$}}] ++(0,2)
    to ++(1,0) coordinate (upper fork) {}
    to [current direction'={info=$\text{I}_\text{m}$}] (upper contact 2);
\draw (upper fork) -- ++(1,0)
    to[inductor={info={$\text{jX}_\text{m}$}}] ++(0,-2)
    to (lower fork);
\draw[color=blue,thick,->] (upper contact 0) ++(0,-0.5) -- ++(0,-1.5) node[anchor=east] (spannung) {$\text{U}_1$} -- ++(0,-1.5);
\draw[color=blue,thick,->] (upper contact 2) ++(2,-0.5) -- ++(0,-1.5) node[anchor=east] (spannung) {$\text{U}_\text{Err}$} -- ++(0,-1.5);
\draw (lower contact 2) -- (lower contact 0);

\end{tikzpicture}

\end{document}
share|improve this answer
    
Saved by Jake, yet again. I need to start paying better attention. Thanks once more! –  Stephen Bosch May 16 '12 at 17:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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