I am making notes on the subject and I have to make too many figures of the following kind. How do I do this?
Asked
Active
Viewed 3,118 times
5
MrPajeet
- 673
-
The short answer is to use a package like tikz. I should warn you however that some people take exception to questions of the form "Please draw this for me". You will get more help if you post some code showing what you have tried and give a minimal working example. – Sep 09 '16 at 05:20
-
1I am new to latex and I don't know how to draw anything. With an example I can start tweaking and learn to draw figures of this type. – MrPajeet Sep 09 '16 at 05:23
-
There are hundreds of different examples in the manual, and also here on the site. While not exactly your image, some inspiration can probably be found in How to draw this figure in a better way (mapping between domains)? and tikz diagram showing range, domain, and co-domain of a function and Drawing a mapping between arbitrary domains – Torbjørn T. Sep 09 '16 at 07:03
-
Which manual are you talking about? – MrPajeet Sep 09 '16 at 07:31
-
Oops, sorry, was kind of following Andrew's comment: TikZ's manual. – Torbjørn T. Sep 09 '16 at 14:51
2 Answers
3
To draw a manifold you can use plot coordinates with smooth option, and you can play with the tension parameter. Or you can use the hobby package.
To draw a hole you can use the arc command.
Here is a starting example :
\documentclass[tikz,border=7mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[smooth cycle,tension=.7] plot coordinates{(-1,0) (0.5,2) (2,2) (4,3) (4.5,0)};
\coordinate (A) at (1,1);
\draw (A) arc(140:40:1) (A) arc(-140:-20:1) (A) arc(-140:-160:1);
\end{tikzpicture}
\end{document}
Kpym
- 23,002
3
An alternative tool is Metapost with lualatex and the luamplib package.
Here's a routine to draw manifolds as general randomised ellipses. Drawing labels, arrows, and boxes, etc is covered in the manuals and tutorials linked above. As a bonus I've added the torus hole too.
\RequirePackage{luatex85}
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\begin{mplibcode}
vardef manifold(expr a,b,rho) =
(for t=0 upto 7:
right scaled (a+rho*normaldeviate) rotated 45t ..
endfor cycle) yscaled (b/a)
enddef;
randomseed:=1855.10574;
beginfig(1);
path M, N, torus_edge_lower, torus_edge_upper, torus_hole;
M = manifold(90,60,10);
N = manifold(80,80,3) shifted 240 right rotated 10;
torus_edge_lower = quartercircle scaled 80 rotated 225 shifted center M shifted (-25,15);
torus_edge_upper = point 1/3 of torus_edge_lower
{direction 1/3 of torus_edge_lower rotated 80}
.. point 5/3 of torus_edge_lower;
torus_hole = buildcycle(torus_edge_lower,torus_edge_upper);
fill M withcolor .9[blue,white];
unfill torus_hole;
draw M;
draw torus_edge_lower;
draw torus_edge_upper;
label(btex $M$ etex, point 7 of M shifted (-6,16));
fill N withcolor .9[green,white];
draw N;
label(btex $N$ etex, point 7 of N shifted (-6,16));
endfig;
\end{mplibcode}
\end{document}
Thruston
- 42,268

