0

Good evening!

I am writing a presentation on Riesz's lemma and I am blocking on the drawing of these figures with Tikz package

enter image description here enter image description here enter image description here

, I ask for your help please.

Zbigniew
  • 2,292

1 Answers1

3

IMHO you should really try a bit on your own.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{fit,shapes.geometric}
\begin{document}
\begin{tikzpicture}[bullet/.style={circle,fill,inner sep=2pt}]
 \draw[very thick,blue,fill=blue!10] (-6,-3) rectangle (6,3) 
    node[below right]{$X$};
 \draw[very thick,green!70!black,fill=green!10] (-4.8,-1) rectangle (4.8,2.8)
 node[below right]{$Y$};
 \draw[very thick,red,fill=red,fill opacity=0.1] (0,0)  circle[radius=2cm];
 \draw[very thick] (-120:2) node[bullet,label=below:$x_0$] (x0){} 
 -- ++ (120:3.5) node[midway,below left]{$\|x_0-y\|>1-\varepsilon$} 
 node[bullet,purple,label=above:$y$](y){};
 \draw[thick,orange] (x0) -- (x0|-0,-1) node[midway,right]{$1-\varepsilon$};
\end{tikzpicture}
%
\begin{tikzpicture}[bullet/.style={circle,fill,inner sep=2pt}]
 \draw (0,0) node[bullet,label=below:$x$] (M){}
  node[circle,draw,very thick,blue,dashed,minimum
  size=2cm,label={right:$B(x,r)$}] (C) {}; 
 \draw[thick,yellow!80!black] (M) -- ++ (110:2) node[near end,left] {$d$} coordinate (aux);
 \draw[very thick,cyan] (aux) ++(200:2)coordinate(aux2) 
  -- ++(20:4) node[pos=1.05] (Y){$Y$};
 \draw[red,very thick] (M) -- (20:1) node[midway,above]{$r$};
 \node[draw,red!80!black,very thick,ellipse,fit=(C)(Y)(aux2),minimum width=10cm,
 label={[red!80!black]20:$X$}]{};
\end{tikzpicture}
%
\begin{tikzpicture}[bullet/.style={circle,fill,inner sep=2pt}]
 \draw (0,0) node[bullet,label=below:$x$] (M){}
  node[circle,draw,very thick,blue,dashed,minimum
  size=2cm,label={right:$B(x,r)$}] (C) {}; 
 \draw[thick,yellow!80!black] (M) -- ++ (110:2) node[near end,left] {$d$} coordinate (aux);
 \draw[very thick,cyan] (aux) ++(200:2)coordinate(aux2) 
  -- ++(20:4) node[pos=0.6,bullet,green!50!yellow,label=above:$y^*$]{}  
  coordinate[pos=0.7] (P) node[pos=1.05] (Y){$Y$};
 \draw[red,very thick] (M) -- (20:1) node[midway,above]{$r$};
 \node[draw,red!80!black,very thick,ellipse,fit=(C)(Y)(aux2),minimum width=10cm,
 label={[red!80!black]20:$X$}]{};
 \draw[thick,orange] (M) -- (P) node[right,near end]{$d/(1-\varepsilon)$};
\end{tikzpicture}
\end{document}

enter image description here

  • Thank you very much for your precious help! – Zbigniew Jul 07 '19 at 21:29
  • 1
    I did not downvote, but just want to comment that in general a short explanation of code would be better than a somehow patronizing "IMHO you should really try a bit on your own." You dump complete code that helps the OP today, but doesn't teach long-term. – Stefan Kottwitz Jul 08 '19 at 09:13
  • @StefanKottwitz The long term goal is what? Could you please explain it to me? IMHO the pgfmanual has a stellar tutorial. I do not see much point in attaching it to every answer I am writing. So the best I can do is to provide working codes in the form of complete compilable MWE's that contain everything that is needed here. Didactic examples for each single command here can be found in the pgf manual. If one does not understand a command, all one needs to do is to look it up there. –  Jul 08 '19 at 09:20
  • @StefanKottwitz The alternative approach is to close each of the questions of this type as a duplicate of https://tex.stackexchange.com/q/15779/121799. This approach is pursued by users whom I highly respect. If you feel that this is the right approach, I will respect this opinion, but will not necessarily follow this rule because I, too, learn from explicit example. What I am certainly not going to do is to explain every single command that is already explained nicely and much better than I could do in the pgf manual. –  Jul 08 '19 at 09:23
  • @marmot We are not the pgfmanual. A long term goal of our site is to help people to learn. We do it on site, and in q&a format. Not in a manual style. (and we are not a code factory but you are free to produce code) – Stefan Kottwitz Jul 08 '19 at 09:27
  • @StefanKottwitz I do share this aim but do not think that we agree on the way to arrive there. There are specific questions on, say, "How can I fit an ellipse around some objects?", which are the questions I tend to upvote, and to combine the answers with an explanation. Then there are questions which some refer to as "do-it-for-me". which I interpret as the request to achieve some specific output. I do learn from the answers to these questions because these are explicit examples. However, I do not think they need to come with specific explanations. –  Jul 08 '19 at 10:00