1

I am drawing a simple power system in a single line diagram and want to define a shape for a transformer, which looks like two partly overlapping circles. I have already defined styles for generators and impedances using \tikzset. By doing this I can easily draw generators and impedances using the node command. However, I haven't figured out how to do this for the transformer as it consists of two circles not one. Does anyone know an easy way to define this transformer shape, such that I can easily create one with the the node command?

Transformer symbol

6
  • 1
    Welcome to TeX.SE! To draw the above figure, you can use very simple TikZ command \draw (0,0) circle (1cm); \draw (0,1) circle (1cm); but please explain more about the size of the shape, how you use the shape, etc. – user156344 Feb 4 '19 at 10:13
  • Hi, thanks for the reply. Your solution is how I do it now, but I was wondering how to define a style for this. I have added more details in my question now. – Sigurd Hofsmo Jakobsen Feb 4 '19 at 11:06
  • 2
    It sounds like you should take a look at circuitikz. Then you can do e.g. \draw (0,0) to[ioosource] (0,2); – StefanH Feb 4 '19 at 11:22
  • Hi, the circuittikz also works :) Many thanks. – Sigurd Hofsmo Jakobsen Feb 4 '19 at 12:10
  • See also tex.stackexchange.com/questions/431334/… – John Kormylo Feb 4 '19 at 15:56
4

A for loop is an answer for you here:

\documentclass{standalone}
\usepackage{tikz}
\begin{document}


    \tikzset{
        mycirc/.pic={
            \foreach \w in {0,1} {
                \draw (0,\w) circle (1cm);
            }
        }
    }

    \begin{tikzpicture}
    \pic at (2,2) {mycirc};
    \end{tikzpicture}
\end{document}

which will give you:

enter image description here

Even you can change the design choices of your transformers:

\documentclass{standalone}
\usepackage{tikz}
\begin{document}


    \tikzset{
        main/.style ={circle, inner sep=0pt, minimum size=0.6cm, dashed},
        mycirc/.pic={
            \foreach \w in {0,1} {
                \draw[main] (0,\w) circle (1cm);
            }
        }
    }

    \begin{tikzpicture}
    \pic at (2,2) {mycirc};
    \end{tikzpicture}
\end{document}

which will give you:

enter image description here

5
  • Hi, many thanks. Your solution looks exactly, like what I was thinking about. One question. Is it possible to change your code such that I can draw the shape using the following command: \node[mycirc] (pos) {};. For the generator shape I get this behavior, when I write .style where you have written .pic. – Sigurd Hofsmo Jakobsen Feb 4 '19 at 12:08
  • @SigurdHofsmoJakobsen It will not work (I think), because, it is not a style instead it is a picture ;) But if you want to draw it with mypic then you need to define a custom macro for that purpose (which is out-of-scope of this question here :D). [off-topic] IMHO, it is an over-kill :D – Raaja_is_at_topanswers.xyz Feb 4 '19 at 12:16
  • Ok, many thanks. Yes, I don't want to define a custom macro, it does seem a bit overkill ;P. Anyway, your proposal work fine for my purpose :) – Sigurd Hofsmo Jakobsen Feb 4 '19 at 12:27
  • Ofc, I just didn't know it was a button for that. – Sigurd Hofsmo Jakobsen Feb 4 '19 at 12:37
  • 1
    No problems, now you know :) Happy TeXing :D or must I say TikZing :D – Raaja_is_at_topanswers.xyz Feb 4 '19 at 12:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.