Contents

Moon and Stars

One of the strengths of LaTeX that cannot be doubted is its ability to draw certain objects with great precision. Of course, this is supported by the use of the TikZ package and its libraries. By determining the coordinates of the image precisely and precisely, you will get a stunning image (at least in my view). The following image is no exception.

bulan dan bintang di latex

Of course, the charm here is relative in nature, in accordance with each personal’s taste values, which are of course different. But at least the images produced by LaTeX are very precise. OK, let’s just discuss how to draw the moon and stars using LaTeX.

  1. Open your LaTeX text editor, in this case I use the overleaf.com site.

  2. The document class used is article by using the following command.

\documentclass{article}
  1. Next, the packages required are as follows.
\usepackage[x11names,dvipsnames]{xcolor}\usepackage{tikz}\usetikzlibrary{shapes.geometric}
  1. For coloring, you can use the following color code.
\definecolor{bulanbintang}{rgb}{0,0,205}
  1. Then we start drawing a blue circle according to the selected coloring by writing the following command.
\begin{tikzpicture}\fill[bulanbintang,even odd rule] (0,0) circle (2.5);\end{tikzpicture}

The result looks like the following image.

bulan dan bintang di latex

  1. Next we will create a white circle inside the first circle so that the first circle is shaped like a crescent moon, the instructions are as follows.
\fill[white] (0,.54) circle (2);

The result looks like the following image

bulan dan bintang di latex

  1. Next, we will draw a star right in the middle of the curve of the crescent moon, using the following command.
\fill[bulanbintang] (0,2.5) node [regular polygon, regular polygon sides=5, inner sep=0pt, minimum size=1.2cm,] (A) {} (A.corner 1)\foreach \i in{1, 3, 5, 2, 4} {-- (A.corner \i) } -- cycle;

The final result of our work will produce an image as seen at the top of this article. It should be noted that we are given the freedom to determine the position of the moon and stars as well as their coloring, for example I will change the position of the moon and stars and their coloring as shown in the following image.

bulan dan bintang di latex

So, have you found the way? If not, please pay attention to the following command code.

\documentclass{article}\usepackage[x11names,dvipsnames]{xcolor}\definecolor{bulanbintang}{rgb} {0,0.65,0.2}\usepackage{tikz}\usetikzlibrary{shapes.geometric}\title{bulan bintang}\author{aantriono82 }\date{June 2021}\begin{document}\centering\maketitle\begin{tikzpicture}\fill[bulanbintang,even odd rule] (0,0) circle (2.5);\fill[white] (-.54,0) circle (2);\fill[bulanbintang] (-2.5,0) node [regular polygon, regular polygon sides=5, inner sep=0pt, minimum size=1.2cm,] (A) {} (A.corner 1)\foreach \i in{1, 3, 5, 2, 4} {-- (A.corner \i) } -- cycle;\end{tikzpicture}\end{document}

As seen above, the position of the moon is facing up, then facing to the left, and now we write the code for the image the moon faces right. For details, pay attention to the following code.

\documentclass{article}\usepackage[x11names,dvipsnames]{xcolor}\definecolor{bulanbintang}{rgb} {0,65,2}\usepackage{tikz}\usetikzlibrary{shapes.geometric}\title{bulan bintang}\author{aantriono82 }\date{June 2021}\begin{document}\centering\maketitle\begin{tikzpicture}\fill[bulanbintang,even odd rule] (0,0) circle (2.5);\fill[white] (.54,0) circle (2);\fill[bulanbintang] (2.5,0) node [regular polygon, regular polygon sides=5, inner sep=0pt, minimum size=1.2cm,] (A) {} (A.corner 1)\foreach \i in{1, 3, 5, 2, 4} {-- (A.corner \i) } -- cycle;\end{tikzpicture}\end{document}

Please compile it and see the results, it turns out the image is facing to the right and the color has changed. In essence, when we change the position of the image, we only need to change the image coordinates listed in the 14th and 15th line commands. That’s the article about how to draw the moon and stars using LaTeX. If there are errors, please correct them and if you have input, please write them here. I hope this is helpful. Reference : LaTeXing Group

Related Content