%%%%%%%%%%% accordingly the CSN IEC 617-1 to 11 (1993-1995) %%%%%%%%
%%%%%%%%%%% Libor Gajdosik 2009 eltex version 2.0 %%%%%%%%%%%%%

\unitlength=1mm
%%%%%%%%grid -generating help grid 10x10mm to simplify orientation%%%%%%
\newcommand{\grid}[2]{
\linethickness{0.1mm}
\unitlength=10mm
  \newcounter{sloupec}
  \setcounter{sloupec}{10}
\put(0,0){\line(0,1){#2}}
\multiput(1,0)(1,0){#1}{\line(0,1){#2}}
\multiput(0.7,-0.5)(1,0){#1}{\arabic{sloupec}\addtocounter{sloupec}{10}}
  \setcounter{sloupec}{10}
\multiput(0.6,#2)(1,0){#1}{\makebox(0.7,0.6)
       {\arabic{sloupec}\addtocounter{sloupec}{10}}}
   \newcounter{radek}
 \put(-0.3,-0.3){\arabic{radek}}
   \setcounter{radek}{10}
\put(0,0){\line(1,0){#1}}
\multiput(0,1)(0,1){#2}{\line(1,0){#1}}
\multiput(-0.8,0.7)(0,1){#2}{\makebox(0.7,0.5)[r]
      {\arabic{radek}\addtocounter{radek}{10}}}
   \setcounter{radek}{10}
\multiput(#1,0.6)(0,1){#2}{\makebox(0.7,0.6)[r]
    {\arabic{radek}\addtocounter{radek}{10}}}
\thicklines
\unitlength=1mm
}
%%%%basic pasive devices (source, resistor, capacitor, inductor)%%%%
%horizontal voltage source
\newcommand{\hsourcev}{
\put(0,0){\line(1,0){30}}
\put(15,0){\circle{10}}
}
%vertical voltage source
\newcommand{\vsourcev}{
\put(0,0){\line(0,1){30}}
``\put(0,15){\circle{10}}
}
%horizontal current source
\newcommand{\hsourcec}{
\put(0,0){\line(1,0){10}}
\put(15,-5){\line(0,1){10}}
\put(15,0){\circle{10}}
\put(20,0){\line(1,0){10}}
}
%vertical current source
\newcommand{\vsourcec}{
\put(0,0){\line(0,1){10}}
\put(5,15){\line(-1,0){10}}
\put(0,15){\circle{10}}
\put(0,20){\line(0,1){10}}
}
\newcommand{\hhsourcev}{
\put(0,0){\line(1,0){20}}
\put(10,0){\circle{10}}
}
%vertical voltage source
\newcommand{\vvsourcev}{
\put(0,0){\line(0,1){20}}
\put(0,10){\circle{10}}
}
%diagonal voltage source
\newcommand{\dsourcev}[1]{
\ifx#1U   %source up right oriented
  \put(0,0){\line(1,1){20}}
  \put(10,10){\circle{10}}
\else \ifx#1D  %source down right oriented
   \put(0,0){\line(1,-1){20}}
   \put(10,-10){\circle{10}}
\fi \fi
}
%horizontal current source
\newcommand{\hhsourcec}{
\put(0,0){\line(1,0){5}}
\put(10,-5){\line(0,1){10}}
\put(10,0){\circle{10}}
\put(15,0){\line(1,0){5}}
}
%vertical current source
\newcommand{\vvsourcec}{
\put(0,0){\line(0,1){5}}
\put(5,10){\line(-1,0){10}}
\put(0,10){\circle{10}}
\put(0,15){\line(0,1){5}}
}
%diagonal current source
\newcommand{\dsourcec}[1]{
\ifx#1U   %source up right oriented
  \put(0,0){\line(1,1){6.5}}
  \put(6.5,13.5){\line(1,-1){7}}
  \put(10,10){\circle{10}}
  \put(13.5,13.5){\line(1,1){6.5}}
\else \ifx#1D  %source down right oriented
  \put(0,0){\line(1,-1){6.5}}
  \put(13.5,-6.5){\line(-1,-1){7}}
  \put(10,-10){\circle{10}}
  \put(13.5,-13.5){\line(1,-1){6.5}}
\fi \fi
}
%horizontal rezistor
\newcommand{\hhrez}[1]{
\put(0,0){\line(1,0){5}}
\put(5,-2){\framebox(10,4){}\put(0,2){\line(1,0){5}}}
\ifnum#1=1           % rez. adjustable by tool (medium pin down oriented)
\put(8,-6){\line(1,3){4}}
\put(10,7){\line(3,-1){4}}
\else \ifnum#1=2     % rez. adjustable by tool (medium pin up oriented)
\put(8,6){\line(1,-3){4}}
\put(10,-7){\line(3,1){4}}
\else \ifnum#1=3     % rez. adjustable by tool (medium pin shortly
                                                        %conected)
\put(8,6){\line(1,-3){4}}
\put(10,-7){\line(3,1){4}}
\put(8,6){\line(-1,0){5}}
\put(3,6){\line(0,-1){6}}
\put(3,0){\node}
\else \ifnum#1=4       % rez. adjustable (medium pin down oriented)
\put(6,-4){\vector(1,1){9}}
\else \ifnum#1=5       % rez. adjustable (medium pin up oriented)
\put(6,4){\vector(1,-1){9}}
\else \ifnum#1=6       % rez. adjustable (medium pin shortly conected)
\put(8,6){\vector(1,-3){4}}
\put(8,6){\line(-1,0){5}}
\put(3,6){\line(0,-1){6}}
\put(3,0){\node}
\else \ifnum#1=7           %nonlinearly dependent
\put(6,-4){\line(1,1){8}}
\put(3,-4){\line(1,0){3}}


\fi \fi \fi \fi \fi \fi \fi
  }
%vertical rezistor
\newcommand{\vvrez}[1]{
\put(0,0){\line(0,1){5}}
\put(-2,5){\framebox(4,10){}\put(-2,10){\line(0,1){5}}}
\ifnum#1=1          % rez. adjustable by tool (medium pin left oriented)
\put(-6,8){\line(3,1){12}}
\put(5,14){\line(1,-2){2}}
\else \ifnum#1=2    % rez. adjustable by tool (medium pin right oriented)
\put(-6,12){\line(3,-1){12}}
\put(-7,10){\line(1,2){2}}
\else \ifnum#1=3   % rez. adjustable by tool (medium pin shortly
                                                        %conected)
\put(-6,7){\line(3,1){12}}
\put(5,13){\line(1,-2){2}}
\put(-6,7){\line(0,-1){4}}
\put(-6,3){\line(1,0){6}}
\put(0,3){\node}
\else \ifnum#1=4       % rez. adjustable (medium pin left oriented)
\put(-4,6){\vector(1,1){9}}
\else \ifnum#1=5       % rez. adjustable (medium pin right oriented)
\put(4,6){\vector(-1,1){9}}
\else \ifnum#1=6      % rez. adjustable (medium pin shortly conected)
\put(-6,8){\vector(3,1){12}}
\put(-6,8){\line(0,-1){5}}
\put(-6,3){\line(1,0){6}}
\put(0,3){\node}
\else \ifnum#1=7
\put(-4,6){\line(1,1){8}}
\put(4,14){\line(1,0){3}}

\fi \fi \fi \fi \fi \fi \fi
  }
%diagonal rezistor
\newcommand{\drez}[2]{
\ifx#1U      % up left oriented
\put(0,0){\line(1,1){7}\put(2.2,5.2){\line(-1,1){4}}
\put(-1.9,9){\line(1,1){7}}\put(2.2,5){\line(1,1){7}}
\put(9,12){\line(-1,1){4}}\put(7,14){\line(1,1){6}}}
      \ifnum#2=1        % rez. adjustable by tool (medium pin left oriented)
\put(2,10){\line(1,0){16}}
\put(18,12){\line(0,-1){4}}
      \fi \ifnum#2=2    % rez. adjustable by tool (medium pin right oriented)
\put(2,10){\line(1,0){16}}
\put(2,12){\line(0,-1){4}}
      \fi \ifnum#2=3   % rez. adjustable by tool (medium pin shortly
                                                        %conected)
\put(2,10){\line(1,0){16}}
\put(18,12){\line(0,-1){4}}
\put(2,10){\line(0,-1){4}}
\put(2,6){\line(1,0){4}}
\put(6,6){\node}
      \fi \ifnum#2=4         % rez. adjustable (medium pin left oriented)
\put(2,10){\vector(1,0){16}}
      \fi \ifnum#2=5         % rez. adjustable (medium pin right oriented)
\put(18,10){\vector(-1,0){16}}
      \fi \ifnum#2=6         % rez. adjustable (medium pin shortly conected)
\put(2,10){\vector(1,0){16}}
\put(2,10){\line(0,-1){4}}
\put(2,6){\line(1,0){4}}
\put(6,6){\node}
       \fi \ifnum#2=7
\put(2,10){\line(1,0){16}}
\put(18,10){\line(1,1){4}}
       \fi   \fi

\ifx#1D              %down right oriented
\put(0,0){\line(1,-1){7}\put(-1.9,-9){\line(1,1){4}}
\put(2,-4.9){\line(1,-1){7}}\put(-1.9,-9){\line(1,-1){7}}}
\put(12,-16){\line(1,1){4}\put(-2,2){\line(1,-1){6}}}
       \ifnum#2=1   % rez. adjustable by tool (medium pin left oriented)
\put(2,-10){\line(1,0){16}}
\put(18,-8){\line(0,-1){4}}
       \else \ifnum#2=2  % rez. adjustable by tool (medium pin right oriented)
\put(2,-10){\line(1,0){16}}
\put(2,-8){\line(0,-1){4}}
      \else \ifnum#2=3   % rez. adjustable by tool (medium pin shortly
                                                        %conected)
\put(2,-10){\line(1,0){16}}
\put(18,-8){\line(0,-1){4}}
\put(2,-10){\line(0,1){4}}
\put(2,-6){\line(1,0){4}}
\put(6,-6){\node}
     \else \ifnum#2=4    % rez. adjustable (medium pin left oriented)
\put(2,-10){\vector(1,0){16}}
     \else \ifnum#2=5    % rez. adjustable (medium pin right oriented)
\put(18,-10){\vector(-1,0){16}}
     \else \ifnum#2=6    % rez. adjustable (medium pin shortly conected)
\put(2,-10){\vector(1,0){16}}
\put(2,-10){\line(0,1){4}}
\put(2,-6){\line(1,0){4}}
\put(6,-6){\node}
      \else \ifnum#2=7
\put(2,-10){\line(1,0){16}}
\put(18,-10){\line(1,1){4}}
\fi  \fi  \fi \fi  \fi \fi \fi \fi
}

%diagonal rezistor (short)
\newcommand{\ddrez}[2]{
\ifx#1U      % up left oriented
\put(0,0){\line(1,1){4}\put(2,2){\line(-1,1){4}}
\put(2,2){\line(1,1){7}}\put(-2,6){\line(1,1){7}}
\put(9,9){\line(-1,1){4}}\put(7,11){\line(1,1){4}}}
      \ifnum#2=1        % rez. adjustable by tool (medium pin left oriented)
\put(-1,7){\line(1,0){16}}
\put(15,9){\line(0,-1){4}}
      \fi \ifnum#2=2    % rez. adjustable by tool (medium pin right oriented)
\put(0,7){\line(1,0){16}}
\put(0,9){\line(0,-1){4}}
      \fi \ifnum#2=3   % rez. adjustable by tool (medium pin shortly
                                                        %conected)
\put(-1,8){\line(1,0){16}}
\put(15,10){\line(0,-1){4}}
\put(-1,8){\line(0,-1){6}}
\put(-1,2){\line(1,0){3}}
\put(2,2){\node}
      \fi \ifnum#2=4         % rez. adjustable (medium pin left oriented)
\put(1,8){\vector(1,0){16}}
      \fi \ifnum#2=5         % rez. adjustable (medium pin right oriented)
\put(16,8){\vector(-1,0){16}}
      \fi \ifnum#2=6         % rez. adjustable (medium pin shortly conected)
\put(-1,8){\vector(1,0){18}}
\put(-1,8){\line(0,-1){6}}
\put(-1,2){\line(1,0){3}}
\put(2,2){\node}
       \fi \ifnum#2=7
\put(2,8){\line(1,0){16}}
\put(18,8){\line(1,1){4}}
       \fi   \fi

\ifx#1D              %down right oriented
\put(0,0){\line(1,-1){4}\put(-2,-6){\line(1,1){4}}
\put(-2,-6){\line(1,-1){7}}\put(2,-2){\line(1,-1){7}}}
\put(9,-13){\line(1,1){4}\put(-2,2){\line(1,-1){4}}}
       \ifnum#2=1   % rez. adjustable by tool (medium pin left oriented)
\put(0,-8){\line(1,0){16}}
\put(16,-6){\line(0,-1){4}}
       \else \ifnum#2=2  % rez. adjustable by tool (medium pin right oriented)
\put(0,-8){\line(1,0){16}}
\put(0,-6){\line(0,-1){4}}
      \else \ifnum#2=3   % rez. adjustable by tool (medium pin shortly
                                                        %conected)
\put(0,-8){\line(1,0){16}}
\put(16,-6){\line(0,-1){4}}
\put(0,-8){\line(0,1){6}}
\put(0,-2){\line(1,0){2}}
\put(2,-2){\node}
     \else \ifnum#2=4    % rez. adjustable (medium pin left oriented)
\put(0,-8){\vector(1,0){16}}
     \else \ifnum#2=5    % rez. adjustable (medium pin right oriented)
\put(16,-8){\vector(-1,0){16}}
     \else \ifnum#2=6    % rez. adjustable (medium pin shortly conected)
\put(0,-8){\vector(1,0){16}}
\put(0,-8){\line(0,1){6}}
\put(0,-2){\line(1,0){2}}
\put(2,-2){\node}
      \else \ifnum#2=7
\put(0,-8){\line(1,0){16}}
\put(16,-8){\line(1,1){4}}
\fi  \fi  \fi \fi  \fi \fi \fi \fi
}
%horizontal rezistor
\newcommand{\hrez}[1]{
\put(0,0){\line(1,0){10}}
\put(10,-2){\framebox(10,4){}\put(0,2){\line(1,0){10}}}
\ifnum#1=1           % rez. adjustable by tool (medium pin down oriented)
\put(12,-6){\line(1,3){4}}
\put(14,7){\line(3,-1){4}}
\else \ifnum#1=2     % rez. adjustable by tool (medium pin up oriented)
\put(12,6){\line(1,-3){4}}
\put(14,-7){\line(3,1){4}}
\else \ifnum#1=3     % rez. adjustable by tool (medium pin shortly
                                                        %conected)
\put(12,6){\line(1,-3){4}}
\put(14,-7){\line(3,1){4}}
\put(12,6){\line(-1,0){4}}
\put(8,6){\line(0,-1){6}}
\put(8,0){\node}
\else \ifnum#1=4       % rez. adjustable (medium pin down oriented)
\put(11,-4){\vector(1,1){9}}
\else \ifnum#1=5       % rez. adjustable (medium pin up oriented)
\put(11,4){\vector(1,-1){9}}
\else \ifnum#1=6       % rez. adjustable (medium pin shortly conected)
\put(12,6){\vector(1,-3){4}}
\put(12,6){\line(-1,0){4}}
\put(8,6){\line(0,-1){6}}
\put(8,0){\node}
\else \ifnum#1=7             %%nonlinearly  dependent
\put(11,-4){\line(1,1){8}}
\put(19,4){\line(1,0){3}}
\fi \fi \fi \fi \fi \fi  \fi
  }
