Gist for the question https://tex.stackexchange.com/q/395330/117727
% %%%%%%%%%%%%%% | |
% Document setup | |
% %%%%%%%%%%%%%% | |
\documentclass[10pt,a4paper, landscape, german]{article} | |
\usepackage[T1]{fontenc} | |
\usepackage{babel} | |
\usepackage{translator} | |
% Page layout | |
\usepackage[headheight = 11ex, margin = .5cm, top = 3cm, nofoot, showframe = true]{geometry} | |
\usepackage{fancyhdr} | |
% Fonts | |
\usepackage{lmodern} | |
\renewcommand*\familydefault{\sfdefault} | |
% Drawing | |
\usepackage{tikz} | |
\usetikzlibrary{shapes} | |
\usetikzlibrary{fit} | |
\usepackage{pgfcore} | |
\usepackage{pgfcalendar} | |
% Logic and Tools | |
\usepackage{environ} | |
\usepackage{calc} | |
% %%%%%%%%% | |
% Variables | |
% %%%%%%%%% | |
\newcommand\currentyear{2017} | |
% Colors | |
\definecolor{primary}{HTML}{00CC00} | |
\definecolor{FKSem}{HTML}{84D4BC} | |
\definecolor{FKVor}{HTML}{A1DECC} | |
\definecolor{MolSem}{HTML}{BB84D5} | |
\definecolor{MolVor}{HTML}{CCA1DE} | |
\definecolor{OrgSem}{HTML}{D4BC84} | |
\definecolor{OrgVor}{HTML}{DECCA1} | |
\definecolor{Prak}{HTML}{B7C0D5} | |
% Author | |
\author{Sam Thilmany} | |
% Set the first and last hour of the day (24h day format) | |
\newcommand{\firstH}{8} | |
\newcommand{\lastH}{20} | |
% %%%%%%%%%%%% | |
% Calculations | |
% %%%%%%%%%%%% | |
% Add 1 to \currentyear to define \nextyear | |
\edef\nextyear{\the\numexpr\currentyear+1\relax} | |
% Converts a given time (hh.mm) to a length. \firstH is converted to 0. | |
\pgfmathdeclarefunction{time}{1}{% | |
\pgfmathparse{\firstH-(floor(#1)+(#1-floor(#1))/0.6)}% | |
} | |
% %%%%%% | |
% Header | |
% %%%%%% | |
\renewcommand{\headrulewidth}{0pt} | |
\fancyhf{} | |
\lhead{% | |
\fontsize{60}{70}\selectfont\bfseries{% | |
WS \currentyear/\nextyear | |
} | |
} | |
\pagestyle{fancy} | |
% %%%%%%%%%%%%%%%%%%%%%%% | |
% Macros and Environments | |
% %%%%%%%%%%%%%%%%%%%%%%% | |
% Macro for drawing calendar entries | |
\newcommand{\calentry}[7]{ | |
\path | |
(#1 - 0.75, {time(#2)}) coordinate (A) | |
(#1 + 0.25, {time(#3)}) coordinate (B); | |
\draw [draw = none] (A) rectangle (B); | |
\node [ | |
fit = {(A) (B)}, | |
inner sep = 0, | |
fill = #6, | |
draw = black, | |
text = #7, | |
text width = \entrytextwidth, | |
text centered, | |
] | |
{ | |
\small{\textbf{#4}} | |
\\ | |
\footnotesize{#5} | |
}; | |
} | |
% Timetable environment | |
\NewEnviron{timetable}% | |
{% | |
\begin{tikzpicture}[x = \widthofday, y = \lengthofhour] | |
% Draws the timtables grid | |
\foreach \hour in {\firstH, ..., \lastH}{ | |
\node[ | |
minimum height = .53cm, | |
text width = \entrytimewidth, | |
draw = primary | |
] at (0, \firstH - \hour) {\hour:00}; | |
} | |
\foreach \day in {0, ..., 4} { | |
\node[ | |
minimum height = .53cm, | |
text width = \entrytextwidth, | |
fill = primary, | |
text = white, | |
draw = primary, | |
text centered | |
] at (\day + 0.75, 1) {\pgfcalendarweekdayname{\day}}; | |
\foreach \hour in {\firstH, ..., \lastH}{ | |
\draw (\day + 0.25, \firstH - \hour) -- (\day + 1.25, \firstH - \hour); | |
} | |
} | |
{\BODY} | |
\end{tikzpicture} | |
}% | |
% %%%%%%%%%%%%%% | |
% Begin Document | |
% %%%%%%%%%%%%%% | |
\begin{document} | |
\newlength{\basewidth} | |
\setlength{\basewidth}{2\columnwidth/11} | |
\newlength{\widthofday} | |
\setlength{\widthofday}{\basewidth} | |
\newlength{\entrytextwidth} | |
\setlength{\entrytextwidth}{\widthofday} | |
\addtolength{\entrytextwidth}{-0.4cm} | |
\newlength{\timewidth} | |
\setlength{\timewidth}{.5\basewidth} | |
\newlength{\entrytimewidth} | |
\setlength{\entrytimewidth}{\timewidth} | |
\addtolength{\entrytimewidth}{-0.4cm} | |
\newlength{\lengthofhour} | |
\setlength{\lengthofhour}{1.25cm} | |
\centering | |
\begin{timetable} | |
% Monday | |
\calentry{1}{10.00}{10.45}{FK-Chemie}{Seminar}{FKSem}{black} | |
\calentry{1}{11.00}{11.45}{FK-Chemie}{Vorlesung}{FKVor}{black} | |
\calentry{1}{12.00}{12.45}{Org. Chemie}{Vorlesung}{OrgVor}{black} | |
% Tuesday | |
\calentry{2}{10.15}{11.00}{Mol.-Chemie}{Seminar}{MolSem}{black} | |
\calentry{2}{11.15}{12.00}{FK-Chemie}{Vorlesung}{FKVor}{black} | |
\calentry{2}{12.15}{13.00}{Org. Chemie}{Vorlesung}{OrgVor}{black} | |
\calentry{2}{13.45}{19.45}{Mol.- \& FK-Chemie}{Praktikum}{Prak}{black} | |
% Wednesday | |
\calentry{3}{11.15}{12.00}{Mol.-Chemie}{Vorlesung}{MolVor}{black} | |
\calentry{3}{12.15}{13.00}{Org. Chemie}{Vorlesung}{OrgVor}{black} | |
\calentry{3}{14.00}{20.00}{Mol.- \& FK-Chemie}{Praktikum}{Prak}{black} | |
% Thursday | |
\calentry{4}{8.15}{9.00}{Org. Chemie}{Seminar}{OrgSem}{black} | |
\calentry{4}{12.15}{13.00}{Org. Chemie}{Vorlesung}{OrgVor}{black} | |
\calentry{4}{14.00}{20.00}{Mol.- \& FK-Chemie}{Praktikum}{Prak}{black} | |
% Friday | |
\calentry{5}{8.15}{9.00}{Mol.-Chemie}{Vorlesung}{MolVor}{black} | |
\end{timetable} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment