I have some trouble with tikz. I wanted to draw a flag in Tikz – but that with minimal success. Here a sketch:
The sketch is not how it should look like: the letters are just there so I am able to tell you what I actually wanted. The black rectangles shouldn't be there either, it should just show you the regions. It should just look like a green rectangle on a red rectangle with a star in the middle.
The letters are coordinates (in px). Here the coordinates:
The flag edges:
- N=(0, 300)
- M=(450, 0)
The star edges:
-
A=(200, 180)
-
B=(185, 135)
-
C=(225, 205)
-
D=(265, 135)
-
E=(250, 180)
Here is what I tried:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,snakes}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{xcolor}
\definecolor{grun}{HTML}{239d48}%green - colour of the top rectangle
\definecolor{rot}{HTML}{bf0028}%red - colour of the bottom rectangle
\definecolor{gelb}{HTML}{f6ec0f}%yellow - colour of the star
\begin{document}
\begin{tikzpicture}
\fill[fill=grun] (0, 0) rectangle (12, 4.5);
\fill[fill=red] (0,4.5) rectangle (12, 9);
\end{tikzpicture}
\end{document}
Problems:
I don't know why definecolor don't work for "rot" and "gelb". I don't know how to define the units for tikz (so instead of using cm I could write the coordinates in px and get an result). I don't know how to draw the star.
Bonus question:
Is it possible to play with the scale of the done tikzpicture (so make it fill the whole page)? I thought of something like minipage? But that is not an important question, I am just curious for next Tikz projects.
Kind regards and thank you in advance!
Best Answer
Since adequate answers have already been given, I've felt free to do this picture with MetaPost.
For me it was an occasion to use some recent features of the
luamplib
package, (which gives an interface to MetaPost in LuaLaTeX). More precisely, I've made use of thepx
unit (which I didn't know of) thanks to the\mpdim
command, and of the integration of colors defined by thexcolor
package, via the\mpcolor
command.The rectangle's dimensions follow the OP's first wishes, except for the star, for which it seems that several points are missing. So I've included a star of my own.
Edit I've made some minor changes, for the flag to be more like Burkina-Faso's official one, the way Paul Gaborit reports in its comment on the OP's question. So the red and green parts are reversed, and the star diameter is exactly one-third of the flag's height.