5

I need to draw a wire that looks like

enter image description here

That is the symbol my lecturer uses for the Josephson junction. I googled a bit and it seems to be the commonly used symbol for such an element, so it would be useful to have a way to implement it in circuitikz.

I use pgfplots as well as tikzexternalize, which forces me to start the circuitikz environments with \begin{tikzpicture}, if that makes any difference.


EDIT (as requested in comment): I would like to use the element between a and d in the following circuit:

\begin{figure}[ht]
  \centering
\begin{tikzpicture}
      \draw (0,0)
        node[label={[font=\footnotesize]above:a}] {}
      to[short,*-*] (1.732,1)
        node[label={[font=\footnotesize]above:d}] {};
      \draw (0,0)
      to[C=$C$,*-*] (-1.732,1)
        node[label={[font=\footnotesize]above:b}] {};
      \draw (0,0)
      to[L=$L$,*-*] (0,-2)
        node[label={[font=\footnotesize]east:c}] {};
\end{tikzpicture}
    \caption{Explaining conventions}
\end{figure}

The code produces the following in my document: enter image description here

3
  • 1
    Welcome! Can you post the code for a simple circuit without that symbol? A complete document people can cut-paste-compile makes it easier and quicker for people to help, especially if they are not familiar with all the libraries/packages you are using.
    – cfr
    Jul 29, 2015 at 21:01
  • @Daniel Does this seem OK?
    – AboAmmar
    Jul 29, 2015 at 21:40
  • @AboAmmar, yes it does. But note that someone already answered the question in a satisfying way, so except if you've already done all the work, don't worry about crafting a solution. Thanks regardless!
    – Daniel
    Jul 29, 2015 at 21:56

2 Answers 2

4

Using a native circuitikz symbol known as barrier:

enter image description here

\documentclass{article}
\usepackage{circuitikz}
\begin{document}

\begin{figure}[ht]
  \centering
\begin{tikzpicture}
      \draw (0,0)
        node[label={[font=\footnotesize]above:a}] {}
      to[barrier,*-*] (1.732,1)
        node[label={[font=\footnotesize]above:d}] {};
      \draw (0,0)
      to[C=$C$,*-*] (-1.732,1)
        node[label={[font=\footnotesize]above:b}] {};
      \draw (0,0)
      to[L=$L$,*-*] (0,-2)
        node[label={[font=\footnotesize]east:c}] {};
\end{tikzpicture}
    \caption{Explaining conventions}
\end{figure}

\end{document}
1
  • Thank you, that is a very simple solution! I assume there is no way of getting rid of the extra "thickness" of the wire around the cross?
    – Daniel
    Jul 29, 2015 at 22:08
4

You can create your own component, here is an example, it might need some tweaking though:

enter image description here

You can adjust the width and height using:

\ctikzset{bipoles/josephsonjunction/height/.initial=.30}   % box height
\ctikzset{bipoles/josephsonjunction/width/.initial=.30}    % box width

... and the line width using:

\pgfsetlinewidth{3\pgfstartlinewidth}

The code:

\documentclass[tikz,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}

%  josephsonjunction
\ctikzset{bipoles/josephsonjunction/height/.initial=.30}   % box height
\ctikzset{bipoles/josephsonjunction/width/.initial=.30}    % box width
\pgfcircdeclarebipole{}                                    % no extra anchors
{\ctikzvalof{bipoles/josephsonjunction/height}}
{josephsonjunction}                                        % component name
{\ctikzvalof{bipoles/josephsonjunction/height}}
{\ctikzvalof{bipoles/josephsonjunction/width}}
{                                                          % component symbol drawing...
  \pgfextracty{\ResUp}{\northeast}                         % coordinates
  \pgfextracty{\ResDown}{\southwest}
  \pgfextractx{\ResLeft}{\southwest}
  \pgfextractx{\ResRight}{\northeast}
  \pgfsetlinewidth{3\pgfstartlinewidth}
  \pgfmoveto{\pgfpoint{\ResLeft}{\ResDown}}
  \pgflineto{\pgfpoint{\ResRight}{\ResUp}}
  \pgfmoveto{\pgfpoint{\ResRight}{\ResDown}}
  \pgflineto{\pgfpoint{\ResLeft}{\ResUp}}
  \pgfusepath{draw}
  \pgfsetlinewidth{\pgfstartlinewidth}
  \pgfmoveto{\pgfpoint{\ResLeft}{0}}
  \pgflineto{\pgfpoint{\ResRight}{0}}
  \pgfusepath{draw}
}
\def\circlepath#1{\TikzBipolePath{josephsonjunction}{#1}}
\tikzset{josephsonjunction/.style = {\circuitikzbasekey, /tikz/to path=\circlepath, l=#1}}

\begin{document}
\begin{tikzpicture}
  \draw (0,0)
    node[label={[font=\footnotesize]above:a}] {}
    to[josephsonjunction,*-*] (1.732,1) % using the josephsonjunction
    node[label={[font=\footnotesize]above:d}] {};
  \draw (0,0)
    to[C=$C$,*-*] (-1.732,1)
    node[label={[font=\footnotesize]above:b}] {};
  \draw (0,0)
    to[L=$L$,*-*] (0,-2)
    node[label={[font=\footnotesize]east:c}] {};
\end{tikzpicture}
\end{document}
1
  • Thank you very much for the work, sergej! This works, I tried it. For this reason, I upvoted (only need to gain enough rep). However, AboAmmars solution is way simpler (maybe slightly worse, but it doesn't produce all the clutter, so I think I'll accept it instead). Thank you again though!
    – Daniel
    Jul 29, 2015 at 22:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .