I am trying to make a simple calendar, this is how far I have got so far...

\usepackage[nomessages]{fp}% http://ctan.org/pkg/fp
\usepackage[margin=0.5in, paperwidth=15.8in, paperheight=8.5in]{geometry}




\tikzoption{day headings}{\tikzstyle{day heading}=[#1]}
\tikzstyle{day heading}=[]
\tikzstyle{day letter headings}=[
    execute before day scope={ \ifdate{day of month=1}{%
      \foreach \d/\l in {0/M,1/T,2/W,3/T,4/F,5/S,6/S} {
        \node[every day,day heading]{\l};%


    \begin{tikzpicture}[every calendar/.style={
        week list,
        month label above centered,
        day xshift = 0.8cm,
        day headings=black,
        day letter headings,
        \matrix[column sep=5em, row sep=3em] {
            \calendar[dates=2012-01-01 to 2012-01-last] if (even) [orange]; &
            \calendar[dates=2012-02-01 to 2012-02-last] if (even) [orange]; &
            \calendar[dates=2012-03-01 to 2012-03-last] if (even) [orange]; \\
            \calendar[dates=2012-04-01 to 2012-04-last] if (even) [orange]; &
            \calendar[dates=2012-05-01 to 2012-05-last] if (even) [orange]; &
            \calendar[dates=2012-06-01 to 2012-06-last] if (even) [orange]; \\
            \calendar[dates=2012-07-01 to 2012-07-last] if (even) [orange]; &
            \calendar[dates=2012-08-01 to 2012-08-last] if (even) [orange]; &
            \calendar[dates=2012-09-01 to 2012-09-last] if (even) [orange]; \\
            \calendar[dates=2012-10-01 to 2012-10-last] if (even) [orange]; &
                \calendar[dates=2012-11-01 to 2012-11-last] if (even) [orange]; &
            \calendar[dates=2012-12-01 to 2012-12-last] if (even) [orange]; \\


Now I want to colour the days alternately, i.e. jan 1, 3, 5... would be one colour and the rest another colour, for the whole year. This could either be a different font colour for the number or a background fill colour, I don't really mind, as long as there is an pretty way to distinguish odd and even numbered days of the year easily.

ps: this is just a minor annoyance, but my calendar is appearing on page 2 of a pdf file with a blank first page, and I'm not sure why. I'm making it like pdflatex wim_cal.tex wim_cal.pdf.

After some hours of mucking around I have made some small progress and edited my tex sample above (you can see the diff..) The first blank page thing is fixed.

Now I think I am almost there, if you search for the part \pgfcalendarifdatejulian , when I replace that with an even number then I get all days orange on the calendar, when I replace it with an odd number then I get all days black. But with \pgfcalendarifdatejulian as is, I get an error like ! Dimension too large. when doing pdflatex. What am I missing now?

Edit: I still have not solved this problem.. should I post a new, update question with my latest attempts?

  • The reason your calendar is on the second page is that it is too large to fit on one page with the given margin, and since you have an empty line before the calendar, TeX will fail to place it on the first page, and places it on the second page instead. Decrease your margin size, and remove the blank line before the tikzpicture environment. Jan 3, 2012 at 14:38
  • Once you update your question, it appears at the top of the featured (main) page, and should draw attention again, so it's best to do it that way if your answer is still not resolved.
    – Werner
    Jan 12, 2012 at 1:00

1 Answer 1


You could specify an if condition, such as

\calendar[dates=2012-01-01 to 2012-01-last] if (Monday,Wednesday,Friday,Sunday) [red];


Your calendar is appearing on page 2 because it's too high for the text area. You will get an Overfull \vbox warning and the tikzpicture is moved to the next page. Make it a bit smaller or adjust the text area.

  • That's good, but it's not the right if condition, e.g. sunday and monday are both red. with alternate days it would be like a checkerboard pattern, how can I get that? It should also alternate colours between last day of a month and first day of the next month.
    – wim
    Jan 4, 2012 at 2:19
  • @wim You could also use day code = { ... } as option to \calendar together with an \ifodd expression. I'll write something like this later today.
    – Stefan Kottwitz
    Jan 4, 2012 at 7:10
  • Hi , thanks for your advice. I have attempted and failed something like you're suggesting.. what could I fix in my edited code?
    – wim
    Jan 4, 2012 at 12:41
  • Do I have to define my own \ifodd expression, or is there something built-in ?
    – wim
    Jan 12, 2012 at 0:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .