# How to move anchors in new circuitikz component?

There are some components missing in the nice circuitikz package. I tried to create these with help of the answers to questions CircuiTikZ — create new component and New component in circuitikz. Now I get following result for a so called norator. As one can see, the connectors are in the center of the circles. I want them at the left and right sides of the circles. Any recommendations are very welcome.

My code is:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usepackage{circuitikz}

\makeatletter
% used to process styles for to-path
\def\TikzBipolePath#1#2{\pgf@circ@bipole@path{#1}{#2}}
% restore size value for bipole definitions
\pgf@circ@Rlen = \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
\makeatother

\newlength{\ResUp}
\newlength{\ResDown}
\newlength{\ResLeft}
\newlength{\ResRight}

% norator
\ctikzset{bipoles/norator/height/.initial=.35}   % box height
\ctikzset{bipoles/norator/width/.initial=.35}    % box width
\pgfcircdeclarebipole{}                           % no extra anchors
{\ctikzvalof{bipoles/norator/height}}
{norator}                                        % component name
{\ctikzvalof{bipoles/norator/height}}
{\ctikzvalof{bipoles/norator/width}}
{                                                 % component symbol drawing ...
\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}\pgfstartlinewidth}
\pgfextracty{\ResUp}{\northeast}                % coordinates
\pgfextracty{\ResDown}{\southwest}
\pgfextractx{\ResLeft}{\southwest}
\pgfextractx{\ResRight}{\northeast}
\pgfpathellipse{\pgfpoint{\ResUp}{0}}
{\pgfpoint{0}{\ResUp}}
{\pgfpoint{\ResUp}{0}}
\pgfpathellipse{\pgfpoint{-\ResUp}{0}}
{\pgfpoint{0}{\ResUp}}
{\pgfpoint{\ResUp}{0}}
\pgfusepath{draw}                               % draw it!
}

\def\circlepath#1{\TikzBipolePath{norator}{#1}}
\tikzset{norator/.style = {\circuitikzbasekey, /tikz/to path=\circlepath, l=#1}}

\begin{document}
\begin{circuitikz}[scale=0.75, european resistors]
\draw
(0,0) to [short, o-] (1,0)
to [norator] (2,0)                       % connect the new component
to [R, -o] (5,0)
;

\end{circuitikz}
\end{document}


Ok, after some experiments, finally I got some solution:

The values, which I modified are initial height and width and then the centers of the circles and radius.

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usepackage{circuitikz}

\makeatletter
% used to process styles for to-path
\def\TikzBipolePath#1#2{\pgf@circ@bipole@path{#1}{#2}}
% restore size value for bipole definitions
\pgf@circ@Rlen = \pgfkeysvalueof{/tikz/circuitikz/bipoles/length}
\makeatother

\newlength{\ResUp}
\newlength{\ResDown}
\newlength{\ResLeft}
\newlength{\ResRight}

% norator
\ctikzset{bipoles/norator/height/.initial=.5}   % box height
\ctikzset{bipoles/norator/width/.initial=.5}    % box width
\pgfcircdeclarebipole{}                           % no extra anchors
{\ctikzvalof{bipoles/norator/height}}
{norator}                                        % component name
{\ctikzvalof{bipoles/norator/height}}
{\ctikzvalof{bipoles/norator/width}}
{                                                 % component symbol drawing ...
\pgfsetlinewidth{\pgfkeysvalueof{/tikz/circuitikz/bipoles/thickness}    \pgfstartlinewidth}
\pgfextracty{\ResUp}{\northeast}                % coordinates
\pgfextracty{\ResDown}{\southwest}
\pgfextractx{\ResLeft}{\southwest}
\pgfextractx{\ResRight}{\northeast}
\pgfpathellipse{\pgfpoint{\ResUp/2}{0}}
{\pgfpoint{0}{\ResUp/2}}
{\pgfpoint{\ResUp/2}{0}}
\pgfpathellipse{\pgfpoint{-\ResUp/2}{0}}
{\pgfpoint{0}{\ResUp/2}}
{\pgfpoint{\ResUp/2}{0}}
\pgfusepath{draw}                               % draw it!
}

\def\circlepath#1{\TikzBipolePath{norator}{#1}}
\tikzset{norator/.style = {\circuitikzbasekey, /tikz/to path=\circlepath, l=#1}}

\begin{document}
\begin{circuitikz}[scale=0.75, european resistors]
\draw
(0,0) to [short, o-] (1,0)
to [norator] (2,0)                       % connect the new component
to [R, -o] (5,0)
;

\end{circuitikz}
\end{document}


A PSTricks solution using the pst-circ package:

\documentclass{article}

\usepackage{pst-circ}

\begin{document}

\begin{pspicture}[dimen = m](5.5,1)
\pnodes(0,0.5){A}(1,0.5){B}(2,0.5){C}(3,0.5){D}(5.5,0.5){E}
\wire[arrows = o-](A)(B)
\Ucc(B)(C){}
\Ucc(C)(D){}
\resistor[arrows = -o](D)(E){}
\end{pspicture}

\end{document}


• Well, yes, but I fear that I can't integrate this into a larger circuit picture in combination with other cicuitikz components. But thanks anyhow. – Harald Lichtenstein Feb 13 '16 at 20:09
• @HaraldLichtenstein You could still consider accepting the answer in order to "close" the question. – Svend Tveskæg Jun 16 '16 at 17:37
• Yes, thanks for the hint I accept the answer and close the question. [close]. – Harald Lichtenstein Jun 21 '16 at 7:31