\documentclass[12pt, twocolumn]{article}

\usepackage{url}

\usepackage{planets}

\usepackage[top=2cm, bottom=2cm, right=1.7cm, left=1.7cm]{geometry}

\title{The TikZ-planets package}
\author{Isabelle M. Santos}
\date{Version 1.0.1 -- 2020/03/30}

\begin{document}
\maketitle
\tableofcontents

\section{Introduction}
I initially created this package to illustrate celestial mechanics for an astronomy course I taught in 2019. 
It makes it easy to add sketches of solar system objects to illustrate seasons, moon phases,... 
The commands provided by this package are to be used in a \verb|tikzpicture| environment. 

This package is a work in progress and is my first attempt at creating a TikZ package. I would be really happy to receive suggestions on how to improve it. 

\subsection{Installation}
Move the package (.sty file) to a latex search directory (usually \url{~/texmf/} on a Unix-type system) if you want to be able to use it from any directory. 
Ask you system administrator if you need help.

\subsection{Requirements}
Tikz-planets requires the following standard packages to be installed
\begin{itemize}
\item xcolor
\item pgfkeys
\item xstring
\item tikz
\end{itemize}

\subsection{License}
The package can be found at \url{https://framagit.org/Moutmout/tikz-planets.git}. It is under the CC-BY-SA license. 

\section{Usage}
\subsection{Drawing a planet}
Drawing one of the eight solar system planets is rather straightforward, use \verb|\planet[surface=earth]|, replacing the option \verb|earth| with the name of any planet. 
Although they are not planets, the \verb|\planet| command can also be used to draw the Sun and the Moon, by setting the \verb|surface| option.

\begin{verbatim}
\planet[surface=sun]
\planet[surface=earth]
\planet[surface=moon]
\planet[surface=mars]
\end{verbatim}
\begin{tikzpicture}
\planet[surface=sun]
\planet[surface=earth, centerx=2.2]
\planet[surface=moon, centerx=4.4]
\planet[surface=mars, centerx=6.6]
\end{tikzpicture}

If you need a planet that isn't in the solar system, you can make a generic one with a solid color surface.

\begin{verbatim}
\planet
\planet[color=brown]
\end{verbatim}
\begin{tikzpicture}
\planet
\planet[color=brown, centerx=2.2]
\end{tikzpicture}

\subsection{Rings}
The four gas giants in the solar system sport a ring. 
In the current version of the package, only Saturn is shown with a ring. 

\subsection{Rotational characteristics}
Most planets rotate around a set axis that can be tilted with respect to the plane of orbit. 
The rotation axis of the Earth, for instance, is tilted by 23.5 degrees.
Uranus spins on its side, with a rotation axis tilted at 90 degrees.  
This can be illustrated using the \verb|tilt| and the \verb|rotation| options. 

\begin{verbatim}
\planet[surface=earth, tilt=23.5]
\planet[surface=uranus, tilt=90, rotation]
\planet[surface=venus, retrograde, rotation]
\end{verbatim}
\begin{tikzpicture}
\planet[surface=earth, tilt=23.5]
\planet[surface=uranus, tilt=90, rotation, centerx=3.3]
\planet[surface=venus, rotation, retrograde, centerx=6.6]
\end{tikzpicture}

Venus rotates in the opposite direction compared to the other planets in the solar system. 
This can be illustrated with the \verb|retrograde| option. 

\subsection{Phases}
Half of a planet or moon in in the shadow of the Sun. This can be illustrated with the \verb|phase| keyword, which can take the following values: \verb|new|, \verb|first crescent|, \verb|first half|, \verb|waxing gibbous|, \verb|full|, \verb|waning gibbous|, \verb|last half| or \verb|last crescent|.

\hspace{1em}

\begin{tikzpicture}
	\planet[surface=moon, phase=new, centerx=0]
	\node[red] at (0, 0) {new};
	\planet[surface=moon, phase=first crescent, centerx=2]
	\node[red, align=center] at (2, 0) {first \\ crescent};
	\planet[surface=moon, phase=first half, centerx=4]
	\node[red, align=center] at (4, 0) {first \\ half};
	\planet[surface=moon, phase=waxing gibbous, centerx=6]
	\node[red, align=center] at (6, 0) {waxing \\ gibbous};
	\planet[surface=moon, phase=full, centery=-2, centerx=6]
	\node[red, align=center] at (6, -2) {full};
	\planet[surface=moon, phase=waning gibbous, centerx=4, centery=-2]
	\node[red, align=center] at (4, -2) {waning \\ gibbous};
	\planet[surface=moon, phase=last half, centerx=2, centery=-2]
	\node[red, align=center] at (2, -2) {last \\ half};
	\planet[surface=moon, phase=last crescent, centerx=0, centery=-2]
	\node[red, align=center] at (0, -2) {last \\ crescent};
\end{tikzpicture}

\subsection{Size and position}
By default, a planet has a radius of $1$ and is centered at $(0, 0)$. 

To draw schematics illustrating celestial mechanics, it is useful to use several \verb|\planet|s in one figure. 
The position of the center of the planet can be set using the \verb|centerx| and the \verb|centery| keywords. 
The size of the planet is set with the \verb|scale| keyword. 

\onecolumn
\section{Complete examples}
\subsection{The seasons}
Season's are caused by the tilt of Earth's axis. 
This is why summer in the northern hemisphere happens at the same time as winter in the southern hemisphere. 

\begin{verbatim}
	\planet[surface=sun]
	
	\planet[surface=earth, phase = first half, rotation, tilt=23.5, centerx=-5]
	\planet[surface=earth, phase = last half, rotation, tilt=23.5, centerx=5]
	\planet[surface=earth, phase = new, rotation, tilt=23.5, centery=-3]
	\planet[surface=earth, phase = full, rotation, tilt=23.5, centery=3]
\end{verbatim}
\begin{tikzpicture}
	\planet[surface=sun]
	
	\planet[surface=earth, phase = first half, rotation, tilt=23.5, centerx=-5]
	\planet[surface=earth, phase = last half, rotation, tilt=23.5, centerx=5]
	
	\planet[surface=earth, phase = new, rotation, tilt=23.5, centery=-3]
	\planet[surface=earth, phase = full, rotation, tilt=23.5, centery=3]
\end{tikzpicture}

\subsection{The phases of the Moon}
Half of the Moon is in the shadow of the Sun. 
Since the Moon goes around the Earth, the shadows on the near-side of the Moon change. 

\begin{verbatim}
	\planet[surface=earth]
	\planet[surface=sun, centerx=10, scale=2]
	
	\planet[surface=moon, phase=first half, centerx=-2.5, scale=.5]
	\planet[surface=moon, phase=first half, centerx=2.5, scale=.5]
	\planet[surface=moon, phase=first half, centery=-2.5, scale=.5]
	\planet[surface=moon, phase=first half, centery=2.5, scale=.5]
\end{verbatim}
\begin{tikzpicture}
	\planet[surface=earth]
	\planet[surface=sun, centerx=10, scale=2]
	
	\planet[surface=moon, phase=first half, centerx=-2.5, scale=.5]
	\planet[surface=moon, phase=first half, centerx=2.5, scale=.5]
	\planet[surface=moon, phase=first half, centery=-2.5, scale=.5]
	\planet[surface=moon, phase=first half, centery=2.5, scale=.5]
\end{tikzpicture}

\subsection{The solar system}
You might have learned "My Violent Evil Monster Just Scared Us Nuts" or some other mnemonic to remember the order of the eight (or nine if you're old enough) planets in the solar system. 
The distances in the following sketch are not to scale, but the radii roughly are.

\begin{verbatim}
	\clip (0,-3) rectangle (20, 3);
	\planet[surface=sun, scale=28, centerx=-27]
	\planet[surface=mercury, centerx=1.5, scale=.1]
	\planet[surface=venus, centerx=2.5, scale=.25]
	\planet[surface=earth, centerx=3.5, scale=.25]
	\planet[surface=mars, centerx=4.5, scale=.13]
	\planet[surface=jupiter, centerx=8, scale=2.75]
	\planet[surface=saturn, centerx=12, scale=2.3]
	\planet[surface=uranus, centerx=15, scale=1]
	\planet[surface=neptune, centerx=16.8, scale=.97]
\end{verbatim}
\begin{tikzpicture}
	\clip (0,-3) rectangle (20, 3);
	\planet[surface=sun, scale=28, centerx=-27]
	\planet[surface=mercury, centerx=1.5, scale=.1]
	\planet[surface=venus, centerx=2.5, scale=.25]
	\planet[surface=earth, centerx=3.5, scale=.25]
	\planet[surface=mars, centerx=4.5, scale=.13]
	\planet[surface=jupiter, centerx=8, scale=2.75]
	\planet[surface=saturn, centerx=12, scale=2.3]
	\planet[surface=uranus, centerx=15.5, scale=1]
	\planet[surface=neptune, centerx=17.3, scale=.97]
\end{tikzpicture}



\end{document}