答案1
\documentclass{minimal}
\usepackage{circuitikz}
\begin{document}
\ctikzset{bipoles/length=.6cm}
\newcommand\esymbol[1]{\begin{circuitikz}
\draw (0,0) to [#1] (1,0); \end{circuitikz}}
This is a battery \esymbol{battery1} and this is a resistor \esymbol{resistor}
\end{document}
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{circuits.ee.IEC}
\begin{document}
% Define a command for drawing dipole symbols with a bit of wire on
either end
\newcommand\esymbol[1]{\tikz[circuit ee IEC] \draw (0,0) -- (.1,0) node
[#1,anchor=west,name=s] {} (s.east) -- +(.1,0);}
This is a battery \esymbol{battery}
\end{document}
答案2
这些符号可能包含在某些包中(在旁边circuitikz
),但它们也很容易根据规则构建。
\documentclass{article}
\usepackage{graphicx}
\newcommand{\resistor}{%
\rule[3pt]{5pt}{.4pt}\hspace*{-.5pt}%
\rotatebox[origin=l]{ 75}{\rule[4.5pt]{ 5pt}{.4pt}}\hspace*{- 9pt}%
\rotatebox[origin=c]{-75}{\rule[4.5pt]{10pt}{.4pt}}\hspace*{-.4pt}%
\rotatebox[origin=c]{ 75}{\rule[4.5pt]{10pt}{.4pt}}\hspace*{- 9pt}%
\rotatebox[origin=c]{-75}{\rule[4.5pt]{10pt}{.4pt}}\hspace*{-.4pt}%
\rotatebox[origin=c]{ 75}{\rule[4.5pt]{10pt}{.4pt}}\hspace*{- 9pt}%
\rotatebox[origin=c]{-75}{\rule[4.5pt]{10pt}{.4pt}}\hspace*{-.4pt}%
\rotatebox[origin=r]{ 75}{\rule[4.5pt]{ 5pt}{.4pt}}\hspace*{-4.7pt}%
\rule[3pt]{5pt}{.4pt}%
}
\newcommand{\battery}{%
\rule[3pt]{6pt}{.4pt}%
\rule{1pt}{6pt}\hspace*{1pt}%
\rule[-1pt]{.5pt}{8pt}%
\rule[3pt]{6pt}{.4pt}%
}
\begin{document}
The symbol of a resistor is \resistor{} and that of a battery is \battery.
\end{document}