Am 15.11.2023 um 21:37 schrieb Dr Eberhard W Lisse:
> Wäre das nicht etwas für Lua(TeX)?
>
> ChatGPT bietet soetwas an:
>
...
Danke für die Antwort, die mich auf die Idee brachte, zum ersten Mal
ChatGPT zu befragen, und tatsächlich erhielt ich korrigierten Code.
%%%%%%%%%%%%% Funktionierendes Minimalbeispiel %%%%%%%%%%%%%%%%
\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calendar,fpu,calc}
\newcommand\mond[4] % center, radius, color, rotation (-180,...,180),
{%
\ifnum #4 > 0
\pgfmathsetmacro\lb{ #2} % left arc, horizontal axis
\pgfmathsetmacro\rb{ #2*(90-#4)/90} % right arc, horizontal axis
\else
\pgfmathsetmacro\lb{-#2*(90+#4)/90} % left arc, horizontal axis
\pgfmathsetmacro\rb{-#2} % right arc, horizontal axis
\fi
\draw[thick,#3,fill=white] #1 circle (#2);
\fill[#3,opacity=0.5] ($#1+(0,#2)$) arc (90:270:\lb cm and #2 cm)
arc (270:90:\rb cm and #2 cm);
%% auskommentiert, hier waren die Tage nach Neumond spiegelverkehrt %%
%
%
\pgfmathsetmacro\leftside{ifthenelse(\lunarage<=\synodicmonth/2,cos(360*(\lunarage/\synodicmonth)),1)}%
%
\pgfmathsetmacro\rightside{ifthenelse(\lunarage<=\synodicmonth/2,-1,-cos(360*(\lunarage/\synodicmonth))}%$
%
%%%%%%%% korrigierte zwei Zeilen ifthenelse von ChatGPT
%%%%%%%%%%%%%%%%%%%%%%
\pgfmathsetmacro\leftside{ifthenelse(\lunarage<=\synodicmonth/2,cos(360*(\lunarage/\synodicmonth)),ifthenelse(\lunarage<=\synodicmonth,-1,1))}
\pgfmathsetmacro\rightside{ifthenelse(\lunarage<=\synodicmonth/2,1,ifthenelse(\lunarage<=\synodicmonth,-cos(360*(\lunarage/\synodicmonth)),1))}
\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;
}%
}
\makeatother
\newcommand{\newmoon}{\moon{0}}
\newcommand{\waxingcrescent}{\moon{\synodicmonth/8}}
\newcommand{\firstquartermoon}{\moon{2*\synodicmonth/8}}
\newcommand{\waxinggibbous}{\moon{3*\synodicmonth/8}}
\newcommand{\fullmoon}{\moon{4*\synodicmonth/8}}
\newcommand{\waninggibbous}{\moon{5*\synodicmonth/8}}
\newcommand{\thirdquartermoon}{\moon{6*\synodicmonth/8}}
\newcommand{\waningcrescent}{\moon{7*\synodicmonth/8}}
\begin{document}\noindent\raggedleft%
%% Tage nach dem Neumond erscheinen nicht mehr spiegelverkehrt %%%%%
\foreach \d in {1,2,...,30}{%
\d: \moon{\year-11-\d} \ }
\end{document}