TeX - LaTeXHow to typeset moon phase symbols?
[+40] [4] Ingo
[2011-11-14 12:00:42]
[ symbols ]
[ ]

I would like to add moon phase symbols to a document of mine but could not find a visually pleasing way to do this. Does anyone know how to typeset aesthetic moon phase symbols?

possible duplicate of How to look up a math symbol? - Andrey Vihrov
(2) You can use the unicode symbols (e.g. ☽,☾) if you use a font containing these glyphs. - Marco
[+77] [2011-11-14 13:52:38] Jake [ACCEPTED]

You could use TikZ for drawing the lunar phases. Here's a command \moon{<day>} that takes the day of the lunar month as an argument and draws the corresponding lunar phase. The symbols scale with the surrounding text, normal TikZ options can be passed using the optional argument, and the standard lunar phase names have been defined as additional macros (\waxingcrescent, \fullmoon, etc.). The code uses the method for drawing 3D circles that Andrew Stacey describes in Drawing simple 3D cylinders in TikZ [1].

Edit: I've edited the code to draw the moon more accurately (using a sinusoidal function instead of a linear one). You can now also provide a date to the moon macro for which the moon phase will be drawn. Furthermore, the colour of the moon and the sky can be set using the moon colour and sky colour keys. The key southern hemisphere will flip the diagram vertically.

\foreach \d in {0,2,...,30}{%
    \d: \moon{\d} \\


\moon[scale=10,sky colour=blue!50!black,moon colour=yellow,southern hemisphere]{2011-11-20}


    moon colour/.style={
        moon fill/.style={
    sky colour/.style={
        sky draw/.style={
        sky fill/.style={
    southern hemisphere/.style={

\pgfcalendardatetojulian{2010-01-15}{\c@pgf@counta} % 2010-01-15 07:11 UTC --
        \pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}%
    \tikz [moon colour=white,sky colour=black,#1]{
        \draw [moon fill, sky draw] (0,0) circle [radius=1ex];
        \draw [sky draw, sky fill] (0,1ex)
            arc (90:-90:\rightside ex and 1ex)
            arc (-90:90:\leftside ex and 1ex)
            -- cycle;
\foreach \d in {0,2,...,30}{%
    \d: \moon{\d} \\



\moon[scale=10,sky colour=blue!50!black,moon colour=yellow,southern hemisphere]{2011-11-20}

(12) Very nice indeed! - egreg
Could this be changed to use the eTeX \loccount to avoid using global counters? - kahen
(5) Impressive! Have you considered turning this into a package? - doncherry
@kahen: Good point! I've changed the code to use the scratch counts provided by PGF instead of declaring new global counts. - Jake
(1) This totally rocks. As my musician friends would say: "Sick answer, dude!" - Todd Lehman
(1) +1 for having this as a package. (Although I would have to hack this anyway since I want to use it for non-lunar phases, but I still think this should be packaged.) - DevSolar
(1) @DevSolar: I'll try to get on it soon. Might as well start collecting feature requests: By "non-lunar" phases, do you mean you want to be able to use it with periods other than 29.5? Would an option to specify the phase as a fraction or percentage of the period (so 0.5 or 50 would be a full moon) be what you need? - Jake
Correct, I am preparing fantasy-roleplaying material, for a game world with two moons with different periods. But I consider that to be a requirement not common enough for inclusion. (I'm done already, and how many people prepare non-earth-based calendars?) - DevSolar
@Jake: This produces the output shown in the deleted "answer" as opposed to the images shown in your answer. - Peter Grill
@PeterGrill: I fixed the code. For some reason, the syntax \arc [x=..., y=..., start angle=...] doesn't seem to work anymore, I've used the \arc (...:...:...) syntax now - Jake
[+24] [2011-11-14 12:13:25] egreg

You can find scores of symbols in the Comprehensive LaTeX Symbol List [1]

For the moon phases you'll find that \usepackage{wasysym} will provide

\fullmoon \leftmoon \newmoon \rightmoon

enter image description here


Nice, but are there any "more fancy" symbols? Or should I consider making them myself, e.g. with TikZ? - Ingo
@tehingo There are some more in the Symbol List, see table 318 page 98. Don't know if those are any close to what you're after though. - Torbjørn T.
[+6] [2017-01-03 20:51:22] user122292

The following provides a possible solution using pstricks. Obviously the code is not as powerful as the tikz solution above, but it will get you started. The presentation of this solution is analogous to the one above:

\foreach \d in {0,2,...,30}{%
\d: \moon{\d} \\    }


enter image description here



\edef\waxswitch{\ifdim\lunarage pt>.5\dimexpr\synodicmonth pt 1\else -1\fi}%
    \parametricplot[plotpoints=91]{0}{360}{t sin t cos}%
    \parametricplot[plotpoints=91]{\waxswitch\space 180 mul}{0}{t sin t cos}%
    \parametricplot[plotpoints=91]{0}{180}{t sin \lunarage\space \synodicmonth\space div 1 \waxswitch\space add 4 div add 360 mul cos mul t cos}%
    }%end pscustom
}%end moon command

\newcommand{\newmoon}{\moon{0}}% following incremented by one 8th of \synodicmonth:

\foreach \d in {0,2,...,30}{%
    \d: \moon{\d} \\    }



Thanks again, Jake, for your answer. -- I don't know why, but I get the wrong spacing if the escape-end-of-line-% are omitted in the moon-newcommand. - user122292
(1) Perhaps you don't know about What is the use of percent signs (%) at the end of lines? - Werner
Any ideas how I can get rid of the \pgfmathsetmacro switch? Or is it still acceptable as pstricks solution? - user122292
Try \edef\waxswitch{\ifdim\lunarage pt>.5\dimexpr\synodicmonth pt 1\else -1\fi} - Werner
[+3] [2017-01-04 03:22:38] Steven B. Segletes

Here, I create the moon phases using stacks of simple circles and half circles that have been suitably stretched. In my original answer I started with the syntax

\moon{<B/W color at moon center>}{<direction that color proceeds>}{<"fullness">}

This may seem confusing at first, but really isn't. For example, \moon{W}{r}{.2} means that the moon center is white and the right side of the moon is also the same color (white). The fullness is 0.2; a value of 1 gives a full or new moon, and a value of 0 gives a half moon. The value of "fullness" I take as the cosine of the phase.

However, I upgraded the solution by way of EDIT to provide


to make it easy on the user, which just converts the <day> into the appropriate parameters for \moon.

\newcommand\BC[1]{\csname BC#1\endcsname}
\newcommand\HC[2]{\csname HC#1#2\endcsname}
  \if W#1\def\tmp{B}\else\def\tmp{W}\fi%
\texttt{\textbackslash moon\{\}\{\}\{\}}\par
\texttt{\textbackslash Moon\{$<$day$>$\}}\par
0: \Moon{0}\par
2: \Moon{2}\par
4: \Moon{4}\par
6: \Moon{6}\par
8: \Moon{8}\par
10: \Moon{10}\par
12: \Moon{12}\par
14: \Moon{14}\par
16: \Moon{16}\par
18: \Moon{18}\par
20: \Moon{20}\par
22: \Moon{22}\par
24: \Moon{24}\par
26: \Moon{26}\par
28: \Moon{28}\par
30: \Moon{28}\par

enter image description here