Circuitikz 不同的接地符号

Circuitikz 不同的接地符号

可以让 circuitikz 画出不同的接地符号吗?我想要一个只有一条水平线的接地符号。谢谢。

答案1

最简单的方法是自己画线,就像 Thanos 建议的那样。您也可以重新定义 circuitikz 接地代码或添加新的接地符号。以下是示例:

\documentclass{standalone}
\usepackage{circuitikz}
\makeatletter
\pgfdeclareshape{ground}{
\anchor{center}{
    \pgfpointorigin
}
\behindforegroundpath{      
    \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen

    \pgfscope       
        \pgfpathmoveto{\pgfpointorigin}
        \pgfpathlineto{\pgfpoint{0pt}{-\pgf@circ@res@step}}
        \pgfusepath{draw}

        \pgfsetlinewidth{6\pgflinewidth} % thickness

        \pgfpathmoveto{\pgfpoint{-\pgf@circ@res@step}{-\pgf@circ@res@step}}
        \pgfpathlineto{\pgfpoint{\pgf@circ@res@step}{-\pgf@circ@res@step}}
        \pgfusepath{draw}                       
    \endpgfscope
    }
}
\makeatother

\begin{document}
\begin{circuitikz}[american voltages]
\draw 
(0,0) node [ground] {}
      to [V] (0,2)
;
\end{circuitikz}
\end{document}

您可以在注释为“厚度”的行中更改该值,甚至可以使用自然值(即 3pt)。

在此处输入图片描述

答案2

你可以手动完成,只需在特定点添加一条线即可。以下代码生成

\begin{figure}[H]
\centering

\begin{tikzpicture}
\node [cylinder, gray,fill=gray!30, rotate=0, draw,
    minimum height=5cm, minimum width=2.5cm] (c){Ανιχνευτής Αερίου};
  \draw[red,-] (-2,0) -- (2.5,0);
  \draw[gray,fill=gray, path fading=south] (2.45,0) ellipse (0.15cm and 0.8cm);
%  \draw [-] (0,-1.25) arc [radius=2cm, start angle=0, end angle=90];
  \draw[gray,dashed] (-2,-1.25) arc (-30:30:2.5cm);
  \node at (-2,-0.03) (O) {$\bullet$};
  \draw[black,-] (-2,0) -- (-3,0);
  \draw (-3,0.2) -- (-3,-0.2);
  \draw (-3,0.2) -- (-3.3,0);
  \draw (-3,-0.2) -- (-3.3,0);
  \draw (1,-1.25) -- (1,-1.7);

  \draw (0.8,-1.7) -- (1.2,-1.7);
  \draw (0.85,-1.75) -- (1.15,-1.75);
  \draw (0.9,-1.8) -- (1.1,-1.8);
 \draw (0.95,-1.85) -- (1.05,-1.85);

    \draw (-2.5,0) -- (-2.5,1.5);
    \node at (-2.5,1.5) (O) {$\bullet$};

%  text
  \draw[red] (0,0.1) node[above right] {\footnotesize Κάθοδος};
  \draw (-1.9,0.8) node[above right] {\footnotesize Άνοδος};
  \draw[gray] (2.8,0) node[above right] {\footnotesize Παράθυρο};
  \draw[gray] (2.8,-0.3) node[above right] {\footnotesize Ανιχνευτή};
  \draw[black] (-4,0) node[above right] {\footnotesize Σήμα};
  \draw[red] (-2.7,1.5) node[above right] {\footnotesize $+V_0$};
%  \draw[red, -] (c.top)   -- (c.bottom)
%    node [at end, below, black]   {height};
%  \draw[red, <->] (c.north) -- (c.south)
%    node [at start, above, black] {width};
\end{tikzpicture}
\label{fig:gasDetector}
\caption{Βασική δομή ανιχνευτή αερίου}
\end{figure}

这应该是最简单但又最不正统的方法!希望对你有帮助!

相关内容