这是我的 tikzpicture 的标准环境:
\documentclass{standalone}
\usepackage{pgf,tikz}
\usetikzlibrary{mindmap,shadows,positioning,fit,petri,backgrounds,shapes,arrows,through,calc,decorations.text,decorations.markings,intersections,fpu,circuits.ee.IEC,babel}
%Einstellungen von siunitx nach pgf übertragen
\SendSettingsToPgf
%%package ciruitikz is based on TikZ
\usepackage[straightvoltages,%uses arrows to define voltages, and and uses straight voltage arrows
european,%equivalent to europeancurrents, europeanvoltages, europeanresistors, europeaninductors, europeanports, europeangfsurgearrester
emptydiode,%the various diodes are drawn but not filled by default, i.e. when using styles such as D, sD, …Other diode styles can always be forced with e.g. Do, D-, …
RPvoltages,%(meaning Rising Potential voltages): the arrow is in direction of rising potential, like in oldvoltagedirection, but batteries and current sources are fixed to follow the passive/active standard
betterproportions,%nicer proportions of transistors in comparision to resistors;
compatibility%makes it possibile to load CircuiTikZ and TikZ circuit library together
]{circuitikz}
\tikzset{circuit declare annotation={HorizontalAnnotation}{0pt}{edge[to path={[-]
($(-0.5,-0.5\tikzcircuitssizeunit)+(0,-0.5\pgflinewidth)$) --
($( 0.5,-0.5\tikzcircuitssizeunit)+(0,-0.5\pgflinewidth)$)}] ()}
}
\tikzset{circuit declare symbol=fuse, set fuse graphic={
draw, circuit symbol size=width 4 height 1, HorizontalAnnotation},
transform shape
}
\begin{document}
\begin{tikzpicture}[circuit ee IEC]
\draw (0,1.0) to [resistor] (3,1.0) node [right] {resistor};
\draw (0,0.5) to [fuse] (3,0.5) node [right] {fuse};
\draw (0,0.5) to [fuse] (0,-2) to [fuse] (3,0.5);
\end{tikzpicture}
\end{document}
我从中学到使用 TikZ 融合符号 我必须在文档头中添加此代码来绘制保险丝:
\tikzset{circuit declare annotation={HorizontalAnnotation}{0pt}{edge[to path={[-]
($(-0.5,-0.5\tikzcircuitssizeunit)+(0,-0.5\pgflinewidth)$) --
($( 0.5,-0.5\tikzcircuitssizeunit)+(0,-0.5\pgflinewidth)$)}] ()}
}
\tikzset{circuit declare symbol=fuse, set fuse graphic={
draw, circuit symbol size=width 4 height 1, HorizontalAnnotation},
transform shape
}
到目前为止一切顺利。但我在正常的 tikzpicture 环境中需要符号“fuse”,换句话说,我想编译这个主体:
\begin{document}
\begin{tikzpicture}
\draw (0,1.0) to [resistor] (3,1.0) node [right] {resistor};
\draw (0,0.5) to [fuse] (3,0.5) node [right] {fuse};
\draw (0,0.5) to [fuse] (0,-2) to [fuse] (3,0.5);
\end{tikzpicture}
\end{document}
注意,我将“\begin{tikzpicture}[circuit ee IEC]”更改为“\begin{tikzpicture}”,因为我的正常环境是包“circuitikz”。如何在没有[circuit ee IEC]的情况下在我的环境中绘制保险丝?
答案1
circuitikz
提供自己的fuse
:
\documentclass{standalone}
\usepackage{pgf,tikz}
\usetikzlibrary{mindmap,shadows,positioning,fit,petri,backgrounds,shapes,arrows,through,calc,decorations.text,decorations.markings,intersections,fpu,circuits.ee.IEC,babel}
%Einstellungen von siunitx nach pgf übertragen
%\SendSettingsToPgf
%%package ciruitikz is based on TikZ
\usepackage[straightvoltages,%uses arrows to define voltages, and and uses straight voltage arrows
european,%equivalent to europeancurrents, europeanvoltages, europeanresistors, europeaninductors, europeanports, europeangfsurgearrester
emptydiode,%the various diodes are drawn but not filled by default, i.e. when using styles such as D, sD, …Other diode styles can always be forced with e.g. Do, D-, …
RPvoltages,%(meaning Rising Potential voltages): the arrow is in direction of rising potential, like in oldvoltagedirection, but batteries and current sources are fixed to follow the passive/active standard
betterproportions,%nicer proportions of transistors in comparision to resistors;
% compatibility%makes it possibile to load CircuiTikZ and TikZ circuit library together
]
{circuitikz}
\begin{document}
\begin{tikzpicture}
\draw (0,1.0) to [resistor] (3,1.0) node [right] {resistor};
\draw (0,0.5) to [fuse] (3,0.5) node [right] {fuse};
\draw (0,0.5) to [fuse] (0,-2) to [fuse] (3,0.5);
\end{tikzpicture}
\end{document}