Skip to content

Instantly share code, notes, and snippets.

@maxanier
Last active August 22, 2025 10:27
Show Gist options
  • Select an option

  • Save maxanier/b973948d27855f3a7991cc93372c841c to your computer and use it in GitHub Desktop.

Select an option

Save maxanier/b973948d27855f3a7991cc93372c841c to your computer and use it in GitHub Desktop.
Circuitikz components: Fancy transmission line, zero ohm line and matching structure. All path-style components.
example

These files may be distributed and/or modified

  • under the LaTeX Project Public License and/or
  • under the GNU Public License.
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Different style of transmission line - fancytl
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ctikzset{bipoles/fancytl/height/.initial=.5}
\ctikzset{bipoles/fancytl/width/.initial=.9}
\pgfcircdeclarebipolescaled{RF}
{% anchor for labelling the type of dependency
}
{\ctikzvalof{bipoles/fancytl/height}}
{fancytl} %name
{0.3}
{\ctikzvalof{bipoles/fancytl/width}}
{
%Through path (as rect, because I do not understand linewidth)
\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{0.05\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{0.05\pgf@circ@res@down}}
\pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
\pgfusepath{draw,fill}
%Reference path
\pgfpathrectanglecorners{\pgfpoint{0.8\pgf@circ@res@left}{0.45\pgf@circ@res@down}}{\pgfpoint{0.8\pgf@circ@res@right}{0.55\pgf@circ@res@down}}
\pgfusepath{draw,fill}
%Left ground connection
\pgfpathmoveto{\pgfpoint{0.8\pgf@circ@res@left}{0.5\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{1\pgf@circ@res@down}}
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{1\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@left}{1\pgf@circ@res@down}}
\pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
%Right ground connection
\pgfpathmoveto{\pgfpoint{0.8\pgf@circ@res@right}{0.5\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{1\pgf@circ@res@down}}
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{1\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{1\pgf@circ@res@down}}
\pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
\pgfusepath{draw}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 0 Ohm Line
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ctikzset{bipoles/zeroohmline/height/.initial=.5}
\ctikzset{bipoles/zeroohmline/width/.initial=0.9}
\pgfcircdeclarebipolescaled{RF}
{% anchor for labelling the type of dependency
}
{\ctikzvalof{bipoles/zeroohmline/height}}
{zeroohmline} %name
{\ctikzvalof{bipoles/zeroohmline/height}}
{\ctikzvalof{bipoles/zeroohmline/width}}
{
%Through path (as rect, because I do not understand linewidth)
\pgfpathrectanglecorners{\pgfpoint{\pgf@circ@res@left}{0.05\pgf@circ@res@up}}{\pgfpoint{\pgf@circ@res@right}{0.05\pgf@circ@res@down}}
\pgf@circ@setlinewidth{bipoles}{\pgfstartlinewidth}
\pgfusepath{draw,fill}
%Reference path 1
\pgfpathrectanglecorners{\pgfpoint{0.8\pgf@circ@res@left}{0.35\pgf@circ@res@down}}{\pgfpoint{0.8\pgf@circ@res@right}{0.45\pgf@circ@res@down}}
\pgfusepath{draw,fill}
%Reference path 2
\pgfpathrectanglecorners{\pgfpoint{0.8\pgf@circ@res@left}{0.35\pgf@circ@res@up}}{\pgfpoint{0.8\pgf@circ@res@right}{0.45\pgf@circ@res@up}}
\pgfusepath{draw,fill}
%Lower Left ground connection
\pgfpathmoveto{\pgfpoint{0.8\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{1\pgf@circ@res@down}}
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{1\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@left}{1\pgf@circ@res@down}}
\pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@left}{1.2\pgf@circ@res@down}}
%Lower Right ground connection
\pgfpathmoveto{\pgfpoint{0.8\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{1\pgf@circ@res@down}}
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{1\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{1\pgf@circ@res@down}}
\pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{1.2\pgf@circ@res@down}}
%Upper Left ground connection
\pgfpathmoveto{\pgfpoint{0.8\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@left}{1\pgf@circ@res@up}}
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{1\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@left}{1\pgf@circ@res@up}}
\pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@left}{1.2\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@left}{1.2\pgf@circ@res@up}}
%Upper Right ground connection
\pgfpathmoveto{\pgfpoint{0.8\pgf@circ@res@right}{0.4\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{0.8\pgf@circ@res@right}{1\pgf@circ@res@up}}
\pgfpathmoveto{\pgfpoint{\pgf@circ@res@right}{1\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{0.6\pgf@circ@res@right}{1\pgf@circ@res@up}}
\pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@right}{1.2\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{0.7\pgf@circ@res@right}{1.2\pgf@circ@res@up}}
\pgfusepath{draw}
}
\ctikzset{bipoles/match/height/.initial=1}
\ctikzset{bipoles/match/width/.initial=.9}
\pgfcircdeclarebipolescaled{RF}
{% anchor for labelling the type of dependency
}
{\ctikzvalof{bipoles/match/height}}
{match} %name
{\ctikzvalof{bipoles/match/height}}
{\ctikzvalof{bipoles/match/width}}
{
\pgfsetlinewidth{2\pgflinewidth}
%Draw paths
\pgfpathmoveto{\pgfpoint{1\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{1\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{0\pgf@circ@res@left}{0.4\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{0\pgf@circ@res@left}{1\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{1\pgf@circ@res@right}{1\pgf@circ@res@up}}
\pgfpathlineto{\pgfpoint{1\pgf@circ@res@right}{1\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{0\pgf@circ@res@right}{1\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{0\pgf@circ@res@right}{0.4\pgf@circ@res@down}}
\pgfpathlineto{\pgfpoint{1\pgf@circ@res@left}{0.4\pgf@circ@res@down}}
\pgfusepath{draw}
}
\pgfcirc@activate@bipole@simple{l}{fancytl}
\pgfcirc@activate@bipole@simple{l}{zeroohmline}
\pgfcirc@activate@bipole@simple{l}{match}
\makeatother
\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\usepackage{circuitikz}
\input{circuitikz_library}
\begin{document}
\begin{tikzpicture}
\ctikzset{bipoles/match/width=0.9,bipoles/match/height=1.1}
\draw (0,0) to[fancytl] ++(2,0) to[zeroohmline] ++(2,0) to[match] ++(2,0);
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment