我需要画一条看起来像
这是我的讲师用来表示约瑟夫森结的符号。我在 Google 上搜索了一下,它似乎是这种元素的常用符号,因此,如果能在 circuitikz 中实现它,那将非常有用。
我使用pgfplots
以及tikzexternalize
,这迫使我使用启动circuitikz环境\begin{tikzpicture}
,如果这有任何区别的话。
编辑(根据评论中的要求):我想使用之间的元素A和d在以下电路中:
\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}
答案1
使用circuitikz
称为的本机符号barrier
:
\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}
答案2
您可以创建自己的组件,这里有一个示例,但它可能需要进行一些调整:
您可以使用以下方式调整宽度和高度:
\ctikzset{bipoles/josephsonjunction/height/.initial=.30} % box height
\ctikzset{bipoles/josephsonjunction/width/.initial=.30} % box width
...并使用以下线宽:
\pgfsetlinewidth{3\pgfstartlinewidth}
代码:
\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}