3

In block scheme I like to add a node with call out shape, which contain details of electronic circuit. This electronic circuit is easy to draw with circutikz package. Here is my attempt to achieve this goal:

\documentclass[tikz,border=3mm]{standalone}
    \usetikzlibrary{positioning,%
                    shapes,shapes.callouts%
                    }
    \usepackage{fouriernc}
    \usepackage[scaled=0.83]{helvet}
    \usepackage[scaled=0.82]{luximono}
    \usepackage{marvosym,pifont}

    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
%---------------------------------------------------------------%
\usepackage[european,siunitx]{circuitikz}
\usepackage{siunitx}
\sisetup{detect-family,
     color = teal!40!black}
%---------------------------------------------------------------%
    \begin{document}
\begin{tikzpicture}
\coordinate (a) at (0,0);
\coordinate (b) at (4,0);
\draw (1,-0.1) -- (1,0.1);
\draw (2,-0.1) -- (2,0.1);
\draw (3,-0.1) -- (3,0.1);
    \draw[ultra thick,*-*] (a) -- (b);
\node[shape=rectangle callout,
      draw, rounded corners,
      callout pointer width=3.3 mm,
      callout pointer shorten=-2mm,
      font=\sffamily\footnotesize,
      align=center,
      callout absolute pointer={(b)},
      scale=0.5] at ([xshift=19mm,yshift=3mm] b)
    {termination circuit\\
    \begin{circuitikz}[sharp corners]
\draw[ultra thick, blue] plot[smooth,domain=-0.25*pi:-0.75*pi, samples=36] (0.25*pi+\x,{-1*sin(2*\x r)});
\draw[ultra thick, red]  plot[smooth,domain=-0.25*pi:-0.75*pi, samples=36] (0.25*pi+\x,{+1*sin(2*\x r)});
\draw[ultra thick, red]  plot[smooth,domain=-0.75*pi:-1.25*pi, samples=36] (0.25*pi+\x,{+1*sin(2*\x r)});
\draw[ultra thick, blue] plot[smooth,domain=-0.75*pi:-1.25*pi, samples=36] (0.25*pi+\x,{-1*sin(2*\x r)});
\draw   (0,3)   node[right] {\SI{+5}{V}}
    to [R=$R_s$,o-] (0,+1)  node[right] {A}
    to [R=$R_k$,*-*] (0,-1) node[right] {B}
    to [R=$R_s$, -o] (0,-3)
                node[right] {\SI{0}{V}};
    \end{circuitikz}
    };
\node[shape=rectangle callout,
      draw, rounded corners,
      callout pointer width=3.3 mm, 
      callout pointer shorten=-2mm,
      font=\sffamily\footnotesize, 
      align=center,
      callout absolute pointer={(a)},
      scale=0.5] at ([xshift=-19mm,yshift=3mm] a)
    {termination circuit\\
    \begin{circuitikz}[sharp corners]
\draw[ultra thick, blue] plot[smooth,domain=-0.25*pi:-0.75*pi, samples=36] (0.25*pi+\x,{-1*sin(2*\x r)});
\draw[ultra thick, red]  plot[smooth,domain=-0.25*pi:-0.75*pi, samples=36] (0.25*pi+\x,{+1*sin(2*\x r)});
\draw[ultra thick, red]  plot[smooth,domain=-0.75*pi:-1.25*pi, samples=36] (0.25*pi+\x,{+1*sin(2*\x r)});
\draw[ultra thick, blue] plot[smooth,domain=-0.75*pi:-1.25*pi, samples=36] (0.25*pi+\x,{-1*sin(2*\x r)});
\draw   (0,3)   node[right] {\SI{+5}{V}}
    to [R=$R_s$,o-] (0,+1)  node[right] {A}
    to [R=$R_k$,*-*] (0,-1) node[right] {B}
    to [R=$R_s$, -o] (0,-3)
                node[right] {\SI{0}{V}};
    \end{circuitikz}
    };
\end{tikzpicture}
    \end{document}

Questions:

  • why both nodes are not the same (as I expected);
  • why I receive error "unknown function 'south (in south east)' if I use for positioning of node possibilities offered by positioning library?

    \node[shape=rectangle callout, draw, rounded corners, callout pointer width=3.3 mm, callout pointer shorten=-2mm, font=\sffamily\footnotesize, align=center, callout absolute pointer={(a)}, scale=0.5, above left=-19mm and 3mm of a] {content of node};

enter image description here

Edit: I correct a bit my preamble where by mistake I had \usepackage{circuitikz} twice. The second one should be siunitx wit added setup. I like to have labels of resistors in sans sheriff font, but this hasn't happen. I do not knoe why not, but this is not a issue of this questionseparate question.

1 Answer 1

5

You are using circuitikz inside a node. The circuitikz environment is nothing but a tikzpicture environment in disguise. Using tikzpicture inside a node is not a good idea and it will cause odd things. You can use a box instead. I have created \mycircuita and \mycircuitb boxes (with 0 and 20V) and used them inside the callout node.

