Skip to content

Instantly share code, notes, and snippets.

@maxanier
Last active March 3, 2023 21:28
Show Gist options
  • Save maxanier/d4d511535b87e0fb388633b255ab0ce9 to your computer and use it in GitHub Desktop.
Save maxanier/d4d511535b87e0fb388633b255ab0ce9 to your computer and use it in GitHub Desktop.
Latex Circuitikz RF Transmission Line Symbols

About

I couldn't find the style of transmission line symbol I wanted for circuitikz. This is my attempt of implementing it. It is probably not perfect.

Usage

In your preamble (before \begin{document}) do:

\makeatother
\include{definitions.tex}
\makeatletter

Use components, example:

\begin{circuitikz} 
  \draw (0,0) to[zeroohmline=$3$] ++(2,0) to[fancytl,l=$5$,a=$6$] ++(2,0); 
\end{circuitikz} 
%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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 - zeroohmline
%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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}
}
\pgfcirc@activate@bipole@simple{l}{fancytl}
\pgfcirc@activate@bipole@simple{l}{zeroohmline}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment