将 circuitikz 规范放入序言中的命令,以便全局使用它

将 circuitikz 规范放入序言中的命令,以便全局使用它

我正在尝试对 circuitikz 规范进行全局更改。我设法使用许多命令来实现这一点,但我很难使两个命令成为全局命令:(1) 变换形状 (2) 线宽命令

\documentclass{report}

% CircuiTikz
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage[european]{circuitikz}
\ctikzset{tripoles/nmos/width=.4}
\ctikzset{tripoles/nmos/base height=.45}
\ctikzset{tripoles/pmos/width=.4}
\ctikzset{tripoles/pmos/base height=.45}
\ctikzset{tripoles/mos style/arrows}
\ctikzset{tripoles/pmos style/nocircle}
\ctikzset{tripoles/thickness=1}
\ctikzset{grounds/thickness=1}
\ctikzset{resistors/scale=0.55}
\ctikzset{inductors/scale=0.55}
\ctikzset{capacitors/scale=0.6}
\ctikzset{sources/scale=.8}
\ctikzset{bipoles/thickness=1}
  
\begin{document}

\centering
\begin{circuitikz}[transform shape,line width=1pt]
    %Coordinate system
    %\draw [help lines] (0,0) grid (6,3);

    %Compontents
    \draw (0,2) to [V_=$U$] (0,1);
    \draw (2,2.8) to [C=$C$,i^= $I_C$] (2,.2);
    \draw (4,2.8) to [R=$R$,i^= $I_R$] (4,.2);
    \draw (6,2.8) to [L=$L$] (6,1.5) to [R=$R$] (6,0.2);

    %wiring
    \draw (0,2) to (0,3) to [short, i^= $I$] (2,3) to (2,2.8);
    \draw (2,3) node[circ]{} -| (4,2.8);
    \draw (4,3) to [short, *-, i^= $I_{LR}$] (6,3) to (6,2.8);
    \draw (6,.2) |- (4,0) node[circ]{} to (4,.2);
    \draw (4,0) to [short,-*] (2,0) to (2,.2);
    \draw (2,0) -| (0,1);
    
\end{circuitikz}

\end{document}

电路示例(其实并不重要): 在此处输入图片描述

答案1

软件包circuitikz基于tikzpackage,因此您可以在前言中插入:

\tikzset{every picture/.style = {transform shape, line width=1pt}}

MWE:

\documentclass{report}

% CircuiTikz
\usepackage[european]{circuitikz}
\ctikzset{tripoles/nmos/width=.4}
\ctikzset{tripoles/nmos/base height=.45}
\ctikzset{tripoles/pmos/width=.4}
\ctikzset{tripoles/pmos/base height=.45}
\ctikzset{tripoles/mos style/arrows}
\ctikzset{tripoles/pmos style/nocircle}
\ctikzset{tripoles/thickness=1}
\ctikzset{grounds/thickness=1}
\ctikzset{resistors/scale=0.55}
\ctikzset{inductors/scale=0.55}
\ctikzset{capacitors/scale=0.6}
\ctikzset{sources/scale=.8}
\ctikzset{bipoles/thickness=1}

\usetikzlibrary{positioning}
\tikzset{every picture/.style = {transform shape,line width=1pt}} % <---

\begin{document}

\centering
\begin{circuitikz}
    %Coordinate system
    %\draw [help lines] (0,0) grid (6,3);

    %Compontents
    \draw (0,2) to [V_=$U$] (0,1);
    \draw (2,2.8) to [C=$C$,i^= $I_C$] (2,.2);
    \draw (4,2.8) to [R=$R$,i^= $I_R$] (4,.2);
    \draw (6,2.8) to [L=$L$] (6,1.5) to [R=$R$] (6,0.2);

    %wiring
    \draw (0,2) to (0,3) to [short, i^= $I$] (2,3) to (2,2.8);
    \draw (2,3) node[circ]{} -| (4,2.8);
    \draw (4,3) to [short, *-, i^= $I_{LR}$] (6,3) to (6,2.8);
    \draw (6,.2) |- (4,0) node[circ]{} to (4,.2);
    \draw (4,0) to [short,-*] (2,0) to (2,.2);
    \draw (2,0) -| (0,1);

\end{circuitikz}

\end{document}

在此处输入图片描述

相关内容