\documentclass[tikz,border=3mm]{standalone}
    \usetikzlibrary{positioning,%
                    shapes,shapes.callouts%
                    }
    \usepackage{fouriernc}
    \usepackage[scaled=0.83]{helvet}
    \usepackage[scaled=0.82]{luximono}
    \usepackage{marvosym,pifont}

    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
%---------------------------------------------------------------%
\usepackage[european,siunitx]{circuitikz}
\usepackage{circuitikz}
%---------------------------------------------------------------%
\newsavebox{\mycircuita}
\sbox{\mycircuita}{%
\begin{circuitikz}[sharp corners]
\draw[ultra thick, blue] plot[smooth,domain=-0.25*pi:-0.75*pi, samples=36] (0.25*pi+\x,{-1*sin(2*\x r)});
\draw[ultra thick, red]  plot[smooth,domain=-0.25*pi:-0.75*pi, samples=36] (0.25*pi+\x,{+1*sin(2*\x r)});
\draw[ultra thick, red]  plot[smooth,domain=-0.75*pi:-1.25*pi, samples=36] (0.25*pi+\x,{+1*sin(2*\x r)});
\draw[ultra thick, blue] plot[smooth,domain=-0.75*pi:-1.25*pi, samples=36] (0.25*pi+\x,{-1*sin(2*\x r)});
\draw   (0,3)   node[right] {\SI{+5}{V}}
    to [R=$R_s$,o-] (0,+1)  node[right] {A}
    to [R=$R_k$,*-*] (0,-1) node[right] {B}
    to [R=$R_s$, -o] (0,-3)
                node[right] {\SI{0}{V}};
    \end{circuitikz}
    }
\newsavebox{\mycircuitb}
\sbox{\mycircuitb}{%
\begin{circuitikz}[sharp corners]
\draw[ultra thick, blue] plot[smooth,domain=-0.25*pi:-0.75*pi, samples=36] (0.25*pi+\x,{-1*sin(2*\x r)});
\draw[ultra thick, red]  plot[smooth,domain=-0.25*pi:-0.75*pi, samples=36] (0.25*pi+\x,{+1*sin(2*\x r)});
\draw[ultra thick, red]  plot[smooth,domain=-0.75*pi:-1.25*pi, samples=36] (0.25*pi+\x,{+1*sin(2*\x r)});
\draw[ultra thick, blue] plot[smooth,domain=-0.75*pi:-1.25*pi, samples=36] (0.25*pi+\x,{-1*sin(2*\x r)});
\draw   (0,3)   node[right] {\SI{+5}{V}}
    to [R=$R_s$,o-] (0,+1)  node[right] {A}
    to [R=$R_k$,*-*] (0,-1) node[right] {B}
    to [R=$R_s$, -o] (0,-3)
                node[right] {\SI{20}{V}};
    \end{circuitikz}
    }

\begin{document}
\begin{tikzpicture}
\coordinate (a) at (0,0);
\coordinate (b) at (4,0);
\draw (1,-0.1) -- (1,0.1);
\draw (2,-0.1) -- (2,0.1);
\draw (3,-0.1) -- (3,0.1);
    \draw[ultra thick,*-*] (a) -- (b);
\node[shape=rectangle callout,
      draw, rounded corners,
      callout pointer width=3.3 mm,
      callout pointer shorten=-2mm,
      font=\sffamily\footnotesize,
      align=center,
      callout absolute pointer={(b)},
      scale=0.5] at ([xshift=19mm,yshift=3mm] b)
    {termination circuit\\
\usebox{\mycircuita}
    };
\node[shape=rectangle callout,
      draw, rounded corners,
      callout pointer width=3.3 mm,
      callout pointer shorten=-2mm,
      font=\sffamily\footnotesize,
      align=center,
      callout absolute pointer={(a)},
      scale=0.5] at ([xshift=-19mm,yshift=3mm] a)
    {termination circuit\\
    \usebox{\mycircuitb}
    };
\end{tikzpicture}
    \end{document}

As an alternative, you could also use pic facility of tikz but using a box is simpler in this case.

enter image description here

4
  • Thank you for fast response. Your solution solve most of the my problems, but I wonder it is possible to define content of \mycircuit locally, somewhere at tikzpicture (inside or till before)? I like to use this savebox for more similar cases in other tikz figures and like to have their definitions of content locally at the tikpictures.
    – Zarko
    Commented Jan 18, 2015 at 0:45
  • Harish Kumar, yes, I can do this, but I have all my picture saved in different folders ... in picture are included in document which also included in main document: So I afraid that I will have problems with the paths (images is from my textbook). I need to think about how to organize and save those boxes.
    – Zarko
    Commented Jan 18, 2015 at 0:52
  • I'm familiar with namening of boxes, zhis not make me problems :-). Now I found temporary solution how to manage problem of storing this boxes. I can have them as part of standalon figure and inclede generated pdf file with \includegraphics instead to include it directly with \input and compile it again with document or main document.
    – Zarko
    Commented Jan 18, 2015 at 1:09
  • @Zarko That is always an option. But then you have to be careful about the size of figures included ;)
    – user11232
    Commented Jan 18, 2015 at 1:11

You must log in to answer this question.

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