# Tikz: Once punctured torus?

I want to draw a once punctured torus which looks like this:

I already draw some parts of the graph:

\documentclass[10.5pt,a4paper]{article}
\usepackage{tikz}

\begin{document}

\begin{center}
\begin{tikzpicture}

%Hole
\begin{scope}[scale=0.8]
\path[rounded corners=24pt] (-.9,0)--(0,.6)--(.9,0) (-.9,0)--(0,-.56)--    (.9,0);
\draw[rounded corners=28pt] (-1.1,.1)--(0,-.6)--(1.1,.1);
\draw[rounded corners=24pt] (-.9,0)--(0,.6)--(.9,0);
\end{scope}
%Cut 1
\draw[densely dashed,red] (0,-1.3) arc (270:90:.2 and 0.550);
\draw[red,->] (0,-1.3) arc (-90:90:.2 and .550);
%Cut 2
\draw[blue,->] (0,0) ellipse (1.5 and 0.8);
\node at (0.19,-0.79) {$\textbf{.}$};
\node at (0.4,-1) {$x_0$};
\node at (-0.4,1) {$\textcolor{blue}{\gamma_1}$};
\node at (-0.4,-0.5) {$\textcolor{red}{\gamma_2}$};
%Cut 3
\draw[] (3,-0.5) arc (270:90:.2 and 0.550);
\draw[] (3,-0.5) arc (-90:90:.2 and .550);

\end{tikzpicture}

\end{center}

\end{document}


Which gave me

but I have no idea how to draw the contour of the torus. Any ideas?

• Have you seen our Loop Space' TikZ package/library tqft library ? – percusse Jul 14 '15 at 14:19
• I didn't know this package and I will have to draw some pants decomposition, thanks a lot! – Julien Roussillon Jul 14 '15 at 20:13

## 2 Answers

Using the aforementioned tqft package:

\documentclass{standalone}
%\url{http://tex.stackexchange.com/q/255318/86}
\usepackage{tikz}
\usetikzlibrary{tqft}

\begin{document}
\begin{tikzpicture}[rotate=90]
\pic[
transform shape,
name=a,
tqft,
cobordism edge/.style={draw},
incoming boundary components=0,
outgoing boundary components=2,
];
\draw[red] (a-outgoing boundary 1.center) to[out=90,in=90,looseness=1.25] (a-outgoing boundary 2.center) to[out=-90,in=-90,looseness=1.25] (a-outgoing boundary 1.center);
\pic[
transform shape,
tqft,
cobordism edge/.style={draw},
every outgoing boundary component/.style={draw,red!50!black},
incoming upper boundary component 2/.style={draw,blue},
incoming lower boundary component 2/.style={draw,dotted,blue},
incoming boundary components=2,
outgoing boundary components=1,
offset=.5,
at=(a-outgoing boundary),
anchor=incoming boundary,
];
\end{tikzpicture}
\end{document}


• Thanks for your reply. This package will be very useful when I will draw some pants decompositions! – Julien Roussillon Jul 15 '15 at 11:14

See page 753 of the TikZ manual.

\documentclass[border=.1in]{standalone}
\usepackage{tikz}
\usepackage{mathtools}

\begin{document}
\begin{minipage}{4in}
\begin{center}
\begin{tikzpicture}
%Hole
\begin{scope}[scale=0.8]
\path[rounded corners=24pt] (-.9,0)--(0,.6)--(.9,0) (-.9,0)--(0,-.56)--    (.9,0);
\draw[rounded corners=28pt] (-1.1,.1)--(0,-.6)--(1.1,.1);
\draw[rounded corners=24pt] (-.9,0)--(0,.6)--(.9,0);
\end{scope}
%Cut 1
\draw[densely dashed,red] (0,-1.3) arc (270:90:.2 and 0.550);
\draw[red,->] (0,-1.3) arc (-90:90:.2 and .550);
%Cut 2
\draw[blue] (1.0605,0.5656) arc (45:315:1.5 and 0.8);
\draw[blue] (1.0605,0.5656) to[out=-28.1,in=200] (3,.6);
\draw[blue] (1.0605,-0.5656) to[out=28.1,in=160] (3,-.5);
\node at (0.19,-0.79) {$\textbf{.}$};
\node at (0.4,-1) {$x_0$};
\node at (-0.4,1) {$\textcolor{blue}{\gamma_1}$};
\node at (-0.4,-0.5) {$\textcolor{red}{\gamma_2}$};
%Cut 3
\draw[] (3,-0.5) arc (270:90:.2 and 0.550);
\draw[] (3,-0.5) arc (-90:90:.2 and .550);
\end{tikzpicture}
\end{center}

An ellipse is given by
$\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$
where $a$ and $b$ are the respective radii for $x$ and $y$.
From
$y = b\sqrt{1-x^2/a^2}$
we see that the slope at point $(x,y)$ is given by
\begin{align*}
\frac{dy}{dx} &= - \frac{bx}{a^2} \left(1-x^2/a^2\right)^{-1/2} \\
&= - \frac{b^2x}{a^2y} \quad.
\end{align*}
So for $a=1.5$, $b=.8$, $x=1.0605$ and $y=0.5656$ we get a slope of
$-0.5333$ or an angle of about $-28.1^\circ$.
\end{minipage}
\end{document}


• Page 753 of my user guide does not show this. Which version are you using? – Sigur Jul 14 '15 at 17:31
• Search for the "To path library" for how to connect points using curves. – John Kormylo Jul 14 '15 at 23:16
• I supposed that the picture was there as an example. Also, the circle \gamma_2 needs to be corrected. It is not on the surface. – Sigur Jul 15 '15 at 8:20
• Thanks for your reply! I modified a little your code to have something like the first image of the topic. – Julien Roussillon Jul 15 '15 at 11:16
• @Sigur - I couldn't tell if that was deliberate or not. – John Kormylo Jul 15 '15 at 15:35