<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%%%%electron tubes(diode, triode, pentode, heptode)%%%
%cathode
\newcommand{\cathode}{
\put(0,0){\oval(6,6)[t]}
\put(-3,-4){\line(0,1){4}}
}
%focus
\newcommand{\focus}{
\put(0,0){\oval(3,3)[t]}
\put(-1.5,0){\line(0,-1){4}}
\put(1.5,0){\line(0,-1){4}}
}
%grids in valve
\newcommand{\gr}[1]{
\multiput(0,0)(0,2.5){#1}{\multiput(0,0)(3,0){3}{\line(1,0){2}}}
}
%anode
\newcommand{\anode}{
\put(0,0){\line(1,0){5}}
\put(2.5,0){\line(0,1){5}}
 }
%connection
\newcommand{\conn}[1]{
\ifnum#1=1            %right
  \put(0,0){\line(1,2){2}}
  \put(2,4){\line(0,1){6}}
  \put(2,10){\line(-1,0){1}}
\fi
\ifnum#1=2            %right
  \put(-1.5,0){\line(1,0){1.5}}
  \put(0,0){\line(1,2){2}}
  \put(2,4){\line(0,1){6}}
  \put(2,10){\line(-1,0){1}}
\fi
\ifnum#1=3            %right
  \put(0,0){\line(1,2){2}}
  \put(2,4){\line(0,1){11}}
  \put(2,15){\line(-1,0){1}}
  \multiput(-8,7.5)(0,5){2}{\line(1,0){1}}
  \put(-8,7.5){\line(0,1){5}}
\fi
\ifnum#1=4            %right
  \put(-1.5,0){\line(1,0){1.5}}
  \put(0,0){\line(1,2){2}}
  \put(2,4){\line(0,1){11}}
  \put(2,15){\line(-1,0){1}}
  \multiput(-8,7.5)(0,5){2}{\line(1,0){1}}
  \put(-8,7.5){\line(0,1){5}}
\fi
 }
%tube outline
\newcommand{\tout}[1]{
\ifnum#1=1
  \put(0,5){\oval(12,12)[b]}
  \put(0,5){\oval(12,15)[t]}
\fi
\ifnum#1=2
  \put(0,5){\oval(12,12)[b]}
  \put(0,8){\oval(12,15)[t]}
  \put(-6,5){\line(0,1){6}}
  \put(6,5){\line(0,1){6}}
\fi
\ifnum#1=3
  \put(0,5){\oval(12,12)[b]}
  \put(0,13){\oval(12,15)[t]}
  \put(-6,5){\line(0,1){11}}
  \put(6,5){\line(0,1){11}}
\fi
}
%%%heptode%%%%%
\newcommand{\heptode}[3]{
\ifx#1Y
  \put(0,2){\focus}
    \put(0,2){\focus}
    \ifx#2Y \else  \ifx#3Y   %connection focus-grid
  \put(3,2){\conn{4}}
    \fi \fi
\fi
\ifx#2Y
  \put(0,2){\cathode}
\fi
  \put(-4,7){\gr{5}}
  \put(-2.5,19.5){\anode}
\ifx#3Y                   %connection cathode-grid, g2-g4
  \put(3,2){\conn{3}}
\fi
  \put(0,1){\tout{3}}
}
%%%tetrode%%%%%%
\newcommand{\tetrode}[2]{
\ifx#1Y
  \put(0,2){\focus}
\fi
\ifx#2Y
  \put(0,2){\cathode}
\fi
  \put(-4,7){\gr{2}}
  \put(-2.5,14.5){\anode}
  \put(0,1){\tout{2}}
}
%%%pentode%%%%%%
\newcommand{\pentode}[3]{
\ifx#1Y
  \put(0,2){\focus}
    \ifx#2Y \else  \ifx#3Y   %connection focus-grid
  \put(3,2){\conn{2}}
    \fi \fi
\fi
\ifx#2Y
  \put(0,2){\cathode}
\fi
    \ifx#3Y                   %connection cathode-grid
  \put(3,2){\conn{1}}
    \fi
  \put(-4,7){\gr{3}}
  \put(-2.5,14.5){\anode}
  \put(0,1){\tout{2}}
}
%%%triode%%%%%%
\newcommand{\triode}[2]{
\ifx#1Y
  \put(0,2){\focus}
\fi
\ifx#2Y
  \put(0,2){\cathode}
\fi
  \put(-4,7){\gr{1}}
  \put(-2.5,10){\anode}
  \put(0,1){\tout{1}}
}
%%%diode%%%%%%
\newcommand{\diode}[2]{
\ifx#1Y
  \put(0,2){\focus}
\fi
\ifx#2Y
  \put(0,2){\cathode}
\fi
  \put(-2.5,10){\anode}
  \put(0,1){\tout{1}}
}
\endinput
</pre></body></html>