1

I'd like to increase the space around a node to be able to show the text content. In the example below, I want the text "Channel 1" to be visible above node oscopeshape. I've tried nodifiying the node attributes with outer sep without success.

Thanks in advance for your help !

text of node oscopeshape hidden

\documentclass[border=2pt,convert={density=600,outext=.png}]{standalone}
\usepackage[siunitx,RPvoltages]{circuitikz}
\begin{document}

\begin{circuitikz}[american]
\draw(0,0) to[sV,l=$v(t)$] ++(0,3) to[R,l=$R$] ++(4,0) to[C,l=$C$] ++(0,-3) --(0,0);
\ctikzset{bipoles/oscope/width=1.4}
\ctikzset{bipoles/oscope/height=1.0}
\node[oscopeshape, fill=green!10, anchor=south, outer sep=20pt](O1) at (4,4) {$\text{Channel 1}$};
\node[bnc, xscale=-1, anchor=zero](bnc11) at (O1.in 1) {};
\node[bnc, anchor=zero, rotate=-90](bnc12) at (O1.in 2){};
\end{circuitikz}
\end{document}
7
  • 3
    The text is already there, it just can't be seen. Try with \documentclass[convert={density=600,outext=.png},margin=2cm]{standalone} – Ivan Mar 7 at 22:46
  • I deleted my answer, since the comment above naturally solves the issue. – SebGlav Mar 7 at 22:50
  • Thanks everyone for the comments. @Ivan, indeed, that solves my original question (the text is visible now) – Sergio Mar 8 at 11:24
  • 1
    The @SebGlav proposal was to add the text as an extra node, like \node[above =2pt of O1] {Channel 1}; --- that will take into account the size automatically – Rmano Mar 8 at 11:34
  • 1
    As a rationale for the behavior, in circuitikz the geographical anchors do not change when the node text is outside the component (it's evident in transistors too). This is a design decision, to enable the alignement of components independently from the labels. Normally works ok, sometimes it bites you like in this case. – Rmano Mar 8 at 11:38
1

Use border={2pt 2pt 2pt 12pt}:

\documentclass[border={2pt 2pt 2pt 12pt},convert={density=600,outext=.png}]{standalone}
\usepackage[siunitx,RPvoltages]{circuitikz}
\begin{document}
 
 \begin{circuitikz}[american]
  \draw(0,0) to[sV,l=$v(t)$] ++(0,3) to[R,l=$R$] ++(4,0) to[C,l=$C$] ++(0,-3) --(0,0);
  \ctikzset{bipoles/oscope/width=1.4}
  \ctikzset{bipoles/oscope/height=1.0}
  \node[oscopeshape, fill=green!10, anchor=south, outer sep=20pt](O1) at (4,4) {$\text{Channel 1}$};
  \node[bnc, xscale=-1, anchor=zero](bnc11) at (O1.in 1) {};
  \node[bnc, anchor=zero, rotate=-90](bnc12) at (O1.in 2){};
 \end{circuitikz}
\end{document}

enter image description here

2
  • 2
    @SebGlav Could you please undelete your solution? – Ivan Mar 8 at 11:33
  • I did but I doubt it's relevant since the problem here was clearly related to the border/margins. – SebGlav Mar 8 at 17:40
1

EDIT: As per request, I undeleted my solution, which is kind of a cheat, but with which you don't have to take care of the margins.

Does something like that suit you?

\documentclass[border=2pt,convert={density=600,outext=.png}]{standalone}
\usepackage[siunitx,RPvoltages]{circuitikz}
\usetikzlibrary{positioning}

\begin{document}
    \begin{circuitikz}[american]
        \draw(0,0) to[sV,l=$v(t)$] ++(0,3) to[R,l=$R$] ++(4,0) to[C,l=$C$] ++(0,-3) --(0,0);
        \ctikzset{bipoles/oscope/width=1.4}
        \ctikzset{bipoles/oscope/height=1.0}
        \node[oscopeshape, fill=green!10](O1) at (4,4) {};
        \node[above =2pt of O1] {Channel 1};
        \node[bnc, xscale=-1, anchor=zero](bnc11) at (O1.in 1) {};
        \node[bnc, anchor=zero, rotate=-90](bnc12) at (O1.in 2){};
    \end{circuitikz}
\end{document}

oscilo

1
  • 1
    I don't think it's a cheat: it is what I would use in this case, short of adding a fake "path" instruction. The problem is that the margin are miscalculated because the circuitikz text for the scope node is invisible to TikZ bounding box calculation routine; your solution makes it "visible". +1 – Rmano Mar 8 at 18:30

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.