Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question is triggered by a post from Peter Wilson in comp.text.tex`.

Peter wrote: TUG members produced a calendar for 2012 and, if I remember correctly, for some previous years as well. I really hope that there will there be one for 2013.

FYI The calendar should be generated with LaTeX and friends, including LaTeX-generated pictures.

My question is how do we do this in LaTeX?

The following is an example of the 2009 calendar.

2009 calendar.

share|improve this question
    
TeXample has a few examples –  cgnieder Jan 13 '13 at 14:13
    
@cgnieder Thanks. I knew about them. I was referring to examples of previous TUG calendars. –  Marc van Dongen Jan 13 '13 at 14:19
    
Well, since they are at least in some way related I thought it wouldn't hurt mentioning them here... :) –  cgnieder Jan 13 '13 at 14:22
    
@cgnieder Sure. As it turned out I also found an example on TeXample. –  Marc van Dongen Jan 13 '13 at 14:37

2 Answers 2

up vote 18 down vote accepted

Well, this is not exactly what you want, but I was thinking about asking for calendars a few weeks ago in order to make it a Community Wiki, but finally I didn't. However, I post here my solution (which is far far away from being optimal, I encourage all of you to make it better —but, of course, without changing the appearance–). I repeat, may be it's not what you want.

The file is this:

\documentclass[border=4.9mm, multi={tikzpicture}]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[T1]{fontenc}

% MCAL -------------------------------
\usepackage{mcal}
% MCAL -------------------------------

\begin{document}\estilodetexto% To set up \sffamily, \bfseries…
\thisyear{2013}% The year the calendar is about.
\colordelosfestivos{red}% The color of holidays.
\remaincolor{white}% The color under the top rectangle (where the title and the previous and next calendar are)
\resubcolor{white}% The color under the names of the week
\mooncounter=2% To set the first moon of the year (0,1,2,3)
\enero[7,14,21,28]{7}% The months …
\febrero[7,14,21,28]{1,2,3,7,9,25}
\marzo[7,14,21,28]{1,2,3,7,9,25}
\abril[7,14,21,28]{1,2,3,7,9,25}
\mayo[7,14,21,28]{1,2,3,7,9,25}
\junio[7,14,21,28]{1,2,3,7,9,25}
\julio[7,14,21,28]{1,2,3,7,9,25}
\agosto[7,14,21,28]{1,2,3,7,9,25}
\septiembre[7,14,21,28]{1,2,3,7,9,25}
\octubre[7,14,21,28]{1,2,3,7,9,25}
\noviembre[7,14,21,28]{1,2,3,7,9,25}
\diciembre[4,12,19,27]{6,8,25,31}
\end{document}

It uses a custom mcal.sty which I include later. The usage is easy, each month (now it's in spanish, but you get an idea) takes a mandatory argument, the days of the month which are holidays, separated by commas, and a optional argument, the days of the month with the moon phase.

enter image description here

You can see how it fully looks here.

Apart from that, the mcal.sty has this content:

\RequirePackage{tikz}
\usetikzlibrary{calc,calendar}
\RequirePackage{xcolor}

\def\estilodetexto{\sffamily\bfseries\LARGE}

\pgfmathtruncatemacro{\Year}{2013}%
\pgfmathtruncatemacro{\monthcounter}{12}% Diciembre
\pgfmathtruncatemacro{\oldYear}{\Year-1}%
\pgfmathtruncatemacro{\newYear}{\Year+1}%
\def\colorfestivos{red}
\def\maincolor{white}
\def\subcolor{white}

\def\remaincolor#1{%
\let\maincolor\relax%
\def\maincolor{#1}%
}

\def\resubcolor#1{%
\let\subcolor\relax%
\def\subcolor{#1}%
}

\def\colordelosfestivos#1{%
\let\colorfestivos\relax%
\def\colorfestivos{#1}%
}

\def\thisyear#1{%
\let\Year\relax%
\pgfmathtruncatemacro{\Year}{#1}%
}

\RequirePackage{etoolbox}
\RequirePackage{mathabx}

\newcommand*{\listadefestivos}[1]{%
    \def\festivos{}%
    \foreach \f in {#1} {%
        \xappto\festivos{if (day of month = \f) [\colorfestivos]}}%
}

\newcount\mooncounter
\def\moonreset{\global\mooncounter=-1\relax}
\moonreset

\def\moon{%
    \global\advance\mooncounter by 1\relax%
    \ifcase\mooncounter $\newmoon$%
        \or $\rightmoon$%
        \or $\fullmoon$%
        \or $\leftmoon$\global\mooncounter=-1\relax%
    \fi%
}

\newcommand*{\listadelunas}[1]{%
    \def\lunas{}%
    \foreach \l in {#1} {%
        \xappto\lunas{if (day of month = \l) [day text=\noexpand\moon\%d-]}
    }%
}

\makeatletter%
\tikzoption{day headings}{\tikzstyle{day heading}=[#1]}
\tikzstyle{day heading}=[]
\tikzstyle{day letter headings}=[
    execute before day scope={ \ifdate{day of month=1}{%
        \pgfmathsetlength{\pgf@ya}{\tikz@lib@cal@yshift}%
        \pgfmathsetlength\pgf@xa{\tikz@lib@cal@xshift}%
        \pgftransformyshift{-\pgf@ya}
        \foreach \d/\l in {0/L,1/M,2/X,3/J,4/V,5/S,6/D}{
            \pgf@xa=\d\pgf@xa%
            \pgftransformxshift{\pgf@xa}%
            \pgftransformyshift{\pgf@ya}%
            \node[every day,day heading]{\estilodetexto\Large\l};%
            } 
        }{}%
    }%
]
\makeatother

\pagestyle{empty}

\def\Month{%
\ifnum\monthcounter=1%
    Enero\else
    \ifnum\monthcounter=2% 
        Febrero\else
        \ifnum\monthcounter=3% 
            Marzo\else
            \ifnum\monthcounter=4% 
                Abril\else
                \ifnum\monthcounter=5% 
                    Mayo\else
                    \ifnum\monthcounter=6% 
                        Junio\else
                        \ifnum\monthcounter=7% 
                            Julio\else
                            \ifnum\monthcounter=8% 
                                Agosto\else
                                \ifnum\monthcounter=9% 
                                    Septiembre\else
                                    \ifnum\monthcounter=10% 
                                        Octubre\else
                                        \ifnum\monthcounter=11% 
                                            Noviembre\else
                                            \ifnum\monthcounter=12% 
                                                Diciembre%
                                            \fi%
                                        \fi%
                                    \fi%
                                \fi%
                            \fi%
                        \fi%
                    \fi%
                \fi%
            \fi%
        \fi%
    \fi%
\fi%
}

\def\findemes{\ifnum\monthcounter=12%
    \pgfmathtruncatemacro{\monthcounter}{1} \else%
        \pgfmathtruncatemacro{\monthcounter}{\monthcounter+1}%
\fi%
}

\def\nuevapagina{\findemes%
%\newpage%
}

\newcommand\mes[2][]{
\begin{tikzpicture}%
% Cuadrícula
        \draw[fill opacity=1,fill=\maincolor] (0,20) rectangle (28,16);%
        \draw[fill opacity=1,fill=\subcolor] (0,15) rectangle (28,16);%
        \draw[xstep=4cm, ystep=2.5cm] (0,0) grid (28,15);%
        \draw[xstep=4cm, ystep=1cm] (0,15) grid (28,16);%
        \draw (0,20) rectangle (28,16);%
        \foreach \dia/\posicion in {Lunes/2,Martes/6,Miércoles/10,Jueves/14,Viernes/18,Sábado/22,Domingo/26}{%
        \node (\dia) at (\posicion,15.5) {\dia};%
        }%
% Calendario mes anterior       
        \node (titulocalanterior) at (2.75,19.5) {\Month};%
        \calendar (calanterior) [dates=\Year-12-01 to \Year-12-last,%
            day xshift=1em,%
            day yshift = 1em-1ex,%
            day text=\normalsize \%d-,%
            week list,%
            day letter headings] at (1.2,18.7);%

        \findemes%
% CALENDARIO PRINCIPAL
        \listadelunas{#1}%
        \listadefestivos{#2}%
        \calendar[dates=\Year-\monthcounter-1 to \Year-\monthcounter-last,%
            week list,%
            day xshift = 4cm,%
            day yshift = 2.5cm,%
            if = {(Sunday) [\colorfestivos]},%
            ] at (4,14.3) \festivos \lunas;%

        \node[scale=2] (Mtitle) at (14,18) {\Huge \Month{} de \Year};%

        \findemes%
% Calendario mes siguiente
        \node (titulocalsiguiente) at (25.05,19.5) {\Month};%
        \calendar (calsiguiente) [dates=\Year-\monthcounter-1 to \Year-\monthcounter-last,%
            day xshift=1em,%
            day yshift = 1em-1ex,%
            day text=\normalsize \%d-,%
            week list,%
            day letter headings] at (23.5,18.7);%
\end{tikzpicture}
\nuevapagina
}

\newcommand\enero[2][]{
\begin{tikzpicture}%
% Cuadrícula
        \draw[fill opacity=1,fill=\maincolor] (0,20) rectangle (28,16);%
        \draw[fill opacity=1,fill=\subcolor] (0,15) rectangle (28,16);%
        \draw[xstep=4cm, ystep=2.5cm] (0,0) grid (28,15);%
        \draw[xstep=4cm, ystep=1cm] (0,15) grid (28,16);%
        \draw (0,20) rectangle (28,16);%
        \foreach \dia/\posicion in {Lunes/2,Martes/6,Miércoles/10,Jueves/14,Viernes/18,Sábado/22,Domingo/26}{%
        \node (\dia) at (\posicion,15.5) {\dia};%
        }%
% Calendario mes anterior       
        \node (titulocalanterior) at (2.75,19.5) {\Month};%
        \calendar (calanterior) [dates=\oldYear-12-01 to \oldYear-12-last,%
            day xshift=1em,%
            day yshift = 1em-1ex,%
            day text=\normalsize \%d-,%
            week list,%
            day letter headings] at (1.2,18.7);%

        \findemes%
% CALENDARIO PRINCIPAL
        \listadelunas{#1}%
        \listadefestivos{#2}%
        \calendar[dates=\Year-\monthcounter-1 to \Year-\monthcounter-last,%
            week list,%
            day xshift = 4cm,%
            day yshift = 2.5cm,%
            if = {(Sunday) [\colorfestivos]},%
            ] at (4,14.3) \festivos \lunas;%

        \node[scale=2] (Mtitle) at (14,18) {\Huge \Month{} de \Year};%

        \findemes%
% Calendario mes siguiente
        \node (titulocalsiguiente) at (25.05,19.5) {\Month};%
        \calendar (calsiguiente) [dates=\Year-\monthcounter-1 to \Year-\monthcounter-last,%
            day xshift=1em,%
            day yshift = 1em-1ex,%
            day text=\normalsize \%d-,%
            week list,%
            day letter headings] at (23.5,18.7);%
\end{tikzpicture}
\nuevapagina
}

\let\febrero\mes%
\let\marzo\mes%
\let\abril\mes%
\let\mayo\mes%
\let\junio\mes%
\let\julio\mes%
\let\agosto\mes%
\let\septiembre\mes%
\let\octubre\mes%
\let\noviembre\mes%

\newcommand\diciembre[2][]{
\begin{tikzpicture}%
% Cuadrícula
        \draw[fill opacity=1,fill=\maincolor] (0,20) rectangle (28,16);%
        \draw[fill opacity=1,fill=\subcolor] (0,15) rectangle (28,16);%
        \draw[xstep=4cm, ystep=2.5cm] (0,0) grid (28,15);%
        \draw[xstep=4cm, ystep=1cm] (0,15) grid (28,16);%
        \draw (0,20) rectangle (28,16);%
        \foreach \dia/\posicion in {Lunes/2,Martes/6,Miércoles/10,Jueves/14,Viernes/18,Sábado/22,Domingo/26}{%
        \node (\dia) at (\posicion,15.5) {\dia};%
        }%
% Calendario mes anterior       
        \node (titulocalanterior) at (2.75,19.5) {\Month};%
        \calendar (calanterior) [dates=\Year-12-01 to \Year-12-last,%
            day xshift=1em,%
            day yshift = 1em-1ex,%
            day text=\normalsize \%d-,%
            week list,%
            day letter headings] at (1.2,18.7);%

        \findemes%
% CALENDARIO PRINCIPAL
        \listadelunas{#1}%
        \listadefestivos{#2}%
        \calendar[dates=\Year-\monthcounter-1 to \Year-\monthcounter-last,%
            week list,%
            day xshift = 4cm,%
            day yshift = 2.5cm,%
            if = {(Sunday) [\colorfestivos]},%
            ] at (4,14.3) \festivos \lunas;%

        \node[scale=2] (Mtitle) at (14,18) {\Huge \Month{} de \Year};%

        \findemes%
% Calendario mes siguiente
        \node (titulocalsiguiente) at (25.05,19.5) {\Month};%
        \calendar (calsiguiente) [dates=\newYear-\monthcounter-1 to \newYear-\monthcounter-last,%
            day xshift=1em,%
            day yshift = 1em-1ex,%
            day text=\normalsize \%d-,%
            week list,%
            day letter headings] at (23.5,18.7);%
\end{tikzpicture}
\nuevapagina
}

As you can see, it is very basic and uses tikz's calendar library.

EDIT: It's in spanish (+ a bit of english, it was done fast and without thinking so much, you will se a lot of randomness inside :P). I will try to translate it into english in the future.

share|improve this answer
1  
Looks nice. Thanks. Your sources should make life much easier for others. –  Marc van Dongen Jan 13 '13 at 14:47
    
@MarcvanDongen Thank you! It was done to make the life easier to my mother, which annually makes the calendar for the whole family. –  Manuel Jan 13 '13 at 14:58

I wrote one for 2012... but i was lacking material for 2013 since i was writing my thesis in the past months. http://www.disk0s1.de/posts/latex/texianischer-kalender/

I basically used the following macro:

\newcommand{\mymo}[3]{%
    \begin{minipage}{\textwidth}%
        \centering%
        \noindent\Huge\pgfcalendarmonthname{\value{tgmymo}}\normalsize\stepcounter{tgmymo}\\[1cm]%
        #3
    \end{minipage}\vfill\begin{minipage}{\textwidth}\centering
    %
    \begin{tikzpicture} \pgfcalendar{cal}{#1}{#2}{%
        \ifdate{workday}%
        {\tikzset{filling/.style={fill=black!05}}}%
        {\tikzset{filling/.style={fill=orange!20}}}
        %%
        \def\normal{\node (\pgfcalendarsuggestedname) at (\pgfcalendarcurrentweekday*2.5,0) [filling,  rectangle,rounded corners, text width=.1\textwidth,text height=.8cm ,align=right] {\\$\pgfcalendarcurrentday$};}%
        %%
        \ifdate{equals=2013-01-10}{\node (\pgfcalendarsuggestedname) at (\pgfcalendarcurrentweekday*2.5,0) [filling,  rectangle,rounded corners, text width=.1\textwidth ,text height=.8cm ,align=right,] {{\small D.  E. Knuth}\\$\pgfcalendarcurrentday$};}{\normal}%
        \ifdate{equals=2013-02-07}{\node (\pgfcalendarsuggestedname) at (\pgfcalendarcurrentweekday*2.5,0) [filling,  rectangle,rounded corners, text width=.1\textwidth ,text height=.8cm ,align=right,] {{\small L. Lamport}\\$\pgfcalendarcurrentday$};}{}%
        \ifdate{equals=2013-05-05}{\node (\pgfcalendarsuggestedname) at (\pgfcalendarcurrentweekday*2.5,0) [filling,  rectangle,rounded corners, text width=.1\textwidth ,text height=.8cm ,align=right,] {{\small Julia}\\$\pgfcalendarcurrentday$};}{}%
        %
        \ifdate{equals=2013-08-01}{\node (\pgfcalendarsuggestedname) at (\pgfcalendarcurrentweekday*2.5,0) [filling,  rectangle,rounded corners, text width=.1\textwidth ,text height=.8cm ,align=right,] {{\small Tobias}\\$\pgfcalendarcurrentday$};}{}%
        %
        \ifdate{Sunday}{\pgftransformyshift{-4.2em}}{}%
        };
        \end{tikzpicture}\end{minipage}\clearpage}

This sets the page with the calender, the content (picture etc.) shall be invoked as argument #3. Like this: \mymo{2013-01-01}{2013-01-last}{\input{jan.tex}}.

enter image description here

It was printed on 100g/m^2 DIN A4 paper with a high res laser printer and shipped to some of my friends.

share|improve this answer
    
Thanks. Look nice. Perhaps stealing a few ideas from TeXample could turn this into a full-blown calendar. –  Marc van Dongen Jan 13 '13 at 14:53
    
like having Mo/Tu/... on the column headers or so? The appearance is exactly what i wanted a year ago... So i'm not quite familiar with the definition of a full-blown calendar. As i did for some birthdays any single date event can be set with pgf in case you want puplic holiday etc. –  bloodworks Jan 13 '13 at 16:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.