14

Is it possible to color the 'inner' areas of this logo?

enter image description here

\documentclass{scrartcl}
\usepackage[german]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{bera}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usepackage{makecell}
\tikzset
{
  shadeball/.style={circle,shading=ball, minimum size=0.6cm},
  utedge/.style={->,ultra thick}
}
\begin{document}
\begin{tikzpicture}
  \draw (0,0) rectangle (14,3);
  \node at (1.8,2.3) {\Huge\textbf{\textsf{my\LaTeX}}};
  \node at (10.6,0.8) {\LARGE\makecell[r]{line1 line1 line1 line1 li\\line2 line2 line2 line}};
  \node[shadeball, ball color=LawnGreen] (b1) at (5.7,0.85) {};
  \node[shadeball, ball color=Fuchsia] (b2) at (10.7,2.15) {};
  \node[shadeball, ball color=Cyan] (b3) at (4.7,2.25) {};
  \node[shadeball, ball color=Gold] (b4) at (2.1,0.55) {};
  \node[shadeball, ball color=Tomato] (b5) at (0.7,1.65) {};
  \node[shadeball, ball color=Chocolate] (b6) at (7.7,0.45) {};
  \draw[utedge] (b2) to [bend right=20] (b1);
  \draw[utedge] (b3) to [bend left=30] (b1);
  \draw[utedge] (b4) to [bend right=10] (b1);
  \draw[utedge] (b4) to [bend right=30] (b3);
  \draw[utedge] (b3) to [bend left=20] (b2);
  \draw[utedge] (b5) to [bend right=30] (b4);
  \draw[utedge] (b5) to [bend right=20] (b3);
  \draw[utedge] (b1) to [bend right=30] (b6);
\end{tikzpicture}
\end{document}
1
  • 1
    Btw, IMHO the LaTeX logo needs a small tweak for you font, the "A" should not touch "L". Try adding this to the preamble: \makeatletter\expandafter\def\csname LaTeX \endcsname{L\kern -.36em{\sbox \z@ T\vbox to\ht \z@ {\kern-0.2ex\hbox {\check@mathfonts \fontsize \sf@size \z@ \math@fontsfalse \selectfont A}\vss }}\kern -.15em\TeX}\makeatother
    – yo'
    Feb 23, 2013 at 0:36

2 Answers 2

10

Here, since your nodes are circle with radius equal to 3mm, instead of link two nodes, you can link center of nodes via shorten curves.

enter image description here

\documentclass{standalone}
\usepackage[T1]{fontenc}
\usepackage{bera}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\tikzset{
  shadeball/.style={circle,shading=ball, minimum size=0.6cm},
  utedge/.style={->,ultra thick,shorten >=3mm,shorten <=3mm}
}
\begin{document}
\begin{tikzpicture}
  \node[font=\bfseries\Huge\sffamily] at (1.8,2.3) {my\LaTeX};
  \node[align=right,font=\LARGE] at (10.6,0.8)
  {line1 line1 line1 line1 li\\line2 line2 line2 line};

  \node[shadeball, ball color=LawnGreen] (b1) at (5.7,0.85) {};
  \node[shadeball, ball color=Fuchsia] (b2) at (10.7,2.15) {};
  \node[shadeball, ball color=Cyan] (b3) at (4.7,2.25) {};
  \node[shadeball, ball color=Gold] (b4) at (2.1,0.55) {};
  \node[shadeball, ball color=Tomato] (b5) at (0.7,1.65) {};
  \node[shadeball, ball color=Chocolate] (b6) at (7.7,0.45) {};

  \begin{pgfonlayer}{background}
    \fill[red!50] (b1.center) to[bend left=20] (b2.center)
    to[bend right=20] (b3.center) to[bend left=30] (b1.center);
    \fill[cyan!50] (b1.center) to[bend left=10] (b4.center)
    to[bend right=30] (b3.center) to[bend left=30] (b1.center);
    \fill[orange!50] (b5.center) to[bend right=30] (b4.center)
    to[bend right=30] (b3.center) to[bend left=20] (b5.center);
  \end{pgfonlayer}

  \draw[utedge] (b2.center) to [bend right=20] (b1.center);
  \draw[utedge] (b3.center) to [bend left=30] (b1.center);
  \draw[utedge] (b4.center) to [bend right=10] (b1.center);
  \draw[utedge] (b4.center) to [bend right=30] (b3.center);
  \draw[utedge] (b3.center) to [bend left=20] (b2.center);
  \draw[utedge] (b5.center) to [bend right=30] (b4.center);
  \draw[utedge] (b5.center) to [bend right=20] (b3.center);
  \draw[utedge] (b1.center) to [bend right=30] (b6.center);
