Kept modifying my calendar and learning LaTex on the way.

Function with multiple arguments

Function with two arguments:

    % and inside use #1 #2 as usual

Phantoms and phantoms in math

A phantom is a symbol which has the width/height/dephts of a symbol but doesn’t print it. I use it to keep my weekdays in the calendar aligned.

From here:

  • \hphantom (horizontal phantom) inserts an empty box that has zero height, zero depth, but the width of its argument.
  • \vphantom (vertical phantom) inserts an empty box that has the height and depth of the argument, but zero width.
  • \phantom inserts an empty box with the same dimensions (horizontal as well as vertical) as the argument.

To use it in math environment, I needed to put it inside another pair of {}s:


And here’s a nice discussion about what does width/height/depth mean in Latex.

Commands inside commands

Use ##1 if #1 is taken by parent. See here. Needs to be done also when parent command does not take arguments!

\newcommand{\abc}[1]{joy, oh #1!%
  \newcommand{\ghi}[1]{gloom, oh ##1!}%

Simple math

Needed to increase weeday by one, so that 0 is Sun. From this SO answer. Here I also compared #3 to 6, so I get a 0 instead of a 7.