I am working on a paper and I need in the introduction to put a diagram. The diagram is the following (or something similar) and I was wondering how can I reproduce it in LaTeX code.
2 Answers
Using Andrew Stacey's purpose-built tqft
library:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{tqft}
\begin{document}
\begin{tikzpicture}[tqft/cobordism/.style={draw},tqft/every boundary component/.style={draw}]
\pic [tqft/pair of pants];
\end{tikzpicture}
There are many customization options as well as other shapes and connection methods, if you need a substantial number of these diagrams. You may refer to the manual for complete details.
A TikZ solution:
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,0) ellipse (.5 and .25);
\draw (-1,-2) ellipse (.5 and .25);
\draw (1,-2) ellipse (.5 and .25);
\draw (-.5,0) to[out=-90,in=90] (-1.5,-2);
\draw (.5,0) to[out=-90,in=90] (1.5,-2);
\draw (-.5,-2) to[out=90,in=90] (.5,-2);
\end{tikzpicture}
\end{document}
With some pseudo-3D
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[x={(1cm,0cm)},y={(-.2cm,-.2cm)},z={(0cm,1cm)}]
\draw (0,0,0) circle (.5);
\draw (-1,0,-2) circle (.5);
\draw (1,0,-2) circle (.5);
\draw (-.5,0,0) to[out=-90,in=90] (-1.5,0,-2);
\draw (.5,0,0) to[out=-90,in=90] (1.5,0,-2);
\draw (-.5,0,-2) to[out=90,in=90] (.5,0,-2);
\end{tikzpicture}
\end{document}
-
Thanks a lot. What if I want rotate it? like by 90°. Can Simply I change the coordinates in draw commands, right?– OscarJul 15, 2014 at 14:31
-
Just add
[rotate=90]
to thetikzpicture
environment like in\begin{tikzpicture}[rotate=90]
. Also try reading the TikZ manual (At least chapters 2-7). It contains a vast amount of examples and tutorials. Jul 15, 2014 at 18:42