%vertical rezistor
\newcommand{\vrez}[1]{
\put(0,0){\line(0,1){10}}
\put(-2,10){\framebox(4,10){}\put(-2,10){\line(0,1){10}}}
\ifnum#1=1          % rez. adjustable by tool (medium pin left oriented)
\put(-6,12){\line(3,1){12}}
\put(5,18){\line(1,-2){2}}
\else \ifnum#1=2    % rez. adjustable by tool (medium pin right oriented)
\put(-6,18){\line(3,-1){12}}
\put(-7,16){\line(1,2){2}}
\else \ifnum#1=3   % rez. adjustable by tool (medium pin shortly
                                                        %conected)
\put(-6,12){\line(3,1){12}}
\put(5,18){\line(1,-2){2}}
\put(-6,12){\line(0,-1){4}}
\put(-6,8){\line(1,0){6}}
\put(0,8){\node}
\else \ifnum#1=4       % rez. adjustable (medium pin left oriented)
\put(-4,11){\vector(1,1){9}}
\else \ifnum#1=5       % rez. adjustable (medium pin right oriented)
\put(4,11){\vector(-1,1){9}}
\else \ifnum#1=6      % rez. adjustable (medium pin shortly conected)
\put(-6,12){\vector(3,1){12}}
\put(-6,12){\line(0,-1){4}}
\put(-6,8){\line(1,0){6}}
\put(0,8){\node}
\else \ifnum#1=7
\put(-4,11){\line(1,1){8}}
\put(4,19){\line(1,0){3}}
\fi \fi \fi \fi \fi \fi \fi
 }
