-1

I am trying to make a picture like this in LaTeX. Any ideas how I would do this?

Sebastiano
  • 54,118
fdzsfhaS
  • 259
  • 3
  • You can use GeoGebra to make a picture and export it as TikZ/PsTricks/eps/png/svg. It is a free and powerful program, can be used even online. It is free for any platform – user83382 May 02 '20 at 19:35
  • 1
    Use an interactive graphic editor (Inkscape, for example) and do such picture in it. Then export it as SVG and convert it to PDF. The PDF format can be included into a TeX document. – wipet May 02 '20 at 19:39
  • 1
    Do not use external tools. This picture is extremely easy to get with the spy library, which is described e.g. in @Jojo's link. That way you typeset the formulae precisely as in the ambient LaTeX document. –  May 02 '20 at 19:41

1 Answers1

5

Apart from the fact that there is no MWE, I think this is in principle an interesting question. As pointed out by Jojo, one can use spy here. However, there are two slightly nontrivial aspects:

  1. How can one connect the spy nodes by tangents?
  2. How can one spy on a spy node?

The first subquestion has been addressed here but I simplified the answer quite a bit using this observation. Now one can use

 \spy [size=1cm,tangent connect] on (0,0)   in node [below] at (1,-1);

to get the tangent connection. As for the second subquestion, I'd assume that the answer is well known but I did not find this simple answer on this site (nor elsewhere): just use different scopes. Of course, I may just have missed it. Anyway, here is a code. (Needless to say that I do not understand the axis labeling.)

\documentclass[tikz,border=3mm]{standalone}
\usepackage{dsfont}% you can also use amsfonts but I personally like
    % the dsfont double-stroke letters a little  bit better
\usetikzlibrary{calc,spy}
\begin{document}
\begin{tikzpicture}[spy using outlines={circle, magnification=4,size=2cm,connect spies},
    tangent connect/.style={spy connection path={
    \draw[thin] let \p1=(tikzspyonnode.center),\p2=(tikzspyonnode.north),
        \p3=(tikzspyinnode.center),\p4=(tikzspyinnode.north),
        \n1={atan2(\y3-\y1,\x3-\x1)}, % slope between circle centers
        \n2={veclen(\y3-\y1,\x3-\x1)},
        \n3={atan2(\y4-\y3-\y2+\y1,\n2)} % additional slope because of different radii
    in
    (tikzspyonnode.\n3+\n1+90) -- (tikzspyinnode.\n3+\n1+90)
    (tikzspyonnode.-\n3+\n1-90) -- (tikzspyinnode.-\n3+\n1-90);}}]
 \begin{scope}[spy using outlines={circle, magnification=4,size=2cm,connect spies}] 
  \draw[-stealth] (-2.5,0) -- (5,0) node[right]{$-x^2$};
  \draw[-stealth] (0,-1.5) -- (0,1.5)node[left]{$\mathds{C}$};
  \draw[trig format=rad] plot[domain=-2.5:4.6,smooth,samples=151] 
     (\x,{0.5*sin(pi*\x)});
  \spy [size=1cm,tangent connect] on (0,0)  in node [below] at (1,-1);  
  \spy [size=1cm,tangent connect] on (4.5,0.5)  in node  at (5.5,1.3);  
 \end{scope} 
 \spy [size=1cm,tangent connect] on (5.5,1.3)   in node  at (6.8,1.6);  
\end{tikzpicture}
\end{document}

enter image description here

And things that are not in the (inner) spy scope do not get spied on by the (inner) spies. (Of course here things are particularly easy as everything is black so the drawing order does not matter. In more complicated settings one may need to use layers, which is somewhat nontrivial in the context of spy.)

\documentclass[tikz,border=3mm]{standalone}
\usepackage{dsfont}% you can also use amsfonts but I personally like
    % the dsfont double-stroke letters a little  bit better
\usetikzlibrary{calc,spy}
\begin{document}
\begin{tikzpicture}[spy using outlines={circle, magnification=4,size=2cm,connect spies},
    tangent connect/.style={spy connection path={
    \draw[thin] let \p1=(tikzspyonnode.center),\p2=(tikzspyonnode.north),
        \p3=(tikzspyinnode.center),\p4=(tikzspyinnode.north),
        \n1={atan2(\y3-\y1,\x3-\x1)}, % slope between circle centers
        \n2={veclen(\y3-\y1,\x3-\x1)},
        \n3={atan2(\y4-\y3-\y2+\y1,\n2)} % additional slope because of different radii
    in
    (tikzspyonnode.\n3+\n1+90) -- (tikzspyinnode.\n3+\n1+90)
    (tikzspyonnode.-\n3+\n1-90) -- (tikzspyinnode.-\n3+\n1-90);}}]
 \begin{scope}[spy using outlines={circle, magnification=4,size=2cm,connect spies}] 
  \draw[trig format=rad] plot[domain=-2.5:4.6,smooth,samples=151] 
     (\x,{0.5*sin(pi*\x)});
  \spy [size=1cm,tangent connect] on (0,0)  in node [below] at (1,-1);  
  \spy [size=1cm,tangent connect] on (4.5,0.5)  in node  at (5.5,1.3);  
 \end{scope} 
 \draw[-stealth] (-2.5,0) -- (5,0) node[right]{$-x^2$};
 \draw[-stealth] (0,-1.5) -- (0,1.5)node[left]{$\mathds{C}$};
 \spy [size=1cm,tangent connect] on (5.5,1.3)   in node  at (6.8,1.6);  
\end{tikzpicture}
\end{document}

enter image description here