\end{tikzpicture}
\end{document}
2
  • This may not be important, but the curves follow slightly different paths than they did originally. Feb 23, 2013 at 15:12
  • @Kundor Yes, you are right. Feb 23, 2013 at 15:14
12

I found it a little tricky, indeed. It is hard to fill or clip with the given paths, since they are not closed, and modifying them to pass through the node centers and form a closed path changes the curves. Joining the to paths with --, as in:

\clip (b5) to [bend right=20] (b3) -- (b3) to[bend left=30] (b4) -- (b4) to[bend left=30] (b5);

didn't work either, for reasons I don't understand. It looks like this: bad clipping

You can get closed paths out of these by connecting the curves you have with line segments between the points where the curves land on the boundary of the nodes. Getting the coordinates of these is as simple as putting coordinate operations on the paths!

\documentclass{scrartcl}
\usepackage{bera}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\usepackage{makecell}
\tikzset
{
  shadeball/.style={circle,shading=ball, minimum size=6mm},
  utedge/.style={->,ultra thick},
}
\begin{document}
\begin{tikzpicture}
  \draw (0,0) rectangle (14,3);
  \node at (1.8,2.3) {\Huge\textbf{\textsf{my\LaTeX}}};
  \node at (10.6,0.8) {\LARGE\makecell[r]{line1 line1 line1 line1 li\\line2 line2 line2 line}};
  \node[shadeball, ball color=LawnGreen] (b1) at (5.7,0.85) {};
  \node[shadeball, ball color=Fuchsia] (b2) at (10.7,2.15) {};
  \node[shadeball, ball color=Cyan] (b3) at (4.7,2.25) {};
  \node[shadeball, ball color=Gold] (b4) at (2.1,0.55) {};
  \node[shadeball, ball color=Tomato] (b5) at (0.7,1.65) {};
  \node[shadeball, ball color=Chocolate] (b6) at (7.7,0.45) {};
  \draw[utedge] (b2) to [bend right=20] coordinate[at start] (b21) (b1) coordinate (b12);
  \draw[utedge] (b3) to [bend left=30]  coordinate[at start] (b31) (b1) coordinate (b13);
  \draw[utedge] (b4) to [bend right=10] coordinate[at start] (b41) (b1) coordinate (b14);
  \draw[utedge] (b4) to [bend right=30] coordinate[at start] (b43) (b3) coordinate (b34);
  \draw[utedge] (b3) to [bend left=20]  coordinate[at start] (b32) (b2) coordinate (b23);
  \draw[utedge] (b5) to [bend right=30] coordinate[at start] (b54) (b4) coordinate (b45);
  \draw[utedge] (b5) to [bend right=20] coordinate[at start] (b53) (b3) coordinate (b35);
  \draw[utedge] (b1) to [bend right=30] coordinate[at start] (b16) (b6) coordinate (b61);
  \begin{scope}[on background layer]
    \fill[orange!60] (b54) to [bend right=30] (b45) -- 
                     (b43) to [bend right=30] (b34) --
                     (b35) to [bend left=20] (b53) -- cycle;
    \fill[purple!60] (b43) to [bend right=30] (b34) -- 
                     (b31) to [bend left=30] (b13) -- 
                     (b14) to [bend left=10] (b41) -- cycle;
    \fill[green!60] (b32) to [bend left=20] (b23) -- 
                    (b21) to [bend right=20] (b12) --
                    (b13) to [bend right=30] (b31) -- cycle;
  \end{scope}
\end{tikzpicture}
\end{document}

Logo with colored interior regions

Notice that I used the backgrounds TikZ library.

This is sufficiently better than my previous method that I erased it. See the edit history for a method that overlaps clipping regions for each curve.

1
  • I accepted Paul's answer just because of its simplicity. Exact paths are not important in my case. After reading your comment on your own answer, i guess you agree. Nevertheless, thank you for your effort.
    – Josef
    Feb 24, 2013 at 13:20

You must log in to answer this question.

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