I want to draw Olympic rings and used the code from here, which is,

% Olympic rings
% Author: Paul Gaborit
   \clip (-6,2) rectangle (6,-.9);
   \foreach \col/\xp/\yp in {
     r5/4/0, r4/2/-1.8, r3/0/0,
     r2/-2/-1.8, r1/-4/0
   } {
     \path[draw=white,line width=.08cm,
     fill=\col,even odd rule]
     (\xp, \yp) circle (1.9cm)
     (\xp, \yp) circle (1.5cm);
   \clip (-6,-.9) rectangle (6,-3.8);
   \foreach \col/\xp/\yp in {
     r1/-4/0, r2/-2/-1.8, r3/0/0,
     r4/2/-1.8, r5/4/0
   } {
     \path[draw=white,line width=.08cm,
     fill=\col,even odd rule]
     (\xp, \yp) circle (1.9cm)
     (\xp, \yp) circle (1.5cm);

But I am getting a faint straight line in the middle of the PDF file. You can see the line in the lower half of the black ring properly. How to remove this?

enter image description here

I have tried the solution suggested by Paul Gaborit in Improve PSTricks code for drawing of the Olympic flag, but the problem is still there. I am running pdflatex on my code. By any chance is it creating the faint line in the middle of the image?


Here is the output I am getting by using Heiko Oberdiek's suggestion and running Latex + dvips + ps2pdf on the following code,

\nofiles % .aux file is not needed


\definecolor{color@A}{cmyk}{1, .25, 0, 0}
\definecolor{color@B}{cmyk}{0, .342, .91, 0}
\definecolor{color@C}{cmyk}{0, 0, 0, 1}
\definecolor{color@D}{cmyk}{1, 0, .91, .06}
\definecolor{color@E}{cmyk}{0, .94, .65, 0}

    use Hobby shortcut,
    every path/.style = {
      line width      = \whitelinewidth,
      double distance = \colorlinewidth,
    % define center coordinates for the five rings
      (0,0) coordinate (center@A)
      ++(\xshift, 0) coordinate (center@C)
      ++(\xshift, 0) coordinate (center@E)
      ($(center@A)!.5!(center@C)$) ++(0, \yshift) coordinate (center@B)
      ++(\xshift, 0) coordinate (center@D)
    % \drawring draws the first part of the ring with blank parts
        save Hobby path = {path@#1},
        double          = {color@#1},
        +([closed] 225:\radius) .. +([#2] 315:\radius) ..
        +([#3] 45:\radius) .. +([#4] 135:\radius)
    % \finishring draws the blank parts of the rings
        double                     = {color@#1},
        restore and use Hobby path = {path@#1}{
          invert soft blanks
    % set calculated bounding box
      let \n{r} = {\radius + \colorlinewidth/2}
        (center@A) +(-\n{r}, \n{r}) % upper left corner
        (center@B -| center@E) +(\n{r}, -\n{r}) % lower right corner

The output I get is,

enter image description here

Please notice that each ring contains two faint lines except the green one.

  • 3
    See the last answer here: Improve PSTricks code for drawing of the Olympic flag – CarLaTeX Aug 7 '16 at 7:04
  • @CarLaTeX I tried that but the faint line in the middle is still there. I am running pdflatex on my code. By any chance is it creating the line? – ddas Aug 7 '16 at 7:08
  • A short LaTeX/TikZ version: Olympic Games Logo - Free Style Edition – Heiko Oberdiek Aug 7 '16 at 7:10
  • @HeikoOberdiek Thanks. The solution is not working. I am getting two faint lines in each ring except the green one. – ddas Aug 7 '16 at 7:22
  • 1
    @HeikoOberdiek, ddas, congratulations for your sharp eyes, I had to enlarge the picture 10 times to be able to see the faint lines! Unfortunately I can't help ddas, I hope some expert will do it! – CarLaTeX Aug 7 '16 at 8:02

Version, which uses uninterrupted circles (without faint lines), where the gaps are created by clipping. This solution does not use any white background color. The measurements and colors are taken from my answer in Programming Puzzles & Code Golf.

\nofiles % .aux file is not needed


\definecolor{color@A}{cmyk}{1, .25, 0, 0}    % blue
\definecolor{color@B}{cmyk}{0, .342, .91, 0} % yellow
\definecolor{color@C}{cmyk}{0, 0, 0, 1}      % black
\definecolor{color@D}{cmyk}{1, 0, .91, .06}  % green
\definecolor{color@E}{cmyk}{0, .94, .65, 0}  % red

% Radii
\pgfmathsetlengthmacro{\InnerColorRadius}{\Radius - \ColorLineWidth/2}
\pgfmathsetlengthmacro{\OuterColorRadius}{\Radius + \ColorLineWidth/2}
\pgfmathsetlengthmacro{\InnerWhiteRadius}{\InnerColorRadius - \WhiteLineWidth}
\pgfmathsetlengthmacro{\OuterWhiteRadius}{\OuterColorRadius + \WhiteLineWidth}

% Positions of circle centers
\pgfmathsetlengthmacro{\xC}{\xA + \xShift}
\pgfmathsetlengthmacro{\xE}{\xC + \xShift}
\pgfmathsetlengthmacro{\xB}{(\xA + \xC)/2}
\pgfmathsetlengthmacro{\yB}{\xA + \yShift}
\pgfmathsetlengthmacro{\xD}{(\xC + \xE)/2}

% Bounding Box
\pgfmathsetlengthmacro\llxBB{\xA - \OuterColorRadius}
\pgfmathsetlengthmacro\llyBB{\yB - \OuterColorRadius}
\pgfmathsetlengthmacro\urxBB{\xE + \OuterColorRadius}
\pgfmathsetlengthmacro\uryBB{\yE + \OuterColorRadius}

% Clipping box (a little larger as bounding box)
\pgfmathsetlengthmacro\llxClip{\llxBB - 1pt}
\pgfmathsetlengthmacro\llyClip{\llyBB - 1pt}
\pgfmathsetlengthmacro\urxClip{\urxBB + 1pt}
\pgfmathsetlengthmacro\uryClip{\uryBB + 1pt}

    line width=\ColorLineWidth,
      (\llxClip, \llyClip) rectangle (\urxClip, \uryClip)
      ($(#1,#2) + (#3:\OuterWhiteRadius)$)
      arc(#3:#4:\OuterWhiteRadius) --
      ($(#1,#2) + (#4:\InnerWhiteRadius)$)
      arc(#4:#3:\InnerWhiteRadius) --
    % Upper rings
    \begin{scope}[even odd rule]
        % Gap by yellow ring in blue ring
        % Gap by yellow ring in black ring
        \Gap(\xB, \yB)(90:45)
        % Gap by green ring in black ring
        \Gap(\xD, \yD)(225:135)
        % Gap by green ring in red ring
        \Gap(\xD, \yD)(90:45)
      \draw[color@A] (\xA, \yA) circle;
      \draw[color@C] (\xC, \yC) circle;
      \draw[color@E] (\xE, \yE) circle;
    % Lower rings
    \begin{scope}[even odd rule]
        % Gap by blue ring in yellow ring
        \Gap(\xA, \yA)(45:-45)
        % Gap by black ring in yellow ring
        \Gap(\xC, \yC)(225:270)
        % Gap by black ring in green ring
        \Gap(\xC, \yC)(45:-45)
        % Gap by red ring in green ring
        \Gap(\xE, \yE)(225:270)
      \draw[color@B] (\xB, \yB) circle;
      \draw[color@D] (\xD, \yD) circle;
    \useasboundingbox (\llxBB, \llyBB) rectangle (\urxBB, \uryBB);


  • 1
    When you zoom in the PNG image, you can see a ton of green around the yellow circle. Is this normal/expected? Is this present in the "original" output (PDF/rendered on screen)? – Ismael Miguel Aug 7 '16 at 13:48
  • 1
    @IsmaelMiguel It's an artifact from the conversion from PDF to PNG (maybe some anti-aliasing effect with the alpha channel). The updated answer now uses an image, generated by GIMP. The PDF file is fine, as you can also see from the TeX source. – Heiko Oberdiek Aug 7 '16 at 15:11
  • To be very honest, I know nearly nothing about TeX. It looks like beautiful Chinese to me. I just noticed the weird green around the yellow circle and though it could have slipped through the cracks and be a tiny bug on your code or some glitch on the output. The new image is "fixed" (it wasn't broken before, just the weird green) and seems fine by me. – Ismael Miguel Aug 7 '16 at 15:44
  • @IsmaelMiguel The problem seems to be caused by Ghostscript. The image with the wrong colors at the borders of the rings was created by Ghostscript 9.19 under Cygwin. On a Linux machine the colors looked right with Ghostscript 9.16. – Heiko Oberdiek Aug 7 '16 at 17:14
  • Maybe you should file a bug? – Ismael Miguel Aug 7 '16 at 17:16

This seems like a perfect problem to use the tikz library knots on! The current solution is improved from the original, which had some minor "clipping issues" (for more info, see here). I consider this solution quite elegant because the code is very simple, clear and short.

\begin{knot}[clip width=1.4,clip radius=0.3cm]
    \strand[line width=0.25cm,red1] (3,0) circle(1.25cm);
    \strand[line width=0.25cm,green1] (1.5,-1.375) circle(1.25cm);
    \strand[line width=0.25cm,black1] (0,0) circle(1.25cm);
    \strand[line width=0.25cm,yellow1] (-1.5,-1.375) circle(1.25cm);
    \strand[line width=0.25cm,blue1] (-3,0) circle(1.25cm);

The result is:

enter image description here


A PSTricks solution with the latest pstricks-add http://comedy.dante.de/~herbert/texnik/tex/generic/pstricks-add/pstricks-add.tex Available in a couple of days on CTAN: Run with xelatex:




enter image description here

  • Did you notice the blue and black borders, where the yellow circle is lying on top of those circles? I think it appears at every intersection but these intersections provide the highest contrast. – Stefan Aug 9 '16 at 8:44
  • @Stefan I think that's an artefact of the conversion to bitmap rather than fundamental to the vector graphic. – andybuckley Aug 9 '16 at 19:45
  • 1
    @andybuckley Actually, it is a problem in the PDF renderer (I tested texstudio and evince). The rims are created as two thin white circles/arcs to hide the lower circle. Although the coordinates are correct, the renderer leaves a tiny optical gap, where the underlying circle is visible. – Stefan Aug 10 '16 at 5:30
  • Ahh, I see: didn't go through the code in that detail. Awkward! – andybuckley Aug 10 '16 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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