0

I am trying to make a vertical column of various moon phases using a macro that generates circles, but when I add a node label to a circle (to designate that it is a full moon) it shifts the circle that contains the label slightly up and to the right.

\documentclass[leqno,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{calendar,fpu}

\newcommand{\moon}[2][]{%
\def\lunarage{#2}%
\pgfmathsetmacro\textF{ifthenelse(\lunarage==15,"F","")}
\tikz []{
    \draw (0,0) circle [radius=1ex];
    \node[color=black] (0,0) {\textF};
    %
    }%
}
\begin{document}\noindent%
    \foreach \d in {0,1,...,30}{%
    \moon[]{\d}  \\   }
\end{document}

THANKS for any help!

  • isn't this an exact duplicate of the question you just asked? tex.stackexchange.com/questions/297793/… – David Carlisle Mar 7 '16 at 18:45
  • yes it is. The first one didn't display the code correctly. – user87805 Mar 7 '16 at 19:38
  • please do not do do that, you can edit an existing question (or delete the old one) – David Carlisle Mar 7 '16 at 21:49
  • Thanks for all the suggestions. This is my first question so I had some trouble with the editing procedure. Thanks for all of the help. – user87805 Mar 8 '16 at 14:27
1

You're drawing a circle and a node over it. As this node is wider than the circle, this particular moon is wider than all other moons.

I think it's better to use a circular node than a circle with a not-drawn node over it. You must be sure that minimum size is big enough to encompass F (or whatever letter you want). This way, all moons have same size.

\documentclass[leqno,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{calendar,fpu}

\newcommand{\moon}[2][]{%
\def\lunarage{#2}%
\pgfmathsetmacro\textF{ifthenelse(\lunarage==15,"F","")}
\tikz []{
    \node[draw, circle, color=black, inner sep=0pt, minimum size=5mm] (0,0) {\textF};
    %
    }%
}
\begin{document}\noindent%
    \foreach \d in {0,1,...,30}{%
    \moon[]{\d}  \\   }
\end{document}

enter image description here

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.