回转器在端口之间增加水平间隔

回转器在端口之间增加水平间隔

有没有办法在回转器的两个圆圈之间添加水平空间?

\documentclass{article}
\usepackage[english]{babel}
\usepackage[]{circuitikz}

\begin{document}
\begin{circuitikz} 
\draw(0,0) 
    node[gyrator] (G) {}
 (G.A1) node[anchor=east] {A1}
 (G.A2) node[anchor=east] {A2}
 (G.B1) node[anchor=west] {B1}
 (G.B2) node[anchor=west] {B2}
 (G.base) node{};
\end{circuitikz}
\end{document}

在此处输入图片描述

在此处输入图片描述 我想画这个

答案1

您可以修改 中定义的组件的属性pgfcircquadpoles.tex。这是添加 1cm 空间的示例。 变量\Space是为增加空间而定义的。诀窍是将组件的右侧部分向右移动\Space

在此处输入图片描述

\documentclass{standalone}
\usepackage[english]{babel}
\usepackage[]{circuitikz}

\def\Space{1cm}

\makeatletter
\pgfcircdeclarequadpole{gyrator}{

    \def\stretto{.4}

    \pgfpathmoveto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@up}}
    \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@up}}
    \pgfpathlineto{\pgfpoint{\stretto\pgf@circ@res@left}{\pgf@circ@res@down}}
    \pgfpathlineto{\pgfpoint{\pgf@circ@res@left}{\pgf@circ@res@down}}

    \pgfpathmoveto{\pgfpoint{\Space+\pgf@circ@res@right}{\pgf@circ@res@up}}
    \pgfpathlineto{\pgfpoint{\Space+\stretto\pgf@circ@res@right}{\pgf@circ@res@up}}
    \pgfpathlineto{\pgfpoint{\Space+\stretto\pgf@circ@res@right}{\pgf@circ@res@down}}
    \pgfpathlineto{\pgfpoint{\Space+\pgf@circ@res@right}{\pgf@circ@res@down}}

    \pgfusepath{draw}

    \pgfsetlinewidth{2\pgflinewidth}
    \pgfpathmoveto{\pgfpoint{\stretto\pgf@circ@res@left}{.7*\stretto\pgf@circ@res@down}}
    \pgfpatharc{90}{270}{.7*\stretto\pgf@circ@res@down}

    \pgfpathmoveto{\pgfpoint{\Space+\stretto\pgf@circ@res@right}{.7*\stretto\pgf@circ@res@up}}
    \pgfpatharc{-90}{90}{.7*\stretto\pgf@circ@res@down}
    \pgfusepath{draw}

}{}
\makeatother




\begin{document}
\begin{circuitikz} 
\draw(0,0) 
    node[gyrator] (G) {}
 (G.A1) node[anchor=east] {A1}
 (G.A2) node[anchor=east] {A2}
 (G.B1) node[anchor=west,xshift=\Space] {B1}
 (G.B2) node[anchor=west,xshift=\Space] {B2}
 (G.base) node{};
\end{circuitikz}
\end{document}

相关内容