- #1
Eclair_de_XII
- 1,083
- 91
- TL;DR Summary
- Basically I want to recreate a \monthname macro from scratch using the (\ifcase,\or,\fi) set of macros. The problem is that my macro keeps implying that the month is April on the second input line, when TeX says that the month number is 3 from the first output line.
Code:
\def\themonth{%
\ifcase%
\month=1 {\the\month}%
\or \month=2 {\the\month}%
\or \month=3 {\the\month}%
\or \month=4 {\the\month}%
\or \month=5 {\the\month}%
\or \month=6 {\the\month}%
\or \month=7 {\the\month}%
\or \month=8 {\the\month}%
\or \month=9 {\the\month}%
\or \month=10 {\the\month}%
\or \month=11 {\the\month}%
\or \month=12 {\the\month}%
\fi%
}
This is Month \the\month\ of the Year \the\year.
This is Month \themonth{} of the Year \the\year.
What is the problem, here? Do the (\ifcase,\or) macros not work with numerical Boolean tests or something? Using the \month parameter in this macro seems to increment it by one for some reason, and adding a line to \advance\month by -1 within the macro definition does not seem to have any effect. Using the parameter in a generic macro (like \def\three{\the\month}) does not seem to affect the printed value of \month. Why is that?
Edit: Changed all month names to {\the\month} for easier trouble-shooting.
Last edited: