1

Is it possible to change the CircuiTikz ground symbols to look more like the IEC 60417 ground symbols?

enter image description here

1
  • From what I can tell, the standard is not for schematics but rather for labels to be applied to equipment. Mar 20, 2018 at 13:50

1 Answer 1

2

Yes, it is!

I changed the coordinates and line widths a little to make it look more similar:

enter image description here

The symbols you ask for are all monopoles, and they are defined in the file pgfcircmonopoles.tex.

Here is the code for the redefined monopoles:

\makeatletter
\pgfdeclareshape{ground}{
  \anchor{center}{
    \pgfpointorigin
  }
  \behindforegroundpath{
    \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen
    \pgfscope
      \pgfstartlinewidth=\pgflinewidth
      \pgfsetlinewidth{2\pgflinewidth}
      \pgfpathmoveto{\pgfpointorigin}
      \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
      \pgfusepath{draw}
      \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
      \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
      \pgfusepath{draw}
      \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
      \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
      \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
      \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
      \pgfusepath{draw}
      \pgfsetlinewidth{\pgfstartlinewidth}
    \endpgfscope
  }
}

\pgfdeclareshape{nground}{
  \anchor{center}{
    \pgfpointorigin
  }
  \behindforegroundpath{
    \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen
    \pgfscope
      \pgfstartlinewidth=\pgflinewidth
      \pgfsetlinewidth{2\pgflinewidth}
      \pgfpathmoveto{\pgfpointorigin}
      \pgfpathlineto{\pgfpoint{0pt}{-1.2\pgf@circ@res@step}}
      \pgfusepath{draw}
      \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
      \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
      \pgfusepath{draw}
      \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
      \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
      \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
      \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
      \pgfusepath{draw}
      \pgfpathmoveto{\pgfpoint{0.9\pgf@circ@res@step}{-1.6\pgf@circ@res@step}}
      \pgfpatharc{0}{180}{0.9\pgf@circ@res@step}
      \pgfusepath{draw}
      \pgfsetlinewidth{\pgfstartlinewidth}
    \endpgfscope
  }
}

\pgfdeclareshape{pground}{
  \anchor{center}{
    \pgfpointorigin
  }
  \behindforegroundpath{
    \pgf@circ@res@step=\ctikzvalof{monopoles/ground/width}\pgf@circ@Rlen
    \pgfscope
      \pgfsetlinewidth{2\pgflinewidth}
      \pgfstartlinewidth=\pgflinewidth
      \pgfpathmoveto{\pgfpointorigin}
      \pgfpathlineto{\pgfpoint{0pt}{-1\pgf@circ@res@step}}
      \pgfusepath{draw}
      \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
      \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{-1\pgf@circ@res@step}}
      \pgfusepath{draw}
      \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
      \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-1.2\pgf@circ@res@step}}
      \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
      \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-1.4\pgf@circ@res@step}}
      \pgfusepath{draw}
      \pgfpathcircle{\pgfpoint{0pt}{-0.75\pgf@circ@res@step}}{0.9\pgf@circ@res@step}
      \pgfusepath{draw}
      \pgfsetlinewidth{\pgfstartlinewidth}
    \endpgfscope
  }
}

\pgfdeclareshape{cground}{
\anchor{center}{
    \pgfpointorigin
}
\behindforegroundpath{
    \pgf@circ@res@step=\ctikzvalof{monopoles/chassis/width}\pgf@circ@Rlen
    \pgfscope
      \pgfstartlinewidth=\pgflinewidth
      \pgfsetlinewidth{2\pgflinewidth}
      \pgfpathmoveto{\pgfpointorigin}
      \pgfpathlineto{\pgfpoint{0pt}{-1.5\pgf@circ@res@step}}
      \pgfusepath{draw}
      \pgfpathmoveto{\pgfpoint{-1.00\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
      \pgfpathlineto{\pgfpoint{-0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
      \pgfpathlineto{\pgfpoint{ 0.75\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
      \pgfpathlineto{\pgfpoint{ 0.50\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
      \pgfpathmoveto{\pgfpoint{ 0.00\pgf@circ@res@step}{-1.50\pgf@circ@res@step}}
      \pgfpathlineto{\pgfpoint{-0.25\pgf@circ@res@step}{-2.10\pgf@circ@res@step}}
      \pgfusepath{draw}
      \pgfsetlinewidth{\pgfstartlinewidth}
    \endpgfscope
    }
}
\makeatother

You can save this as, say, newmonopoles.tex, and just \input{newmonopoles}. Or you can simply paste this code in your .tex file.

Here is the example document I showed above:

\documentclass{article}

\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}

\usepackage{circuitikz}

\begin{document}
\pagenumbering{gobble}

CircuiTi\emph{k}Z versions:\hfill
\begin{tabularx}{0.6\textwidth}{*{4}{C}}
\tikz\draw (0,0) node [ground] {};&
\tikz\draw (0,0) node [nground] {};&
\tikz\draw (0,0) node [pground] {};&
\tikz\draw (0,0) node [cground] {};
\end{tabularx}

\input{newmonopoles}

ISO 7000/IEC 60417:\hfill
\begin{tabularx}{0.6\textwidth}{*{4}{C}}
\tikz\draw (0,0) node [ground] {};&
\tikz\draw (0,0) node [nground] {};&
\tikz\draw (0,0) node [pground] {};&
\tikz\draw (0,0) node [cground] {};
\end{tabularx}

\end{document}
6
  • as fa as i can see, the main differences are in number of "ground" lines (four in circuitikz, and only three in standard. i would consider this as bug (symbols should consider ISO/IEC standards).
    – Zarko
    Mar 20, 2018 at 11:48
  • @Zarko Indeed, the differences are minimal. Only a few minor tweaks were needed to make them look like the picture the OP posted. I don't see it as a bug, though. The standards (made by reasonable people) don't demand petty minimalisms like line width and such, so the symbols in CircuiTikZ are pretty much obey the standard. The changes I made were basically aesthetic to match the ones the OP asked for :) Mar 20, 2018 at 11:57
  • you improve aesthetic appearance of symbols, but they still not comply with standard. standard are rigid with purpose (here is small difference, but with this symbol you can not design label for some equipment. label on equipment with such symbol will not pass compliance test for any of ISO/IEC standard). authors of package should be warned about this.
    – Zarko
    Mar 20, 2018 at 12:10
  • @Zarko Well, here in Brazil we don't use ISO/IEC (we use something that I prefer not to mention by name :P), so I can't really say anything precise about this. In this case, could you inform the authors of CircuiTikZ then? Mar 20, 2018 at 12:14
  • i doubt in this. all your electrical goods, which you exported, should complain at least to this standards :-). i will try to write to author of package.
    – Zarko
    Mar 20, 2018 at 12:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .