5

Here is a short compilable example

\documentclass{article}
\usepackage{tikz}
\usepackage{circuitikz}

\begin{document}
    \begin{circuitikz}
        \draw node[ground]{} to [short,*-] (0,0) to [C] (0,2) to [short,-*] (0,2);
        \node[xshift=1.75cm](0,0){$ \leftarrow $ Start ground here};
    \end{circuitikz}
\end{document}

which produces

enter image description here

The question is: How do you draw the first line of the ground in the marked point? The CircuiTikZ documentation for the node ground does not define an anchor in that exact position.

2 Answers 2

7

Although I suspect this is a kind of XY problem, no, there is no provision (for now) for a tailless ground symbol. It is quite straightforward to define one, though:

\documentclass{article}
\usepackage[RPvoltages]{circuitikz}

\makeatletter
\pgf@circ@declareground{myground}{0.6}{0.4}{
    \pgfsetlinewidth{\ctikzvalof{monopoles/ground/thickness}\pgfstartlinewidth}
    \pgfpathmoveto{\pgfpoint{-.6\pgf@circ@res@step}{0pt}}
    \pgfpathlineto{\pgfpoint{.6\pgf@circ@res@step}{0pt}}
    \pgfpathmoveto{\pgfpoint{-.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
    \pgfpathlineto{\pgfpoint{.4\pgf@circ@res@step}{-0.2\pgf@circ@res@step}}
    \pgfpathmoveto{\pgfpoint{-.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
    \pgfpathlineto{\pgfpoint{.25\pgf@circ@res@step}{-0.4\pgf@circ@res@step}}
    \pgfusepath{draw}
}
\makeatother

\begin{document}
    \begin{circuitikz}
        \draw (0,0) node[ground]{} to [C, *-*] (0,2);
        \node[xshift=1.75cm](0,0){$ \leftarrow $ Start ground here};
        \draw (4,0) node[myground]{} to [C, *-*] (4,2);
    \end{circuitikz}
\end{document}

tailless ground

Note that I also simplified out your zero-length short.

3
  • It works like a charm. Now, the Vcc connection would have the same implementation to behave as this custom ground? I don't know how to read latex macros
    – Martín
    Jun 18, 2019 at 19:41
  • vcc is just an arrow, see in the manual. Since yesterday's update it is configurable, but no, it's not tailless either. You can substitute it with a simple arrows (see the manual for TikZ arrows) if you don't like it. But again, I am unsure why do you want it. If you look at the second tutorial in the manual, you can find a much better way to have the grounds (or Vcc) on the same line in a more flexible way.
    – Rmano
    Jun 18, 2019 at 20:01
  • 1
    BTW, now this component (called tlground for tailless ground) is int the development version. Will be standard from 0.9.2 onward (due in a few days).
    – Rmano
    Jun 21, 2019 at 11:08
4

You can just shift the ground up a little, if you don't mind overlapping the tail.

\documentclass{standalone}
\usepackage{tikz}
\usepackage{circuitikz}

\newlength{\kludge}

\begin{document}
    \begin{circuitikz}
        \kludge=\ctikzvalof{monopoles/ground/width}\csname pgf@circ@Rlen\endcsname
        \draw (0,0) node[ground,yshift=1.2\kludge]{} to [C,*-*] (0,2);
        \node[right=0.5\kludge]{$ \leftarrow $ Start ground here};
    \end{circuitikz}
\end{document}

You must log in to answer this question.

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