%horizontal capacitor
\newcommand{\hcap}[1]{
\put(0,0){\line(1,0){14.5}}
\multiput(14.5,3)(1,0){2}{\line(0,-1){6}}
\put(15.5,0){\line(1,0){14.5}}
\ifnum#1=1              % capacitor adjustable by tool
\put(18,-3){\line(-1,1){6}}
\put(9.5,0.5){\makebox(5,5){/}}
 \else \ifnum#1=4       %capacitor adjustable
\put(18,-3){\vector(-1,1){6}}
 \fi \fi
  }
%vertical capacitor
\newcommand{\vcap}[1]{
\put(0,0){\line(0,1){14.5}}
\multiput(-3,14.5)(0,1){2}{\line(1,0){6}}
\put(0,15.5){\line(0,1){14.5}}
 \ifnum#1=1                %cap. adjustable by tool
\put(2.5,12.5){\line(-1,1){6}}
\put(-6,16){\makebox(5,5){/}}
 \else \ifnum#1=4             %cap. adjustable
\put(-3,12){\vector(1,1){7}}
 \fi \fi
  }
%diagonal capacitor
\newcommand{\dcap}[2]{
\ifx#1U          % up right oriented
\put(0,0){\line(1,1){9.25}}
\multiput(7.25,11.75)(1,1){2}{\line(1,-1){4.5}}
\put(10.75,10.75){\line(1,1){9.25}}
  \ifnum#2=1                    %cap. adjustable with tool
\put(5,10){\line(1,0){10}}
\put(15,8){\line(0,1){4}}
  \else \ifnum#2=4             %cap. adjustable
\put(5,10){\vector(1,0){12}}
   \fi \fi
\fi
\ifx#1D                      % down right oriented
\put(0,0){\line(1,-1){9.3}}
\multiput(7.25,-11.75)(1,-1){2}{\line(1,1){4.5}}
\put(10.75,-10.75){\line(1,-1){9.25}}
  \ifnum#2=1                        %cap. adjustable with tool
\put(10,-15){\line(0,1){10}}
\put(8,-5){\line(1,0){4}}
  \else \ifnum#2=4            %cap. adjustable
\put(10,-15){\vector(0,1){11}}
  \fi \fi
\fi
}
%horizontal capacitor
\newcommand{\hhcap}[1]{
\put(0,0){\line(1,0){4.5}}
\multiput(4.5,3)(1,0){2}{\line(0,-1){6}}
\put(5.5,0){\line(1,0){4.5}}
\ifnum#1=1              % capacitor adjustable by tool
\put(8,-3){\line(-1,1){6}}
\put(-0.5,0.5){\makebox(5,5){/}}
 \else \ifnum#1=4       %capacitor adjustable
\put(8,-3){\vector(-1,1){7}}
 \fi \fi
  }
%vertical capacitor
\newcommand{\vvcap}[1]{
\put(0,0){\line(0,1){4.5}}
\multiput(-3,4.5)(0,1){2}{\line(1,0){6}}
\put(0,5.5){\line(0,1){4.5}}
 \ifnum#1=1                %cap. adjustable by tool
\put(2.5,2.5){\line(-1,1){6}}
\put(-6,6){\makebox(5,5){/}}
 \else \ifnum#1=4             %cap. adjustable
\put(-3,2){\vector(1,1){7}}
 \fi \fi
  }
%\horizontal 2 turns
\newcommand{\hturn}[2]{
\ifx#1U               %up arces
\multiput(1.5,0)(3,0){2}{\oval(3,3)[t]}
  \ifnum#2=1            %variable inducance
\put(1.5,4){\line(1,-2){3}}
\put(-0.5,3.25){\line(2,1){4}}
  \fi
\else \ifx#1D         %down arces
\multiput(1.5,0)(3,0){2}{\oval(3,3)[b]}
 \ifnum#2=1            %variable inductance
\put(1.5,-4){\line(1,2){3}}
\put(-0.5,-3.5){\line(2,-1){4}}
  \fi
\fi \fi
}
%vertical 2 turns
\newcommand{\vturn}[2]{
\ifx#1L               %left arces
\multiput(0,1.5)(0,3){2}{\oval(3,3)[l]}
   \ifnum#2=1           %variable inductance
 \put(1,4.5){\line(-2,-1){4}}
 \put(-4.5,4.5){\line(1,-2){2}}
    \fi
\else \ifx#1R        %right arces
\multiput(0,1.5)(0,3){2}{\oval(3,3)[r]}
    \ifnum#2=1           %variable inductance
 \put(-1,1.5){\line(2,1){4}}
 \put(2.4,5.5){\line(1,-2){2}}
    \fi
\fi \fi
}


%\horizontal inductor
\newcommand{\hind}[2]{
\put(0,0){\line(1,0){9}}
\ifx#1U               %up arces
\multiput(10.5,0)(3,0){4}{\oval(3,3)[t]}
  \ifnum#2=1            %variable inducance
\put(12,7){\line(1,-2){5}}
\put(15.25,-4.25){\line(2,1){4}}
  \fi
\else \ifx#1D         %down arces
\multiput(10.5,0)(3,0){4}{\oval(3,3)[b]}
 \ifnum#2=1            %variable inductance
\put(12,-7){\line(1,2){5}}
\put(15.25,4.25){\line(2,-1){4}}
  \fi
\fi \fi
\put(21,0){\line(1,0){9}}
}
%vertical inductor
\newcommand{\vind}[2]{
\put(0,0){\line(0,1){9}}
\ifx#1L               %left arces
\multiput(0,10.5)(0,3){4}{\oval(3,3)[l]}
   \ifnum#2=1           %variable inductance
 \put(4,18){\line(-2,-1){10}}
 \put(3,20){\line(1,-2){2}}
    \fi
\else \ifx#1R        %right arces
\multiput(0,10.5)(0,3){4}{\oval(3,3)[r]}
    \ifnum#2=1           %variable inductance
 \put(-4,13){\line(2,1){10}}
 \put(-5,15){\line(1,-2){2}}
    \fi
\fi \fi
\put(0,21){\line(0,1){9}}
}
%diagonal inductor
\newcommand{\dind}[3]{
\ifx#1D                 %down oriented
\put(0,0){\line(1,-1){5}}
\put(15,-15){\line(1,-1){5}}
       \ifx#2R          %right arces
\multiput(5,-5)(2.5,-2.5){4}{\bezier{40}(0,0)(3.5,1)(2.5,-2.5)}
        \ifnum#3=1          %variable inductance
    \put(5,-10.5){\line(1,0){12}}
    \put(5,-8.5){\line(0,-1){4}}
      \fi
    \fi
       \ifx#2L          %left arces
\multiput(5,-5)(2.5,-2.5){4}{\bezier{40}(0,0)(-1,-3.5)(2.5,-2.5)}
       \ifnum#3=1          %variable inductance
    \put(15,-11){\line(-1,0){12}}
    \put(15,-9){\line(0,-1){4}}
      \fi
  \fi
\fi
\ifx#1U                  %up oriented
\put(0,0){\line(1,1){5}}
\put(15,15){\line(1,1){5}}
   \ifx#2R               %right arces
\multiput(5,5)(2.5,2.5){4}{\bezier{40}(0,0)(3.5,-1)(2.5,2.5)}
    \ifnum#3=1              %variable inductance
  \put(6,11){\line(1,0){12}}
  \put(6,13){\line(0,-1){4}}
    \fi
    \fi
  \ifx#2L                %left arces
\multiput(5,5)(2.5,2.5){4}{\bezier{40}(0,0)(-1,3.5)(2.5,2.5)}
        \ifnum#3=1          %variable inductance
     \put(15,11){\line(-1,0){12}}
     \put(15,13){\line(0,-1){4}}
        \fi
   \fi
\fi
}
%\horizontal inductor
\newcommand{\hhind}[2]{
\put(0,0){\line(1,0){4}}
\ifx#1U               %up arces
\multiput(5.5,0)(3,0){4}{\oval(3,3)[t]}
  \ifnum#2=1            %variable inducance
\put(7,7){\line(1,-2){5}}
\put(10.25,-4.25){\line(2,1){4}}
  \fi
\else \ifx#1D         %down arces
\multiput(5.5,0)(3,0){4}{\oval(3,3)[b]}
 \ifnum#2=1            %variable inductance
\put(7,-7){\line(1,2){5}}
\put(10.25,4.25){\line(2,-1){4}}
  \fi
\fi \fi
\put(16,0){\line(1,0){4}}
}
%vertical inductor
\newcommand{\vvind}[2]{
\put(0,0){\line(0,1){4}}
\ifx#1L               %left arces
\multiput(0,5.5)(0,3){4}{\oval(3,3)[l]}
   \ifnum#2=1           %variable inductance
 \put(4,13){\line(-2,-1){10}}
 \put(3,15){\line(1,-2){2}}
    \fi
\else \ifx#1R        %right arces
\multiput(0,5.5)(0,3){4}{\oval(3,3)[r]}
    \ifnum#2=1           %variable inductance
 \put(-4,8){\line(2,1){10}}
 \put(-5,10){\line(1,-2){2}}
    \fi
\fi \fi
\put(0,16){\line(0,1){4}}
}
%diagonal coil core
\newcommand{\dcore}[3]{
\ifx#1D                    %down oriented
  \ifx#3I          %iron core
\put(0,0){\line(1,-1){#2}}
  \else \ifx#3F    %ferrite core
\multiput(0,0)(5,-5){#2}{\line(1,-1){4}}
   \fi \fi
 \else \ifx#1U             %up oriented
  \ifx#3I         %iron core
\put(0,0){\line(1,1){#2}}
  \else \ifx#3F   %ferrit core
\multiput(0,0)(5,5){#2}{\line(1,1){4}}
  \fi \fi
\fi \fi
}
%vertical coil core
\newcommand{\vcore}[2]{
 \ifx#2I            %iron core
\put(0,0){\line(0,1){#1}}
 \else \ifx#2F      %ferrite core
\multiput(0,0)(0,4){#1}{\line(0,1){3}}
 \fi \fi
}
%horizontal coil core
\newcommand{\hcore}[2]{
 \ifx#2I             %iron core
\put(0,0){\line(1,0){#1}}
 \else \ifx#2F       %ferrite core
\multiput(0,0)(4,0){#1}{\line(1,0){3}}
 \fi \fi
}
%%%switch%%%%%%%%%%%%
%horizontal switch
\newcommand{\hswitch}[1]{
\put(0,0){\line(1,0){2.5}}
  \ifnum#1=1                   %switch on
\put(2.5,0){\line(3,1){6}}
  \fi \ifnum#1=0               %switch off
\put(2.5,0){\line(3,1){6}}
\put(7.5,0){\line(0,1){1.9}}
       \fi
\put(7.5,0){\line(1,0){2.5}}
}
%vertical switch
\newcommand{\vswitch}[1]{
\put(0,0){\line(0,-1){2.5}}
  \ifnum#1=1               %switch on
\put(0,-2.5){\line(1,-3){2}}
  \fi \ifnum#1=0           %switch off
\put(0,-2.5){\line(1,-3){2}}
\put(0,-7.5){\line(1,0){1.9}}
       \fi
\put(0,-7.5){\line(0,-1){2.5}}
}
%horizontal overswitch
\newcommand{\hoswitch}[2]{
\ifx#1R                    %right oriented
  \ifnum#2=0               %switch off
\put(0,0){\line(1,0){2.5}}
\put(2.5,0){\line(2,1){6}}
\put(7.5,2.3){\line(0,1){2.8}}
\put(7.5,5){\line(1,0){2.5}}
\put(7.5,0){\line(1,0){2.5}}
       \fi
  \ifnum#2=1                   %switch on
\put(0,0){\line(1,0){2.5}}
\put(2.5,0){\line(2,-1){6}}
\put(7.5,-2.3){\line(0,-1){2.8}}
\put(7.5,-5){\line(1,0){2.5}}
\put(7.5,0){\line(1,0){2.5}}
  \fi
\fi
\ifx#1L                    %left oriented
  \ifnum#2=0               %switch off
\put(0,0){\line(1,0){2.5}}
\put(7.5,0){\line(-2,1){6}}
\put(2.5,2.3){\line(0,1){2.8}}
\put(0,5){\line(1,0){2.5}}
\put(7.5,0){\line(1,0){2.5}}
       \fi
  \ifnum#2=1                   %switch on
\put(0,0){\line(1,0){2.5}}
\put(7.5,0){\line(-2,-1){6}}
\put(2.5,-2.3){\line(0,-1){2.8}}
\put(0,-5){\line(1,0){2.5}}
\put(7.5,0){\line(1,0){2.5}}
  \fi
\fi
}
%vertical overswitch
\newcommand{\voswitch}[2]{
\ifx#1D                     %down oriented
    \ifnum#2=0           %switch off
\put(0,0){\line(0,-1){2.5}}
\put(0,-2.5){\line(-1,-2){3}}
\put(-5,-7.5){\line(1,0){2.5}}
\put(0,-7.5){\line(0,-1){2.5}}
\put(-5,-7.5){\line(0,-1){2.5}}
       \fi
  \ifnum#2=1               %switch on
\put(0,0){\line(0,-1){2.5}}
\put(0,-2.5){\line(1,-2){3}}
\put(2.5,-7.5){\line(1,0){2.5}}
\put(0,-7.5){\line(0,-1){2.5}}
\put(5,-7.5){\line(0,-1){2.5}}
  \fi
\fi
\ifx#1U                      %up oriented
    \ifnum#2=0           %switch off
\put(0,0){\line(0,1){2.5}}
\put(0,2.5){\line(-1,2){3}}
\put(-5,7.5){\line(1,0){2.5}}
\put(0,7.5){\line(0,1){2.5}}
\put(-5,7.5){\line(0,1){2.5}}
       \fi
  \ifnum#2=1               %switch on
\put(0,0){\line(0,1){2.5}}
\put(0,2.5){\line(1,2){3}}
\put(2.5,7.5){\line(1,0){2.5}}
\put(0,7.5){\line(0,1){2.5}}
\put(5,7.5){\line(0,1){2.5}}
  \fi
\fi
}
%%%%node, loop, pin, wire, earth, chassis%%%%%%%%%
\newcommand{\node}{       %conection of devices
\put(0,0){\circle*{1}}
}
\newcommand{\pin}{
\put(0,0){\circle{1.5}}
}
\newcommand{\hwire}[1]{
\put(0,0){\line(1,0){#1}}  % length mm
}
\newcommand{\vwire}[1]{
\put(0,0){\line(0,1){#1}}  % length mm
}
\newcommand{\dwire}[2]{
\ifx#1U                    %up right oriented
\put(0,0){\line(1,1){#2}}  %length mm
\fi
\ifx#1D                    %down right oriented
\put(0,0){\line(1,-1){#2}} %length mm
\fi
}
%simbol
\newcommand{\simb}[1]{
\ifnum#1=1
\put(0,0){\circle*{1.5}}
 \else \ifnum#1=2
\put(0,0){$\Box$}
 \else \ifnum#1=3
\put(0,0){$\triangle$}
 \fi \fi \fi
}
%current loop oriented
\newcommand{\cloop}[2]{
\ifx#1L             %anti-clockwise oriented
\put(0,0){\oval(12,12)[t]}
\put(0,0){\oval(12,12)[l]\put(0,-6){\vector(1,0){1}}}
\put(-5,-5){\makebox(10,10){#2}}   %label
   \else \ifx#1R       %clockwise oriented
\put(0,0){\oval(12,12)[t]}
\put(0,0){\oval(12,12)[l]\put(6,0){\vector(0,-1){1}}}
\put(-5,-5){\makebox(10,10){#2}}    %label
\fi \fi
}
%earth
\newcommand{\earth}[1]{
  \ifx#1D
    \put(0,0){\line(0,-1){5}}
    \put(-4,-5){\line(1,0){8}}
    \put(-3,-6){\line(1,0){6}}
    \put(-2,-7){\line(1,0){4}}
   \fi
   \ifx#1U
    \put(0,0){\line(0,1){5}}
    \put(-4,5){\line(1,0){8}}
    \put(-3,6){\line(1,0){6}}
    \put(-2,7){\line(1,0){4}}
   \fi
   \ifx#1L
    \put(0,0){\line(-1,0){5}}
    \put(-5,-4){\line(0,1){8}}
    \put(-6,-3){\line(0,1){6}}
    \put(-7,-2){\line(0,1){4}}
   \fi
   \ifx#1R
    \put(0,0){\line(1,0){5}}
    \put(5,-4){\line(0,1){8}}
    \put(6,-3){\line(0,1){6}}
    \put(7,-2){\line(0,1){4}}
   \fi

}
%chassis
\newcommand{\chassis}[1]{
\ifx#1D
 \put(0,0){\line(0,-1){5}}
 {\thicklines \put(-2.5,-5){\line(1,0){5}} }
\fi
\ifx#1U
 \put(0,0){\line(0,1){5}}
 {\thicklines \put(-2.5,5){\line(1,0){5}}}
\fi
\ifx#1L
 \put(0,0){\line(-1,0){5}}
{\thicklines \put(-5,-2.5){\line(0,1){5}}}
\fi
\ifx#1R
 \put(0,0){\line(1,0){5}}
{\thicklines \put(5,-2.5){\line(0,1){5}} }
\fi
}
%horizontal measuring instrument
\newcommand{\hmeasure}[1]{
\put(0,0){\line(1,0){10}}
\put(15,0){\circle{10}}
\put(20,0){\line(1,0){10}}
\put(10,-4.75){\makebox(10,10){#1}}    %label
}
\newcommand{\hhmeasure}[1]{
\put(0,0){\line(1,0){5}}
\put(10,0){\circle{10}}
\put(15,0){\line(1,0){5}}
\put(5,-4.75){\makebox(10,10){#1}}    %label
}
%vertical measuring instrument
\newcommand{\vmeasure}[1]{
\put(0,0){\line(0,1){10}}
\put(0,15){\circle{10}}
\put(0,20){\line(0,1){10}}
\put(-4.75,10){\makebox(10,10){#1}}  %label
}
\newcommand{\vvmeasure}[1]{
\put(0,0){\line(0,1){5}}
\put(0,10){\circle{10}}
\put(0,15){\line(0,1){5}}
\put(-4.75,5){\makebox(10,10){#1}}  %label
}
\newcommand{\osc}[1]{     %oscilloscope
\put(0,0){\line(0,1){5}}
   \ifx#1I
\put(0,10){\circle{10}}     %indicating
   \fi  \ifx#1R
\put(-5,5){\framebox(10,10){}}   %recording
   \fi
\put(0,15){\line(0,1){5}}
\multiput(-4,9)(4,0){2}{\line(2,1){4}}
\put(0,9){\line(0,1){2}}
}

\endinput
