如何在 tikz 电路库中反转电池极性

如何在 tikz 电路库中反转电池极性

我找不到在circuitikz图书馆!肯定有办法!有人能指出正确的方向吗?

答案1

  • 对于反转,只需改变源节点和目标节点,即可以相反的方向绘制组件。
  • 如果有信息标签,请更改infoinfo'或反之。

以下是一个例子:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC, positioning}
\begin{document}
\begin{tikzpicture}[
    circuit ee IEC,
    every info/.style = {font = \scriptsize},
    set make contact graphic = var make contact IEC graphic,
  ]
  \node [contact]                              (left contact)    {};
  \node [contact, right = 3cm of left contact] (middle contact)  {};
  \node [contact, right = 3cm of middle contact] (right contact) {};
  \draw (left contact)  to [battery = {info = {battery}}]
        (middle contact);
  \draw (right contact) to [battery = {info' = {reversed battery}}]
        (middle contact);
\end{tikzpicture}
\end{document}

电池和反接电池

答案2

您可以使用“反转”来改变电池极性

\documentclass{article}
\usepackage{circuitikz}
\begin{document}
\begin{circuitikz}
    \draw  (0,0) to [battery1] (3,0);             % without invert
    \draw  (0,-2) to [battery1, invert] (3,-2);   % with invert
\end{circuitikz}
\end{document}

在此处输入图片描述

相关内容