Saturday, January 18, 2014

Kalender 2014

Mumpung masih hangat rasa di awal tahun, tulisan kali ini tentang pembuatan kalender. Tentu sangat beragam bentuk kalender yang dapat dibuat dan kalender yang saya dapat di forum ini salah satunya.
Saya reka-ulang seperlunya paket mcal yang ditulis dalam bahasa Portugis agar menjadi berbahasa Indonesia. Untuk ini saya berterimakasih kepada Manuel, rekan di forum.

Berikut ini paket mcal yang digunakan.

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

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

\pgfmathtruncatemacro{\Year}{2013}%
\pgfmathtruncatemacro{\monthcounter}{12}% Diciembre
\pgfmathtruncatemacro{\oldYear}{\Year}%
\pgfmathtruncatemacro{\newYear}{\Year}%
\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/S,1/S,2/R,3/K,4/J,5/S,6/M}{
            \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%
   Januari\else
    \ifnum\monthcounter=2% 
        Februari\else
        \ifnum\monthcounter=3% 
            Maret\else
            \ifnum\monthcounter=4% 
                April\else
                \ifnum\monthcounter=5% 
                    Mei\else
                    \ifnum\monthcounter=6% 
                        Juni\else
                        \ifnum\monthcounter=7% 
                            Juli\else
                            \ifnum\monthcounter=8% 
                                Agustus\else
                                \ifnum\monthcounter=9% 
                                    September\else
                                    \ifnum\monthcounter=10% 
                                        Oktober\else
                                        \ifnum\monthcounter=11% 
                                            November\else
                                            \ifnum\monthcounter=12% 
                                                Desember%
                                            \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 {Senin/2,Selasa/6,Rabu/10,Kamis/14,Jumat/18,Sabtu/22,Minggu/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{} \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\januari[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 {Senin/2,Selasa/6,Rabu/10,Kamis/14,Jumat/18,Sabtu/22,Minggu/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{} \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\februari\mes%
\let\maret\mes%
\let\april\mes%
\let\mei\mes%
\let\juni\mes%
\let\juli\mes%
\let\agustus\mes%
\let\september\mes%
\let\oktober\mes%
\let\november\mes%

\newcommand\desember[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 {Senin/2,Selasa/6,Rabu/10,Kamis/14,Jumat/18,Sabtu/22,Minggu/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{} \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
}

Kemudian berikut ini struktur dokumennya. 
\documentclass[border=4.9mm, bahasa, multi={tikzpicture}]{standalone}
\title{2014}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[T1]{fontenc}

\usepackage{mcal}

\begin{document}

\estilodetexto% pengaturan \sffamily, \bfseries…
\thisyear{2014}% Tahun untuk kalender yang dibuat.
\colordelosfestivos{red}% warna hari libur.
\remaincolor{white}% warna di bawah sisi atas persegi panjang (yang memuat nama bulan, bulan sebelumnya dan bulan berikutnya)
\resubcolor{white}% warna di bawah nama hari
\mooncounter=2% pengaturan bulan (0,1,2,3)
\januari{1,14,31}
\februari{}
\maret{31}
\april{18}
\mei{1,15,27,29}
\juni{}
\juli{28,29,30,31}
\agustus{1,17}
\september{}
\oktober{5,25}
\november{}
\desember{25,26}

\end{document}


Kalender yang dihasilkan seperti ini:




Adapun penandaan (dengan warna merah) hari libur nasional dan cuti bersama tahun 2014 berpedoman kepada Keputusan Bersama dari tiga kementerian berikut ini.



Dokumen di atas ditulis dengan menggunakan $\small\LaTeX$ melalui writeLaTeX.
Demikian semoga bermanfaat!

Adjie Gumarang Pujakelana 2014

-->

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...