1 % DIN-A4 doublesided year calendar 2 % Author: Robert Krause 3 % License : Creative Commons attribution license 4 % Submitted to TeXample.net on 13 July 2012 5 documentclass[landscape,a4paper, ngerman, 10pt]{scrartcl} 6 usepackage[utf8]{inputenc} 7 usepackage[ngerman]{babel} 8 usepackage[T1]{fontenc} 9 usepackage{tikz} % Use the calendar.sty style 10 11 %usepackage{translator} % German Month and Day names 12 usepackage{fancyhdr} % header and footer 13 usepackage{fix-cm} % Large year in header 14 15 usepackage[landscape, headheight = 2cm, margin=.5cm, 16 top = 3.2cm, nofoot]{geometry} 17 usetikzlibrary{calc} 18 usetikzlibrary{calendar} 19 %%%< 20 usepackage{verbatim} 21 usepackage[tightpage]{preview} 22 PreviewEnvironment{tikzpicture} 23 setlengthPreviewBorder{5pt}% 24 %%%> 25 egin{comment} 26 :Title: A calender for doublesided DIN-A4 27 Tags: Calendar library;Calendars 28 :Author: Robert Krause 29 30 An example how the calendar package can be used to provide 31 an doublesided calendar for the whole year. 32 end{comment} 33 34 enewcommand*familydefault{sfdefault} 35 36 % User defined 37 defyear{2015} 38 % Names of Holidays are inserted by employing this macro 39 def ermin#1#2{ 40 ode [anchor=north west, text width= 3.4cm] at 41 ($(cal-#1.north west)+(3em, 0em)$) { iny{#2}}; 42 } 43 44 %Header 45 enewcommand{headrulewidth}{0.0pt} 46 setlength{headheight}{10ex} 47 chead{ 48 fontsize{60}{70}selectfont extbf{year} 49 Large extbf{Calendar}hfill 50 } 51 %Footer 52 cfoot{footnotesize exttt{http://www.cnblogs.com/wangshixi12/}} 53 54 55 56 egin{document} 57 pagestyle{fancy} 58 egin{center} 59 egin{tikzpicture}[every day/.style={anchor = north}] 60 calendar[ 61 dates=year-01-01 to year-06-30, 62 name=cal, 63 day yshift = 3em, 64 day code= 65 { 66 ode[name=pgfcalendarsuggestedname,every day,shape=rectangle, 67 minimum height= .53cm, text width = 4.4cm, draw = black]{ ikzdaytext}; 68 draw (-1.8cm, -.1ex) node[anchor = west]{footnotesize% 69 pgfcalendarweekdayshortname{pgfcalendarcurrentweekday}}; 70 }, 71 execute before day scope= 72 { 73 ifdate{day of month=1} 74 { 75 % Shift right 76 pgftransformxshift{4.8cm} 77 % Print month name 78 draw (0,0)node [shape=rectangle, minimum height= .53cm, 79 text width = 4.4cm, fill = white, text= black, draw = black, text centered] 80 { extbf{pgfcalendarmonthname{pgfcalendarcurrentmonth}}}; 81 }{} 82 ifdate{workday} 83 { 84 % normal days are white 85 ikzset{every day/.style={fill=white}} 86 % Vacation (Germany, Baden-Wuerrtemberg) gray background 87 ifdate{between=2012-12-24 and 2015-01-05}{% 88 ikzset{every day/.style={fill=white}}}{} 89 ifdate{between=2015-03-25 and 2015-04-05}{% 90 ikzset{every day/.style={fill=white}}}{} 91 ifdate{between=2015-05-21 and 2015-06-01}{% 92 ikzset{every day/.style={fill=white}}}{} 93 ifdate{between=2015-07-25 and 2015-09-07}{% 94 ikzset{every day/.style={fill=white}}}{} 95 ifdate{between=2015-10-28 and 2015-10-30}{% 96 ikzset{every day/.style={fill=white}}}{} 97 ifdate{between=2015-12-23 and 2014-01-04}{% 98 ikzset{every day/.style={fill=white}}}{} 99 }{} 100 % Saturdays and half holidays (Christma's and New year's eve) 101 ifdate{Saturday}{ ikzset{every day/.style={fill=white}}}{} 102 ifdate{equals=12-24}{ ikzset{every day/.style={fill=white}}}{} 103 ifdate{equals=12-31}{ ikzset{every day/.style={fill=white}}}{} 104 % Sundays and full holidays 105 ifdate{Sunday}{ ikzset{every day/.style={fill=white}}}{} 106 ifdate{equals=01-01}{ ikzset{every day/.style={fill=white}}}{} 107 ifdate{equals=01-06}{ ikzset{every day/.style={fill=white}}}{} 108 ifdate{equals=05-01}{ ikzset{every day/.style={fill=white}}}{} 109 ifdate{equals=10-03}{ ikzset{every day/.style={fill=white}}}{} 110 ifdate{equals=11-01}{ ikzset{every day/.style={fill=white}}}{} 111 ifdate{equals=12-25}{ ikzset{every day/.style={fill=white}}}{} 112 ifdate{equals=12-26}{ ikzset{every day/.style={fill=white}}}{} 113 % Christian holidays 114 ifdate{equals=2015-03-29}{ ikzset{every day/.style={fill=white}}}{} 115 ifdate{equals=2015-04-01}{ ikzset{every day/.style={fill=white}}}{} 116 ifdate{equals=2015-05-09}{ ikzset{every day/.style={fill=white}}}{} 117 ifdate{equals=2015-05-20}{ ikzset{every day/.style={fill=white}}}{} 118 ifdate{equals=2015-05-30}{ ikzset{every day/.style={fill=white}}}{} 119 }, 120 execute at begin day scope= 121 { 122 % each day is shifted down according to the day of month 123 pgftransformyshift{-.53*pgfcalendarcurrentday cm} 124 } 125 ]; 126 end{tikzpicture} 127 % Repeat the whole thing for the second page 128 pagebreak 129 egin{tikzpicture}[every day/.style={anchor = north}] 130 calendar[dates=year-07-01 to year-12-31, 131 name=cal, 132 day yshift = 3em, 133 day code= 134 { 135 ode[name=pgfcalendarsuggestedname,every day,shape=rectangle, 136 minimum height= .53cm, text width = 4.4cm, draw = black]{ ikzdaytext}; 137 draw (-1.8cm, -.1ex) node[anchor = west] 138 { 139 footnotesizepgfcalendarweekdayshortname{pgfcalendarcurrentweekday} 140 }; 141 }, 142 execute before day scope= 143 { 144 ifdate{day of month=1} { 145 % Shift right 146 pgftransformxshift{4.8cm} 147 % Print month name 148 draw (0,0)node [shape=rectangle, minimum height= .53cm, 149 text width = 4.4cm, fill = white, text= black, draw = black, text centered] 150 { 151 extbf{pgfcalendarmonthname{pgfcalendarcurrentmonth}} 152 }; 153 }{} 154 ifdate{workday} 155 { 156 ikzset{every day/.style={fill=white}} 157 % Vacation (Germany Baden-Wuerrtemberg) 158 ifdate{between=2012-12-24 and 2015-01-05}{% 159 ikzset{every day/.style={fill=white}}}{} 160 ifdate{between=2015-03-25 and 2015-04-05}{% 161 ikzset{every day/.style={fill=white}}}{} 162 ifdate{between=2015-05-21 and 2015-06-01}{% 163 ikzset{every day/.style={fill=white}}}{} 164 ifdate{between=2015-07-25 and 2015-09-07}{% 165 ikzset{every day/.style={fill=white}}}{} 166 ifdate{between=2015-10-28 and 2015-10-30}{% 167 ikzset{every day/.style={fill=white}}}{} 168 ifdate{between=2015-12-23 and 2014-01-04}{% 169 ikzset{every day/.style={fill=white}}}{} 170 }{} 171 % Sundays and full holidays 172 ifdate{Sunday}{ ikzset{every day/.style={fill=white}}}{} 173 ifdate{equals=01-01}{ ikzset{every day/.style={fill=white}}}{} 174 ifdate{equals=01-06}{ ikzset{every day/.style={fill=white}}}{} 175 ifdate{equals=05-01}{ ikzset{every day/.style={fill=white}}}{} 176 ifdate{equals=10-03}{ ikzset{every day/.style={fill=white}}}{} 177 ifdate{equals=11-01}{ ikzset{every day/.style={fill=white}}}{} 178 ifdate{equals=12-25}{ ikzset{every day/.style={fill=white}}}{} 179 ifdate{equals=12-26}{ ikzset{every day/.style={fill=white}}}{} 180 }, 181 execute at begin day scope= 182 { 183 % Each day is shifted down according to the day of month 184 pgftransformyshift{-.53*pgfcalendarcurrentday cm} 185 } 186 ]; 187 188 end{tikzpicture} 189 end{center} 190 end{document}