9

There are 5 white regions bounded by the ellipse and character R as shown in the following figure.

I want to fill EACH of these regions with a UNIQUE/DIFFERENT/DISTINGUISHABLE color.

How to do this in either PSTricks or TikZ?

enter image description here

\documentclass[border=0pt]{standalone}

\usepackage{pstricks}

\begin{document}
    \begin{pspicture}[showgrid=false](4,6)
        \begin{psclip}{\psellipse[linestyle=none](2,3)(2,3)}
            \rput(2,3){\psscalebox{21}{R}}
        \end{psclip}
        \psellipse(2,3)(2,3)
    \end{pspicture}
\end{document}
  1. Please don't suggest me to replace the character border with a new object by tracing it such as using \pscurve, \psbezier, or the like.

  2. Please don't suggest me to use a tool provided by vector or raster graphics editors as shown in the following screenshot.

    enter image description here

9
  • Can you provide a TikZ version as well?
    – Jake
    Commented Jul 20, 2012 at 12:06
  • 1
    Do you want a solution for this specific R clipped by this ellipse? Or do you want a solution for any character from any font clipped by any closed curve? Commented Jul 20, 2012 at 12:18
  • @HiggsBoson: So, use Inkscape with Latin Modern font to produce this particular case and to fill each of these five regions. Commented Jul 20, 2012 at 12:24
  • Do you want different colors for each region? Or the same in all?
    – egreg
    Commented Jul 20, 2012 at 13:27
  • 1
    Do you have an actual application where you need this, or is it a purely academic question?
    – Jake
    Commented Jul 20, 2012 at 15:01

1 Answer 1

13
+50

enter image description here

You need to use a grid

  \draw[help lines,step=.2] (-1.4,-2) grid (1.4,2); 

To get

 \documentclass[11pt]{scrartcl}
 \usepackage{tikz}

 \begin{document}
 \begin{tikzpicture}
 \begin{scope}
     \draw[ultra thick] (0,0) ellipse[ x radius=1.2cm,y radius=2cm]  ;
     \clip (0,0) ellipse [x radius=1.2cm,y radius=2cm]  ;
     \fill[green] (0,0) ellipse [x radius=1.2cm,y radius=2cm]  ;      
     \fill[orange] (-1.4,-2) rectangle (-0.8,2);
     \fill[blue] (-1.4,1.5) -- (0.2,1.5) -- (1.2,0.8) -- (1.2,2) --(-1.2,2) -- cycle;
     \fill[yellow] (-0.75,1.5) -- (0.2,1.5) -- (0.8,1) -- (0.6,0.2) --(0.2,0) -- (-0.75,0) -- cycle; 
     \fill[magenta] (0.8,1) -- (0.6,0.2) --(0.2,0) -- (0.8,-0.8) -- (0.8,-1.4) -- (1.4,-1.4) -- (1.4,1) --cycle; 
     \node[scale=12,inner sep=0pt] {R};    
 \end{scope}
% \draw[help lines,step=.2] (-1.4,-2) grid (1.4,2);    
 \end{tikzpicture}
 \end{document}    

With the grid it's easy to define the five areas:

enter image description here

6
  • Hmm, sorry I didn't see your answer for one hour. I was too busy with painting apparently.
    – percusse
    Commented Jul 20, 2012 at 14:28
  • @HiggsBoson No I extract the points with the grid Commented Jul 20, 2012 at 14:32
  • @percusse I delete my answer during some minutes because I used only one color. I was busy like you with painting ! :) Commented Jul 20, 2012 at 14:34
  • I don't know but I'm not very optimistic Commented Jul 20, 2012 at 15:06
  • 1
    @HiggsBoson You get a problem because you forgot [11pt]You need to use \documentclass[11pt]{standalone}. Commented Jul 20, 2012 at 16:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .