Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm wondering whether is possible to draw a Moebius Strip using TikZ. The closest thing I've seen is in Texamples' page, but no luck so far!

Do you have any ideas? I don't even have a MWE (sorry)

share|improve this question
    
I suggest you to use inkscape to draw it. –  Sigur Jun 10 '13 at 23:25

4 Answers 4

up vote 51 down vote accepted

With PGFPlots:

\documentclass{standalone}


\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
    hide axis,
    view={40}{40}
]
\addplot3 [
    surf, shader=faceted interp,
    point meta=x,
    colormap/greenyellow,
    samples=40,
    samples y=5,
    z buffer=sort,
    domain=0:360,
    y domain=-0.5:0.5
] (
    {(1+0.5*y*cos(x/2)))*cos(x)},
    {(1+0.5*y*cos(x/2)))*sin(x)},
    {0.5*y*sin(x/2)});

\addplot3 [
    samples=50,
    domain=-145:180, % The domain needs to be adjusted manually, depending on the camera angle, unfortunately
    samples y=0,
    thick
] (
    {cos(x)},
    {sin(x)},
    {0});
\end{axis}
\end{tikzpicture}

\end{document}
share|improve this answer
    
Thank you for the marvellous answer! Is it possible to superpose the Moebius strip with the middle circle?, I'd like to highlight that the Moebius strip is based on a circle! :-P Thank you very much. –  Dox Jun 11 '13 at 13:20
    
@Dox: Yes, you can add a second plot for that. Unfortunately, PGFPlots can't do the z buffering for separate plots, so you'll have to set the domain for the circle manually to make sure the hidden parts aren't drawn. –  Jake Jun 11 '13 at 13:47
    
Magnificent! I tried, but got a much less nice than your. Cheers. –  Dox Jun 11 '13 at 14:00
    
@Jake: Why I get a triangular mesh instead of a rectangular mesh as you when I run this code (with pdflatex)? It's all about pgfplots package update or another trick? –  rafaeldf Jun 13 '13 at 16:30
    
@rafaeldf: That could be a viewer issue with the interpolated shading. Does using shader=faceted instead of shade=faceted interp help? –  Jake Jun 13 '13 at 16:49

As a quotient space:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}

\begin{document}

\begin{tikzpicture}[
decoration={
  markings,
  mark=at position 0.5 with {\arrow{>}}}
] 
\draw[postaction=decorate] (0,0) -- (2,0);
\draw (2,0) -- (2,-2);
\draw[postaction=decorate] (2,-2) -- (0,-2);
\draw (0,0) -- (0,-2);
\end{tikzpicture}

\end{document}

enter image description here

And now, taken from MoebiusStrip.tex:

% Title: Moebius Strip
% Tags: Clipping, Node positioning, Shadings, Macros
% Authors: Jacques Duma & Gerard Tisseau
% Site: http://math.et.info.free.fr/TikZ/index.html

\documentclass{article}

\usepackage{tikz}
\usepackage{verbatim}

\begin{comment}
:Title: Moebius Strip
:Tags: Clipping, Node positioning, Shadings, Macros
:Authors: Jacques Duma & Gerard Tisseau
:Site: http://math.et.info.free.fr/TikZ/index.html

To build this Moebius Strip, take a normal strip of paper, write "TikZ for LaTeX" on one side, give it 3 half-twists and join the ends.

The resulting strip has only one face and one boundary.
\end{comment}

% one third of the Moebius Strip
%: \strip{<angle>}
\newcommand{\strip}[1]{%
\shadedraw[very thick,top color=white,bottom color=gray,rotate=#1]
 (0:2.8453) ++ (-30:1.5359) arc (60:0:2)
 -- ++  (90:5) arc (0:60:2) -- ++ (150:3) arc (60:120:2) 
 -- ++ (210:5) arc (120:60:2) -- cycle;}

%: \MoebiusStrip{<text1>}{<text2>}{<text3>}
\newcommand{\MoebiusStrip}[3]{%
\begin{scope} [transform shape]
    \strip{0}
    \strip{120}
    \strip{-120}
    \draw (-60:3.5) node[scale=6,rotate=30] {#1};
    \draw (180:3.5) node[scale=4,rotate=-90]{#3};
    % redraw the first strip after clipping
    \clip (-1.4,2.4)--(-.3,6.1)--(1.3,6.1)--(5.3,3.7)--(5.3,-2.7)--cycle;
    \strip{0}
    \draw (60:3.5) node [gray,xscale=-4,yscale=4,rotate=30]{#2};
\end{scope}}

\begin{document}

\pagestyle{empty}

\begin{center}
\begin{tikzpicture} [rotate=22]
  \MoebiusStrip{Ti{\color{orange}\textit{k}}Z}{for}{\LaTeX}
\end{tikzpicture}
\end{center}

\end{document}

enter image description here

share|improve this answer
6  
+1 for the quotient space solution :) –  Jan Hlavacek Jun 11 '13 at 3:36

enter image description here

As a parametric surface with the Asymptote:

\documentclass{article}
\usepackage[inline]{asymptote}
\begin{document}
\begin{figure}
\centering
\begin{asy}
import graph3;
size(200,IgnoreAspect);
size3(200,IgnoreAspect);
currentprojection=orthographic(camera=(1.5,0.3,2),up=Z,target=(0.5,0,0),zoom=0.8);
real r=2, w=1;
real x(real u, real v){return (r+v/2*cos(3pi*u))*cos(2pi*u);};
real y(real u, real v){return (r+v/2*cos(3pi*u))*sin(2pi*u);};
real z(real u, real v){return (v/2*sin(3pi*u));};
triple f(pair p){return (x(p.x,p.y),y(p.x,p.y),z(p.x,p.y));};
draw(surface(f,(0,-w),(1,w),nu=9,Spline),orange);
\end{asy}
\caption{M\"obius strip.}
\end{figure}
\end{document}
share|improve this answer

With PSTricks. Stolen from Herbert's answer.

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-3dplot}

\begin{document}
\psset{Beta=20}
\begin{pspicture}(-6,-3)(6,4)
\def\Radius{5 }
\parametricplotThreeD[xPlotpoints=100,yPlotpoints=10](0,360)(-1,1){
   t 2 div cos u mul \Radius add t cos mul
   t 2 div cos u mul \Radius add t sin mul
   t 2 div sin u mul }
\pstThreeDCoor[xMin=-1,yMin=-1,zMin=-1]
\parametricplotThreeD[xPlotpoints=100,yPlotpoints=1,
    linecolor=red,linewidth=2pt,arrows=|->](180,-180){
   t 2 div cos \Radius add t cos mul
   t 2 div cos \Radius add t sin mul
   t 2 div sin }
\end{pspicture}

\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.