7

in a prevois question i asked if there was a good way to display electronics symbols in TeX, i was pointed towards circuitikz (which is awsome), but is there a way to inline a symbol in text?

eg.

bla bla bla {symbols} blaa blab bla

Stefan Kottwitz
  • 231,401
Eric Fode
  • 275

1 Answers1

10

Maybe in this case it's easier to use the circuits.ee.IEC library in TikZ instead of circuitikz:

\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 diode \esymbol{diode} and this is a resistor \esymbol{resistor}

\end{document}

Inline circuit symbols


Edit: The following is merged from another answer I wrote:

Similar approach with circuitikz, but the spacing is quite bad:

\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 diode \esymbol{diode} and this is a resistor \esymbol{generic}

\end{document}

inline circuit symbols with circuitikz

Jake
  • 232,450
  • 2
    Perhaps you'd consider merging both your answers into one? – Martin Tapankov Jan 24 '11 at 09:59
  • @Martin
    Is that the preferred thing to do? I figured that, since one method is (in my opinion) superior to the other (which is also reflected by the votes), it would make sense to keep them as separate answers. I'm glad to merge them if that's what's expected, though.
    – Jake Jan 24 '11 at 10:36
  • There are different schools of thought whether this is preferred or not.. but personally I like posts that summarize and contrast different solutions -- even more so when you have written both answers yourself. This is what makes (for me) a good and informative answer that one is happy to upvote, even if not all solutions are equally good. You don't have to merge them, of course -- it's your call. – Martin Tapankov Jan 24 '11 at 10:42
  • 1
    @Martin Fair point. I have merged the answers and deleted the second one. There's a similar situation on this question, where I also wrote two answers. I'll keep those separate, as there have been comments added to both, but I'll keep your advice in mind in the future. – Jake Jan 24 '11 at 10:55