8

I have this code:

\documentclass{standalone}
\usepackage[html]{xcolor}
\usepackage{tikz}


\definecolor{verda}{HTML}{009900}
\definecolor{blanka}{HTML}{FFFFFF}

\begin{document}
\begin{tikzpicture}
\fill[verda] (0,0) rectangle (20,13);
\fill[blanka] (0,13) rectangle (6.6,6.6);
\end{tikzpicture}
\end{document}

The flag should look like this:

Esperanto flag.

Problem: the green star. Kind regards!

15

Result

Measurements

  • The English Wikipedia article says:

    The ratio of the width of the flag to the height of the flag to a side of the white square should be 3 to 2 to 1. The ratio of a side of the white square to the radius of a circle enclosing the star should be 10 to 3.5.

    If the width of the flag is 3 units, then the diameter of the circumscribed circle is 0.7 units.

Drawing with measurements found in Ficheiro:Esperanta Flago Proporcioj.PNG:

Ficheiro:Esperanta Flago Proporcioj.PNG

Color

The German Wikipedia article says about the color:

Der Grünton hat die CMYK-Farbwerte 79 %, 22 %, 99 %, 5 % (entspricht PANTONE 363 C).

Then the color can then be defined the following way:

\definecolor{EsperantoGreen}{cmyk}{.79,.22,.99,.05}

However, the Esperanto Wikipedia article lists lot of colors, which can be defined with the HTML color model:

\documentclass{standalone}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{xcolor}
\def\x#1{%
  \color[HTML]{#1}\rule{1.5em}{1em} & \ttfamily #1\\%
}
\begin{document}
\begin{tabular}{rl}
\toprule
Sample & Color (HTML) \\
\midrule
\x{009900}
\x{007D13}
\x{37A93A}
\x{2C693F}
\x{CCE82E}
\x{008000}
\x{1B9332}
\x{158A44}
\x{009F6B}
\midrule
\color[cmyk]{.72,.22,.99,.05}\rule{1.5em}{1em} &
CMYK(%
  \SIlist[list-units=repeat, list-final-separator={,}]
  {72;22;99;05}{\percent})\\
\bottomrule
\end{tabular}
\end{document}

Colors

Star

There are several ways to draw the star:

  • The outer points of the star are available as corner points of a five-sided regular polygon. Then the fill path connects the corners with the second next corners, e.g.:

    \fill[EsperantoGreen]
      (.5cm, 1.5cm) node[
        regular polygon,
        regular polygon sides=5,% default
        inner sep=0pt,
        minimum size=0.7cm,   
      ] (star) {}    
      (star.corner 1)
      \foreach \i in {1, 3, 5, 2, 4} {
        -- (star.corner \i)
      } -- cycle
    ;
    
  • Node shape star has already the right shape, if configured correcly. Option minimum size specifies the diameter of the outer circle, which are 0.7 units. The diameter of the inner circle is also important, because it influences the slopes of the sides. The inner radius can be indirectly specified by two options:

    • star point height: the difference between the outer and inner radii or
    • star point ratio: the ratio of the outer to inner radius. After looking at some triangles, calculating angles and a little trigonometry the ratio is sin(126)/sin(18) = (3 - sqrt(5))/2.

      \path
        (.5, 1.5) node[
          fill=EsperantoGreen,
          star,
          star point ratio=sin(126)/sin(18),
          minimum size=0.7cm
        ] {};
      
  • The corners can be easily specified in the polar coordinate system.

Flag implemented via nodes

The flag can be scaled by setting the unit register \EsperantoUnit.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}

\definecolor{EsperantoGreen}{HTML}{009900}
\newdimen\EsperantoUnit
\setlength{\EsperantoUnit}{40mm}

\begin{document}
\tikz\path[
  inner sep=0pt,
  every node/.append style={node contents={}},
  x=\EsperantoUnit,
  y=\EsperantoUnit,
]
  (1.5, 1) node[
    fill=EsperantoGreen,
    rectangle,
    minimum width=3\EsperantoUnit,
    minimum height=2\EsperantoUnit,
  ]
  (.5, 1.5) node[
    fill=white,
    rectangle,
    minimum width=\EsperantoUnit,
    minimum height=\EsperantoUnit,
  ]
  node[
    fill=EsperantoGreen,
    star,
    star point ratio=sin(126)/sin(18),
    minimum size=0.7\EsperantoUnit,
  ]
;
\end{document}

Flag with star, filled via polar coordinates

Here, the flag can be scaled via option scale.

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{backgrounds}

\definecolor{EsperantoGreen}{HTML}{009900}

\begin{document}
\tikz[
  background rectangle={fill=white},
  fill=EsperantoGreen,
  scale=4,
]\fill
  (0, 0) -- (3, 0) -- (3, 2) -- (1, 2) -- (1, 1) -- (0, 1) -- cycle
  (.5, 1.5)
  +(0, .35) \foreach \i in {1, ..., 4} { -- +(90+\i*144:.35)} -- cycle
;
\end{document}

Flag via SVG file

Wikipedia Commons has the Flag of Esperanto as SVG file:

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="600" height="400">
<path fill="#FFF" d="m0,0h202v202H0"/>
<path fill="#090" d="m0,200H200V0H600V400H0m58-243 41-126 41,126-107-78h133"/>
</svg>

This can be mapped to TikZ directly, because TikZ' library svg.path supports SVG path specifications:

\documentclass[tikz]{standalone}
\usetikzlibrary{svg.path}

\definecolor{EsperantoGreen}{HTML}{009900}

\begin{document}
\begin{tikzpicture}[
  yscale=-1,
  svg scale/.style={scale=.2mm},
]
  \fill[white]
    svg[svg scale] {m0,0h202v202H0};
  \fill[EsperantoGreen]
    svg[svg scale] {m0,200H200V0H600V400H0m58-243 41-126 41,126-107-78h133};
\end{tikzpicture}
\end{document}
7

This is fairly close. Scaling with scale will work, but changing the x and y unit vectors will not work, as the size of the star is defined in centimeters.

According to https://en.wikipedia.org/wiki/Esperanto_symbols the ratio of the radius of the star to a side of the white square should be 3.5/10. As minimum size defines the diameter, I scaled by 7/10.

enter image description here

\documentclass[border=5mm]{standalone}
\usepackage[html]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shapes}

\definecolor{verda}{HTML}{009900}
\definecolor{blanka}{HTML}{FFFFFF}

\begin{document}
\begin{tikzpicture}
\fill[verda] (0,0) rectangle (20,13);
\fill[blanka] (0,13) rectangle (6.6,6.6);
\node at (3.3,9.7) [transform shape,star,star point height=1.53cm,fill=verda,minimum size=6.6cm*7.5/10] {};
\end{tikzpicture}
\end{document}

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.