I have created a new circuit symbol for battery source (var battery). There are two problems and one question:
- I would like for minus to be always horizontal.
- I would like to control how plus and minus are oriented (e.g. plus up or plus down).
- Is it possible to change graphical representation of + and - with text symbols?
Regards, Marko
\documentclass[12pt,a4paper]{article}
\input{glava}
\usepackage{tikz}
\begin{document}
\usetikzlibrary{circuits.ee}
\usetikzlibrary{circuits.ee.IEC}
\tikzset{circuit declare symbol = var battery}
\tikzset{set var battery graphic = var battery IEC graphic}
\tikzset{var battery IEC graphic/.style=
{transform shape, circuit symbol lines, circuit symbol size = width
2.5 height 2.5,
shape=generic circle IEC, /pgf/generic circle IEC/before
background=
{\pgfpathcircle{\pgfpoint{0.45pt}{0pt}}{0.1pt}
\pgfpathcircle{\pgfpoint{-0.45pt}{0pt}}{0.1pt}
\pgfpathmoveto{\pgfpoint{-1.0pt}{0pt}}
\pgfpathlineto{\pgfpoint{-0.6pt}{0pt}}
\pgfpathmoveto{\pgfpoint{1.0pt}{0pt}}
\pgfpathlineto{\pgfpoint{0.6pt}{0pt}}
% PLUS SYMBOL
\pgfpathmoveto{\pgfpoint{-0.45pt}{0.25pt}}
\pgfpathlineto{\pgfpoint{-0.45pt}{0.65pt}}
\pgfpathmoveto{\pgfpoint{-0.25pt}{0.45pt}}
\pgfpathlineto{\pgfpoint{-0.65pt}{0.45pt}}
% MINUS SYMBOL
\pgfpathmoveto{\pgfpoint{0.25pt}{0.45pt}}
\pgfpathlineto{\pgfpoint{0.65pt}{0.45pt}}
\pgfusepathqstroke}}}
\begin{tikzpicture}[circuit ee IEC,semithick,x=1cm,y=1cm]
\draw (0,0) to [capacitor] (3,0)
to [resistor] (3,2)
to [var battery] (0,2)
to [var battery={info'={$U_3$}}] (0,0);
\end{tikzpicture}
\end{document}