Debian Codegraph @

texmf-dist/source/lualatex/semesterplannerlua/semesterplannerlua.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2024 by Lukas Heindl <[email protected]>
4 % ---------------------------------------------------------------------------
5 % This work may be distributed and/or modified under the
6 % conditions of the LaTeX Project Public License, either version 1.3
7 % of this license or (at your option) any later version.
8 % The latest version of this license is in
9 % http://www.latex-project.org/lppl.txt
10 % and version 1.3 or later is part of all distributions of LaTeX
11 % version 2005/12/01 or later.
12 %
13 % This work has the LPPL maintenance status `maintained'.
14 %
15 % The Current Maintainer of this work is Lukas Heindl.
16 %
17 % This work consists of the files beamercolorthemeCatppuccin.dtx and beamercolorthemeCatppuccin.ins
18 % and the derived filebase beamercolorthemeCatppuccin.sty.
19 %
20 % \fi
21 %
22 % \iffalse
23 %<*driver>
24 \ProvidesFile{semesterplannerlua.dtx}
25 %</driver>
26 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
27 %<package>\ProvidesPackage{semesterplannerlua}
28 %<*package>
29 [2024/05/19 v1.1.2 Semesterplanner package in lua with tikz only]
30 %</package>
31 %
32 %<*driver>
33 \documentclass{ltxdoc}
34 \usepackage[a4paper,margin=25mm,left=50mm,nohead]{geometry}
35 \usepackage[numbered]{hypdoc}
36 \usepackage{array}
37 \usepackage{babel}
38 \usepackage{semesterplannerlua}[2024/02/27]
39 \EnableCrossrefs
40 \CodelineIndex
41 \RecordChanges
42 \begin{document}
43 \DocInput{\jobname.dtx}
44 \PrintChanges
45 \PrintIndex
46 \end{document}
47 %</driver>
48 % \fi
49 %
50 % \CheckSum{362}
51 %
52 % \CharacterTable
53 % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
54 % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
55 % Digits \0\1\2\3\4\5\6\7\8\9
56 % Exclamation \! Double quote \" Hash (number) \#
57 % Dollar \$ Percent \% Ampersand \&
58 % Acute accent \' Left paren \( Right paren \)
59 % Asterisk \* Plus \+ Comma \,
60 % Minus \- Point \. Solidus \/
61 % Colon \: Semicolon \; Less than \<
62 % Equals \= Greater than \> Question mark \?
63 % Commercial at \@ Left bracket \[ Backslash \\
64 % Right bracket \] Circumflex \^ Underscore \_
65 % Grave accent \` Left brace \{ Vertical bar \|
66 % Right brace \} Tilde \~}
67 %
68 %
69 % \changes{v0.0.0}{2021/10/07}{First draft}
70 % \changes{v0.0.1}{2022/04/28}{Added new options (providing day
71 % representation in source code)}
72 % \changes{v0.0.2}{2022/04/30}{Write out timetable data to be able to build
73 % e.g. something with dmenu over it and provide an example dmenu lua
74 % script}
75 % \changes{v0.0.3}{2024/02/25}{Rename to semesterplannerLua and rewrite for
76 % l3build}
77 % \changes{v1.0.0}{2024/02/27}{First full release}
78 % \changes{v1.1.0}{2024/05/19}{Make ready for CTAN}
79 % \changes{v1.1.1}{2024/05/19}{Make ready for CTAN (2)}
80 % \changes{v1.1.2}{2024/05/19}{Typos corrected, \textbackslash laboratory and \textbackslash fieldstudy types added to timetamble}
81 %
82 %
83 % \DoNotIndex{\newcommand,\newenvironment,\\,\begin,\end,\def,\definecolor,\directlua,\endinput,\faBullhorn,\faCamera,\faFlag,\faQuestion,\faTimesCircle,\faWarning,\faWindows,\faYoutubePlay,\node,\pgfkeys,\pgfkeysvalueof,\protected,\raggedright,\textbf,\textcolor,\textwidth,\unexpanded,\",\x,\y,\year,\week,\tiny,\tikz@lib@cal@xshift,\tikz@lib@cal@yshift,\tikz,\textit,\t,\section,\phantom,\pgftransformyshift,\pgftransformxshif,\pgfmathsetlength,\pgf@ya,\pgf@xa,\openout,\n,\newwrite,\month,\minuteToFrac,\matrix,\l,\jobname,\init,\immediate,\ignorespaces,\ifdate,\hfil,\href,\foreach,\faStickyNoteO,\faPencil,\faComment,\faClockO,\faCalendar,\faBold,\draw,\d,\day,\checkKeys,\%,\RequirePackage,\usepackage,\usetikzlibrary,\pgftransformxshift}
84 %
85 % \providecommand*{\url}{\texttt}
86 % \GetFileInfo{semesterplannerlua.dtx}
87 % \title{\textsf{semesterplannerLua} --- Semesterplanner package in lua
88 % with tikz only
89 % }
90 % \author{Lukas Heindl \\ \url{[email protected]} \\ \faGithub:
91 % \url{https://github.com/atticus-sullivan/semesterplannerLua}}
92 % \date{\fileversion~from \filedate}
93 %
94 % \maketitle
95 %
96 % \begin{abstract}
97 % This package provides a mean to easily print a timetable e.g. for a
98 % semesterplan. The reason for this package to exist is that I wanted to
99 % reimplement \url{https://github.com/nlschn/semesterplanner/} with
100 % printing the timetable with |tikz| only (which is more easily to be
101 % modified) and with the ability of making entries spanning only a fraction
102 % of the column (for showing simultanious events).
103 %
104 % Documents using this package need to be compiled with
105 % LuaLaTeX. The package requires |xcolor|, |fontawesome|, |tikz| (and |pgfkeys|).
106 % \end{abstract}
107 %
108 % \tableofcontents
109 %
110 % \section{Usage}
111 % Load with |\usepackage{semesterplannerlua}|
112 % \subsection{timetable}
113 %
114 % \DescribeEnv{timetable} |\begin{timetable}[opts]...\end{timetable}|\\
115 % This is the core environment of this package. Within it you can use
116 % |\lecture|, |\seminar|, |\tutorial|, |\officehour|, |\laboratory|,
117 % |\fieldstudy| and |\meeting|. All these commands are only defined inside the
118 % |timetable| environment, and have the same structure. It typesets a timetable
119 % with the specified entries. If you have a look at the |.sty| file you'll see
120 % that these macros just take a general macro and set some default values
121 % before. Thus it is easy to define new ones (keep in mind that you'll need
122 % |\makeatletter|) to access the general macro.
123 %
124 % Writes out a file containing the data from the timetable (your events) to
125 % be able to have just the |.tex| file containing the timetable, but do
126 % some scriping on the data (e.g. show the last, current and next events).
127 % For simplicity the data is stored in lua-syntax (|return|s a table of the
128 % events). This way we don't need to worry about any string escaping (like
129 % with csv) and no complicated parsers are needed. Be aware though that a
130 % simple |events = dofile"path"| has risks since |"path"| might contain lua
131 % code which is simply executed that way.
132 %
133 % |opts| are optional arguments (enclosed with |{}|) separated with |,|:
134 % \begin{description}
135 % \item[|days|] List of the names of the days that should be set as
136 % column names. Note that if you specify only 4 names only these 4
137 % columns will be printed (with the first day being identified as
138 % Monday)
139 % \textit{Default: |Mon,Tue,Wend,Thur,Fri|}
140 % \item[|dayse|] List of strings used in the code to idenfity the day.
141 % This list is kind of a mapping string $\to$ integer.
142 % \item[|start time|] Explicit start-time of the timetable given in minutes
143 % (|HH*60 + MM|). Can be set as |start time/.evaluated={HH*60 + MM}|.
144 % If this is empty, the start time is derived from the given events.
145 % \textit{Default: |""|}
146 % \item[|end time|] Equivalent to |start-time|
147 % \textit{Default: |""|}
148 % \item[|width|] Give the width of the timetable. (can be given e.g. as
149 % |\textwidth| as this is directly given to tikz).
150 % \textit{Default:} |\textwidth|
151 % \item[|length|] Give the length of the timetable (measured in |cm|)
152 % (has to be a straight number since this is needed in calculation)
153 % \textit{Default: 10}
154 % \end{description}
155 %
156 % \DescribeMacro{\lecture} |\lecture [opts]|
157 %
158 % \DescribeMacro{\tutorial} |\tutorial [opts]|
159 %
160 % \DescribeMacro{\seminar} |\seminar [opts]|
161 %
162 % \DescribeMacro{\officehour} |\officehour[opts]|
163 %
164 % \DescribeMacro{\meeting} |\meeting [opts]|
165 %
166 % \DescribeMacro{\fieldstudy} |\fieldstudy[opts]|
167 %
168 % \DescribeMacro{\laboratory} |\laboratory[opts]|
169 %
170 % |opts| are optional arguments (enclosed with |{}|) separated with |,|:
171 % \begin{description}
172 % \item[|title|] Give the name of the lecture
173 % \item[|speaker|] Give the name of the lecturer
174 % \item[|location|] Give the place of the event (most probably the room or
175 % an online plattform, see \ref{icons}). If you want to use
176 % |\href{url}{string repr}|, keep in mind that you need to
177 % |\unescaped{}| it, since all input to lua has to be text
178 % \item[|day|] The weekday on which the event takes place. Has to be
179 % one of those you specified in |dayse| (or by default: |M|,|T|,|W|,|Th|,|F|)
180 % \item[|time|] The timespan of the event formatted as |HH:MM-HH:MM|
181 % (24H clock)
182 % \item[|prio|] The priority of the event (see \ref{icons})
183 % \item[|scale width|] Specify the width of the entry in fractions
184 % of column (use |0.5| to span half the column).
185 % \item[|offset|] Shift the entry to the right. Specified in fractions
186 % of column.
187 % \item[|password|] Original purpose: Only included in the file written
188 % out with the timetable data, to be able to make a script which
189 % quickly copies url (from |location|) and |password| to the clipboard.
190 % \item[|type|] Only included in the file written out with the
191 % timetable data as well (Original purpose: To be able to exclude some
192 % types)
193 % \item[|tikz|] Free customizable event code. See the documentation
194 % at the end for keys that can be used here (all keys in |/event|). To
195 % simply pass arguments to the tikz-node that is being created for the
196 % event use |tikz/.append={your arguments}| (be careful with |text width|,
197 % |text height|, |text depth| as these keys are being used for
198 % the dimensions of the node as well as with |anchor|)
199 % \item[|content|] Is usually set automatically based on the other keys
200 % (|title|for instance). This key can override this.
201 % \item[|textcolor|] Usually set by the type of macro used
202 % \item[|formatter|] internal stub for providing different formatting
203 % options. Formatting functions need to be specified in the
204 % |-timetable.lua| file
205 % \end{description}
206 % The entries |Day| and |Time| are mandatory since they are needed for the
207 % positioning of the node. All others are merely necessary for the content
208 % of the node and are therefore nor mandatory.
209 %
210 % \subsubsection{Special Notes}
211 % Note that the |length| argument does specify the length of the timetable
212 % without taking account of the column headers.
213 %
214 % Same goes for the |width| parameter regarding the labels containing the
215 % time on the right. Since in this case any tex-lenght is allowed, you can
216 % simply try to subtract the length of the clock label using something like
217 % |\settowidth{\length}{12:30}| to set a length to the length of a clock
218 % label and then subtract this from the length you want to specify.
219 %
220 % \hangindent=4.5em \hangafter=1 \textbf{Hint:} The content of the environment
221 % isn't processed by this package. Only the event commands (so to speak
222 % |\lecture|,|\tutorial|,|\seminar|,|\officehour|,|\fieldstudy|,|\laboratory|,|\meeting|
223 % are relevant. All other contents are set immediately before the timetable.
224 % Therefore, if you wan to add e.g. a |\hspace*{10cm}| to shift the timetable
225 % to the left, the last line of the env would be the place to do so (there
226 % musn't be an empty line below since otherwise a new paragraph is started).
227 %
228 % \newpage
229 % \subsubsection{Example}
230 % |\begin{timetable}[|\\
231 % | days={Mon,Tue,Wend,Thur,Fri},|\\
232 % | start time/.evaluated={11*60}, end time/.evaluated={15*60}|\\
233 % | ]|\\
234 % | \lecture[title={Testing Lecture LongOne},speaker={Doe},|\\
235 % | location={RN1},day={W},time={12:30-13:30}]|\\
236 % | \tutorial[title={Testing Lecture LongOne},speaker={John},|\\
237 % | location={RN1},day={Th},time={12:30-13:30},offset=0.5,scale width=0.5]|\\
238 % | \lecture[title={Testing Lecture LongOne},speaker={Dr. Doe},|\\
239 % | location={\zoom},day={T},time={12:30-13:30},prio={\phigh}]|\\
240 % |\end{timetable}|\\
241 %
242 % \begin{timetable}[days={Mon,Tue,Wend,Thur,Fri},start time/.evaluated={11*60}, end time/.evaluated={15*60}]
243 % \lecture[title={Testing Lecture LongOne},speaker={Doe},
244 % location={RN1},day={W},time={12:30-13:30}]
245 % \tutorial[title={Testing Lecture LongOne},speaker={John},
246 % location={RN1},day={Th},time={12:30-13:30},offset=0.5,scale width=0.5]
247 % \lecture[title={Testing Lecture LongOne},speaker={Dr. Doe},
248 % location={\zoom},day={T},time={12:30-13:30},prio={\phigh}]
249 % \end{timetable}
250 %
251 % \subsection{Calendar related things}
252 % Now some environments and commands come which in generally are being used
253 % to typeset a table with the detailed information, but which also store
254 % the gathered data internally.\\
255 % This saved data can be used to output a calendar where the events (from
256 % the saved data) are highlighted with a mark (already passed days are
257 % crossed and the current day is highlighted as well).
258 %
259 % The different environments described below are similar in general, but
260 % differ in detail (mostly the list of argument that are passed and printed
261 % in the table).
262 %
263 % \newpage
264 % \paragraph{Example}\mbox{}\\
265 % |\begin{appointments}{true}|\\
266 % | \appointment[print=true,shift=false,tikz={fill=black,rectangle},|\\
267 % | date={2022-04-15}, course={Appointment with my dog},|\\
268 % | end={2022-04-18}, period={1}]|\\
269 % | \appointment[date={2022-04-14}, course={Appointment with my dog},|\\
270 % | room={at home}, time={12:00}, prio={\pmandatory}]|\\
271 % |\end{appointments}|\\
272 % |\begin{exams}{false}|\\
273 % | \exam[tikz={fill=yellow}, date={2022-06-20}, time={arround midday},|\\
274 % | course={Driving}, desc={Mid-Term}, prio={\phigh},|\\
275 % | room={University}, type={\oral}]|\\
276 % |\end{exams}|\\
277 % |\begin{deadlines}{false}|\\
278 % | \deadline[tikz={fill=blue}, date={2022-06-22},|\\
279 % | course={Submitting Driver-license form}, prio={\phigh}]|\\
280 % |\end{deadlines}|\\
281 % ||\\
282 % |\printSpCalendar[2]{2022-04-01}{2022-07-31}|
283
284 % \begin{appointments}{true}
285 % \appointment[print=true,shift=false,tikz={fill=black,rectangle}, date={2022-04-15}, course={Appointment with my dog}, end={2022-04-18}, period={1}]
286 % \appointment[date={2022-04-14}, course={Appointment with my dog}, room={at home}, time={12:00}, prio={\pmandatory}]
287 % \end{appointments}
288 % \begin{exams}{false}
289 % \exam[tikz={fill=yellow}, date={2022-06-20}, time={arround midday}, course={Driving}, desc={Mid-Term}, prio={\phigh}, room={University}, type={\oral}]
290 % \end{exams}
291 % \begin{deadlines}{false}
292 % \deadline[tikz={fill=blue}, date={2022-06-22}, course={Submitting Driver-license form}, prio={\phigh}]
293 % \end{deadlines}
294 %
295 % \printSpCalendar[2]{2022-04-01}{2022-07-31}
296 %
297 % \DescribeMacro{\printSpCalendar} |\printSpCalendar[cols]{start_date}{end_date}|\\
298 % This is the macro to output such a calendar populated with the gathered
299 % events.\\
300 % Use the |cols| argument to specify the amount of columns being used
301 % (months set side by side).\\
302 % |start_date| and |end_date| both have to be specified in the |YYYY-MM-DD|
303 % format.
304 %
305 % \subsubsection{Appointments}
306 % \DescribeEnv{appointments} |\begin{appointments}[Room]{true/false}...\end{appointments}|\\
307 % Environment to typeset a table of appointments. Stores the data
308 % internally to be able to typeset a calendar (with |\printSpCalendar|)
309 % with a mark for each event.\\
310 % The optional argument is used as header for the |Room| column (maybe for
311 % some appointments another title is more suitable).\\
312 % The mandatory argument which is |true/false| decides if the internally
313 % stored data used to typeset the calendar is being erased before this
314 % environment.
315 %
316 % \DescribeMacro{\appointment} |\appointment[opts]|\\
317 % |opts| are optional arguments (enclosed with |{}|) separated with |,|:
318 % \begin{description}
319 % \item[|date|] Date of the appointment formatted as |YYYY-MM-DD|
320 % \item[|course|] Name of the course
321 % \item[|room|] Room (only shown in the table)
322 % \item[|time|] Time of the event (free text independant of any
323 % formatting, only shown in the table)
324 % \item[|prio|] priority of the event (shown in the table) (see
325 % \ref{icons})
326 % \item[|desc|] Description of the event (shown in the table)
327 % \item[|end|] upper boundary when the event should stop to repeat (with
328 % |period|). Has to be set to make event periodic/repeating.
329 % \item[|period|] Set the period of the repeating event.
330 % \item[|draw|] |true/false| wether to draw a mark in the calendar
331 % \item[|print|] |true/false| wether to display te entry in the
332 % appointments table.
333 % \item[|shift|] |true/false| wether to shift the mark in the calendar if
334 % there is already another event on that date (to be able to see both
335 % marks)
336 % \item[|tikz|] Free customizable tikz code used for drawing the mark
337 % in the calendar. See the documentation at the end for keys that can
338 % be used here (all keys in |/cal|). To simply pass arguments to the
339 % tikz-node that is being created for the event use |tikz/.append={your arguments}|\\
340 % Use e.g. to set the color of the mark via |tikz/.append={green}|
341 % \end{description}
342 % \subsubsection{Exams}
343 % \DescribeEnv{exams} |\begin{exams}{true/false}...\end{exams}|\\
344 % Environment to typeset a table of exams. Stores the data
345 % internally to be able to typeset a calendar (with |\printSpCalendar|)
346 % with a mark for each event.\\
347 % The mandatory argument which is |true/false| decides if the internally
348 % stored data used to typeset the calendar is being erased before this
349 % environment.
350 %
351 % \DescribeMacro{\exam} |\exam[opts]|\\
352 % |opts| are optional arguments (enclosed with |{}|) separated with |,|:
353 % \begin{description}
354 % \item[|date|] Date of the exam formatted as |YYYY-MM-DD|
355 % \item[|course|] Name of the course
356 % \item[|room|] Room (only shown in the table)
357 % \item[|type|] Type of the exam (see \ref{icons}) (intended:
358 % written/oral)
359 % \item[|time|] Time of the event (free text independant of any
360 % formatting, only shown in the table)
361 % \item[|desc|] Description of the event (shown in the table)
362 % \item[|draw|] |true/false| wether to draw a mark in the calendar
363 % \item[|print|] |true/false| wether to display te entry in the
364 % exams table.
365 % \item[|shift|] |true/false| wether to shift the mark in the calendar if
366 % there is already another event on that date (to be able to see both
367 % marks)
368 % \item[|tikz|] Free customizable tikz code used for drawing the mark
369 % in the calendar. See the documentation at the end for keys that can
370 % be used here (all keys in |/cal|). To simply pass arguments to the
371 % tikz-node that is being created for the event use |tikz/.append={your arguments}|\\
372 % Use e.g. to set the color of the mark via |tikz/.append={green}|
373 % \end{description}
374 %
375 % \subsubsection{Deadlines}
376 % \DescribeEnv{deadlines} |\begin{deadlines}{true/false}...\end{deadlines}|\\
377 % Environment to typeset a table of deadlines. Stores the data
378 % internally to be able to typeset a calendar (with |\printSpCalendar|)
379 % with a mark for each event.\\
380 % The mandatory argument which is |true/false| decides if the internally
381 % stored data used to typeset the calendar is being erased before this
382 % environment.
383 %
384 % \DescribeMacro{\deadline} |\deadline[opts]|\\
385 % |opts| are optional arguments (enclosed with |{}|) separated with |,|:
386 % \begin{description}
387 % \item[|date|] Date of the deadline formatted as |YYYY-MM-DD|
388 % \item[|course|] Name of the course
389 % \item[|prio|] priority of the event (shown in the table) (see
390 % \ref{icons})
391 % \item[|desc|] Description of the event (shown in the table)
392 % \item[|draw|] |true/false| wether to draw a mark in the calendar
393 % \item[|print|] |true/false| wether to display te entry in the
394 % deadlines table.
395 % \item[|shift|] |true/false| wether to shift the mark in the calendar if
396 % there is already another event on that date (to be able to see both
397 % marks)
398 % \item[|tikz|] Free customizable tikz code used for drawing the mark
399 % in the calendar. See the documentation at the end for keys that can
400 % be used here (all keys in |/cal|). To simply pass arguments to the
401 % tikz-node that is being created for the event use |tikz/.append={your arguments}|\\
402 % Use e.g. to set the color of the mark via |tikz/.append={green}|
403 % \end{description}
404 %
405 % \subsection{Icons}\label{icons}
406 % This package defines some modified fontawesome icons (they are being
407 % encircled with a white circle for better readability).\\
408 % \begin{tabular}{rl|rl}
409 % |\zoom| & \textcolor{DodgerBlue}{\faCamera} &
410 % |\teams| & \textcolor{DodgerBlue}{\faWindows}
411 % \\
412 % |\BBB| & \textcolor{DodgerBlue}{\faBold} &
413 % |\youtube| & \textcolor{DodgerBlue}{\faYoutubePlay}
414 % \\\hline
415 % |\pmandatory| & \textcolor{red}{\faWarning} &
416 % |\phigh| & \textcolor{red}{\faFlag}
417 % \\
418 % |\pmid| & \textcolor{yellow}{\faFlag} &
419 % |\plow| & \textcolor{green}{\faFlag}
420 % \\
421 % |\pnone| & \textcolor{gray}{\faTimesCircle}
422 % \\ \hline
423 % |\tbd| & \faQuestion &
424 % |\tba| & \faBullhorn
425 % \end{tabular}
426 %
427 %
428 %
429 % \newpage
430 % \section{Implementation}
431 % This package uses |semesterplannerLua| as prefix/directory where
432 % possible. Since this is not possible for latex macro names, in this
433 % occasions |semesterplannerLua@| is used as prefix.
434 % \subsection{semesterplannerlua.sty}
435 % \subsubsection{Global Stuff}
436 % \begin{macrocode}
437 %<*package>
438 \RequirePackage{tikz}
439 \usetikzlibrary{calendar, positioning, shapes.misc, backgrounds}
440 \RequirePackage{pgfkeys}
441 \RequirePackage{xcolor}
442 \RequirePackage{fontawesome}
443 \RequirePackage{luapackageloader} % use the default lua path as well
444 % \end{macrocode}
445 % Define some colors for the course types (can be globally overwritten)
446 % \begin{macrocode}
447 \definecolor{seminar}{rgb}{1.0, 0.8, 0.0}
448 \definecolor{lecture}{rgb}{0.2, 0.7, 1.0}
449 \definecolor{tutorial}{rgb}{0.0, 0.8, 0.0}
450 \definecolor{meeting}{rgb}{0.8, 0.0, 0.0}
451 \definecolor{laboratory}{rgb}{0.8, 0.0, 0.0}
452 \definecolor{fieldstudy}{rgb}{0.8, 0.0, 0.0}
453 \definecolor{officehour}{rgb}{0.0, 0.4, 0.6}
454 \definecolor{DodgerBlue}{HTML}{1E90FF}
455 % \end{macrocode}
456 % \begin{macro}{\semesterplannerLua@encircle}
457 % This macro puts a circle arround its argument for better readability. In
458 % this package this is used for the fontawesome symbols.
459 % \begin{macrocode}
460 \newcommand*{\semesterplannerLua@encircle}[1]{
461 \begin{minipage}[b][1em][c]{1.5em}
462 \begin{tikzpicture}
463 \node[fill,circle,inner sep=1pt, color = white] {#1};
464 \end{tikzpicture}
465 \end{minipage}
466 }
467 % \end{macrocode}
468 % \end{macro}
469 % Commands for exams
470 % \begin{macro}{\oral}
471 % \begin{macrocode}
472 \protected\def\oral{\faComment}
473 % \end{macrocode}
474 % \end{macro}
475 % \begin{macro}{\written}
476 % \begin{macrocode}
477 \protected\def\written{\faPencil}
478 % \end{macrocode}
479 % \end{macro}
480 % Commands for symbols of priority
481 % \begin{macro}{\pmandatory}
482 % \begin{macrocode}
483 \protected\def\pmandatory{\semesterplannerLua@encircle{\textcolor{red}{\faWarning}}}
484 % \end{macrocode}
485 % \end{macro}
486 % \begin{macro}{\phigh}
487 % \begin{macrocode}
488 \protected\def\phigh{\semesterplannerLua@encircle{\textcolor{red}{\faFlag}}}
489 % \end{macrocode}
490 % \end{macro}
491 % \begin{macro}{\pmid}
492 % \begin{macrocode}
493 \protected\def\pmid{\semesterplannerLua@encircle{\textcolor{yellow}{\faFlag}}}
494 % \end{macrocode}
495 % \end{macro}
496 % \begin{macro}{\plow}
497 % \begin{macrocode}
498 \protected\def\plow{\semesterplannerLua@encircle{\textcolor{green}{\faFlag}}}
499 % \end{macrocode}
500 % \end{macro}
501 % \begin{macro}{\pnone}
502 % \begin{macrocode}
503 \protected\def\pnone{\semesterplannerLua@encircle{\textcolor{gray}{\faTimesCircle}}}
504 % \end{macrocode}
505 % \end{macro}
506
507 % Commands for online platforms.
508 % \begin{macro}{\teams}
509 % \begin{macrocode}
510 \protected\def\teams{\semesterplannerLua@encircle{\textcolor{DodgerBlue}{\faWindows}}}
511 % \end{macrocode}
512 % \end{macro}
513 % \begin{macro}{\zoom}
514 % \begin{macrocode}
515 \protected\def\zoom{\semesterplannerLua@encircle{\textcolor{DodgerBlue}{\faCamera}}}
516 % \end{macrocode}
517 % \end{macro}
518 % \begin{macro}{\youtube}
519 % \begin{macrocode}
520 \protected\def\youtube{\semesterplannerLua@encircle{\textcolor{red}{\faYoutubePlay}}}
521 % \end{macrocode}
522 % \end{macro}
523 % \begin{macro}{\BBB}
524 % \begin{macrocode}
525 \protected\def\BBB{\semesterplannerLua@encircle{\textcolor{DodgerBlue}{\faBold}}}
526 % \end{macrocode}
527 % \end{macro}
528
529 % Command for "To be determined" and "To be Announced"
530 % \begin{macro}{\tbd}
531 % \begin{macrocode}
532 \protected\def\tbd{\faQuestion}
533 % \end{macrocode}
534 % \end{macro}
535 % \begin{macro}{\tba}
536 % \begin{macrocode}
537 \protected\def\tba{\faBullhorn}
538 % \end{macrocode}
539 % \end{macro}
540
541
542 % Load the lua modules
543 % \begin{macrocode}
544 \directlua{sp = require("semesterplannerLua_timetable.lua")}
545 \directlua{cal = require("semesterplannerLua_calendar.lua")}
546 % \end{macrocode}
547 % Set all the pgfkeys required for the arguments. To achieve that the
548 % defaults are restored every time the environment is used, this is
549 % inside the environment definition. This of course disables all
550 % possibilities of setting a global default but enables setting local
551 % defaults for the events
552 % \begin{macrocode}
553 \pgfkeys{
554 % \end{macrocode}
555 % |/semesterplannerLua| will be the pgf-path used for this package. Here
556 % all used keys are set (and initialized with defaults. |timetable/env/|:
557 % \begin{description}
558 % \item[|days|] is a list of
559 % strings representing the header names for the day columns in the
560 % timetable (adding Sat and Sun (additional entries) will result in
561 % two more columns.
562 % \item[|start time|] can be used to set a fixed time where the timetable
563 % starts (otherwise this is calculated from the entries) to enable
564 % this behaviour this key has to be set to |HH*60 + MM| (easy way
565 % is by using |start time/.evaluated={HH*60+MM}|)
566 % \item[|end time|] equivalent to |start time|
567 % \item[|width|] is
568 % the horizontal width of the timetable (not including the column
569 % headers on the top) this can be a latex length string or
570 % |\textwidth| as well.
571 % \item[|length|] is the vertical length of the
572 % timetable (not including the clock labels on the side)
573 % measured in cm (in future versions this may become measured in
574 % pts for better interaction with the LaTeX lengths.
575 % \end{description}
576 % \begin{macrocode}
577 /semesterplannerLua/timetable/env/.cd,
578 days/.initial={Mon,Tue,Wend,Thur,Fri}, days/.default={Mon,Tue,Wend,Thur,Fri},
579 dayse/.initial={M,T,W,Th,F}, dayse/.default={M,T,W,Th,F},
580 %
581 start time/.initial=, start time/.default=,
582 end time/.initial=, end time/.default=,
583 %
584 width/.initial=\textwidth, width/.default=\textwidth,
585 length/.initial=10, length/.default=10,
586 %
587 % \end{macrocode}
588 % |timetable/event/|:
589 % \begin{description}
590 % \item[|content|] is the content of the event (is passed on without any
591 % formatting). Since this is passed to lua without modification
592 % its value must be an unexpanded string (lua will simply print
593 % it so the eventually the string will be evaluated)
594 % \item[|time|] is a |HH:MM-HH:MM| string representing start- and
595 % end-time of the event. Used in constructing the content as well
596 % \item[|day|] is either |M|,|T|,|W|,|Th| or |F| specifying the day on
597 % which the event takes place
598 % \item[|tikz|] this key allows the user to manually pass options to the
599 % node created for this event
600 % \item[|scale width|] allows to scale the width of the event to be able
601 % to draw overlapping events besides each other. Will usually be a
602 % value between |0| and |1|.
603 % \item[|offset|] same goal like |scale width| but shifts the event node
604 % by the given value to the right. (Given as value between |0| and
605 % |1| indicating how many columns the event should be shifted)
606 % \item[|textcolor|] foreground color of the content text
607 % \item[|title|] title (set in bold by default)
608 % \item[|speaker|]
609 % \item[|location|]
610 % \item[|prio|]
611 % \item[|formatter|] this is special
612 % \end{description}
613 % \begin{macrocode}
614 /semesterplannerLua/timetable/event/.cd,
615 % event arguments
616 content/.initial=, content/.default=,
617 %
618 time/.initial=, time/.default=,
619 day/.initial=, day/.default=,
620 %
621 tikz/.initial=, tikz/.default=,
622 scale width/.initial=1, scale width/.default=1,
623 offset/.initial=0, offset/.default=0,
624 %
625 textcolor/.initial=, textcolor/.default=,
626 title/.initial=, title/.default=,
627 speaker/.initial=, speaker/.default=,
628 location/.initial=, location/.default=,
629 password/.initial=, password/.default=,
630 prio/.initial=, prio/.default=,
631 type/.initial=, type/.default=,
632 formatter/.initial=timetableformatter, formatter/.default=timetableformatter,
633 %
634 % \end{macrocode}
635 % |calendar/|:
636 % \begin{description}
637 % \item[|draw|]
638 % \item[|room|]
639 % \item[|prio|]
640 % \item[|course|]
641 % \item[|desc|]
642 % \item[|start|]
643 % \item[|end|]
644 % \item[|tikz|]
645 % \item[|period|]
646 % \item[|shift|]
647 % \item[|print|] Only makes sence if the command is suffixed by a |%|
648 % otherwise somehow a space gets inserted (eventhough the |%| is
649 % inserted from lua as well
650 % \end{description}
651 % \begin{macrocode}
652 /semesterplannerLua/calendar/.cd,
653 draw/.initial={true}, draw/.default={true},
654 room/.initial={}, room/.default={},
655 time/.initial={}, time/.default={},
656 prio/.initial={}, prio/.default={},
657 course/.initial={}, course/.default={},
658 desc/.initial={}, desc/.default={},
659 type/.initial={}, type/.default={},
660 date/.initial={}, date/.default={},
661 end/.initial={}, end/.default={},
662 tikz/.initial={}, tikz/.default={},
663 period/.initial={nil}, period/.default={nil},
664 shift/.initial={true}, shift/.default={true},
665 print/.initial={true}, print/.default={true},
666 }
667 % \end{macrocode}
668 %
669 % \subsection{Tikz Calendar add weekday labels}
670 % \begin{macrocode}
671 \tikzoption{day headings}{\tikzstyle{day heading}=[#1]}
672 \tikzstyle{day heading}=[]
673 \tikzstyle{day letter headings}=[
674 execute before day scope={ \ifdate{day of month=1}{%
675 \pgfmathsetlength{\pgf@ya}{\tikz@lib@cal@yshift}%
676 \pgfmathsetlength\pgf@xa{\tikz@lib@cal@xshift}%
677 \pgftransformyshift{-\pgf@ya}
678 \foreach \d/\l in {0/M,1/T,2/W,3/T,4/F,5/S,6/S} {
679 \pgf@xa=\d\pgf@xa%
680 \pgftransformxshift{\pgf@xa}%
681 \pgftransformyshift{\pgf@ya}%
682 \node[every day,day heading]{\l};%
683 }
684 }{}%
685 }%
686 ]
687 % \end{macrocode}
688 %
689 % \subsubsection{Local Stuff (timetable-env local)}
690 % \begin{environment}{timetable}
691 % This is the environment doing all the stuff. To gate the positions where
692 % the corresponding macros can be used (and in terms of pgfkeys for reasons
693 % of default values) all the macros used are put into the environment.
694 % \begin{macrocode}
695 \newenvironment{timetable}[1][]{
696 \section*{\faClockO~Timetable}
697 % \end{macrocode}
698 %
699 % Read the argumens given by the user after restoring the defaults
700 % (Restoring currently makes no sense, since they are created a few
701 % lines above anyways, but creation might be moved outside the
702 % environment some day.\\
703 % Afterwards the lua module is beeing initialized (erase data from
704 % possible previous runs.
705 % \begin{macrocode}
706 \pgfkeys{/semesterplannerLua/timetable/env/.cd,days,dayse,start time,end time,width,length,#1}
707 \directlua{sp.init{
708 days=[[\pgfkeysvalueof{/semesterplannerLua/timetable/env/days}]],
709 min=[[\pgfkeysvalueof{/semesterplannerLua/timetable/env/start time}]],
710 max=[[\pgfkeysvalueof{/semesterplannerLua/timetable/env/end time}]],
711 dayse=[[\pgfkeysvalueof{/semesterplannerLua/timetable/env/dayse}]]}}
712 % \end{macrocode}
713 % \begin{macro}{\semesterplannerLua@event}
714 % Is used to pass the event to the lua engine which in turn will collect
715 % the event to draw it in the end. For that the arguments given are parsed
716 % after restoring the pgf keys to their default values. The optional
717 % argument herby is a sequence of pgf keys, the second argument is
718 % a string representing the content (this MUST be unexpanded since
719 % this is passed to lua which in turn will pass it unmodified back)
720 % \begin{macrocode}
721 \newcommand{\semesterplannerLua@event}[1][]{
722 \pgfkeys{/semesterplannerLua/timetable/event/.cd,content,time,day,tikz,scale
723 width,offset,textcolor,title,speaker,type,location,password,prio,formatter, ##1}
724 \directlua{
725 sp.addEvent{
726 time="\pgfkeysvalueof{/semesterplannerLua/timetable/event/time}",
727 day="\pgfkeysvalueof{/semesterplannerLua/timetable/event/day}",
728 tikz=[[\pgfkeysvalueof{/semesterplannerLua/timetable/event/tikz}]],
729 offset=\pgfkeysvalueof{/semesterplannerLua/timetable/event/offset},
730 scale_width=\pgfkeysvalueof{/semesterplannerLua/timetable/event/scale width},
731 formatter=\pgfkeysvalueof{/semesterplannerLua/timetable/event/formatter},
732 textcolor=[[\pgfkeysvalueof{/semesterplannerLua/timetable/event/textcolor}]],
733 title=[[\pgfkeysvalueof{/semesterplannerLua/timetable/event/title}]],
734 speaker=[[\pgfkeysvalueof{/semesterplannerLua/timetable/event/speaker}]],
735 location=[[\pgfkeysvalueof{/semesterplannerLua/timetable/event/location}]],
736 password=[[\pgfkeysvalueof{/semesterplannerLua/timetable/event/password}]],
737 prio=[[\pgfkeysvalueof{/semesterplannerLua/timetable/event/prio}]],
738 type=[[\pgfkeysvalueof{/semesterplannerLua/timetable/event/type}]],
739 }
740 }
741 }
742 % \end{macrocode}
743 % \end{macro}
744 % Short-hand macros for different events using the corresponding
745 % background color
746 %
747 % \begin{macro}{\lecture}
748 % \begin{macrocode}
749 \newcommand{\lecture}[1][]{
750 \semesterplannerLua@event[tikz={fill=lecture,}, textcolor=white, type=lect, ##1]
751 \ignorespaces
752 }
753 % \end{macrocode}
754 % \end{macro}
755 % \begin{macro}{\seminar}
756 % \begin{macrocode}
757 \newcommand{\seminar}[1][]{
758 \semesterplannerLua@event[tikz={fill=seminar,}, textcolor=white, type=sem, ##1]
759 \ignorespaces
760 }
761 % \end{macrocode}
762 % \end{macro}
763 % \begin{macro}{\tutorial}
764 % \begin{macrocode}
765 \newcommand{\tutorial}[1][]{
766 \semesterplannerLua@event[tikz={fill=tutorial,}, textcolor=white, type=tut, ##1]
767 \ignorespaces
768 }
769 % \end{macrocode}
770 % \end{macro}
771 % \begin{macro}{\meeting}
772 % \begin{macrocode}
773 \newcommand{\meeting}[1][]{
774 \semesterplannerLua@event[tikz={fill=meeting,}, textcolor=white, type=meet, ##1]
775 \ignorespaces
776 }
777 % \end{macrocode}
778 % \end{macro}
779 % \begin{macro}{\officehour}
780 % \begin{macrocode}
781 \newcommand{\officehour}[1][]{
782 \semesterplannerLua@event[tikz={fill=officehour,}, textcolor=white, type=office, ##1]
783 \ignorespaces
784 }
785 % \end{macrocode}
786 % \end{macro}
787 % \begin{macro}{\laboratory}
788 % \begin{macrocode}
789 \newcommand{\laboratory}[1][]{
790 \semesterplannerLua@event[tikz={fill=laboratory,}, textcolor=white, type=lab, ##1]
791 \ignorespaces
792 }
793 % \end{macrocode}
794 % \end{macro}
795 % \begin{macro}{\fieldstudy}
796 % \begin{macrocode}
797 \newcommand{\fieldstudy}[1][]{
798 \semesterplannerLua@event[tikz={fill=fieldstudy,}, textcolor=white, type=fieldstudy, ##1]
799 \ignorespaces
800 }
801 % \end{macrocode}
802 % \end{macro}
803 % \begin{macrocode}
804 }{
805 % \end{macrocode}
806 % At the end of the environment after all events have been collected,
807 % generate and output the tikz code needed to draw the timetable.
808 % \begin{macrocode}
809 \directlua{sp.draw(
810 [[\pgfkeysvalueof{/semesterplannerLua/timetable/env/length}]],
811 [[\pgfkeysvalueof{/semesterplannerLua/timetable/env/width}]])}
812 }
813 % \end{macrocode}
814 % \end{environment}
815 %
816 % \begin{macrocode}
817
818 % \end{macrocode}
819 % \begin{macro}{printSpCalendar}
820 % Print a calendar from startDate to endDate (encoded as YYYY-MM-DD) as
821 % one calendar per month in a matrix with the given amount of columns
822 % \begin{macrocode}
823 \newcommand{\printSpCalendar}[3][3]{\directlua{cal.drawCalendar("#2", "#3", #1)}}
824 % \end{macrocode}
825 % \end{macro}
826 % \begin{macrocode}
827
828 \newenvironment{appointments}[2][Room]{
829 \directlua{cal.init(#2)}
830 \newcommand{\appointment}[1][]{%
831 \pgfkeys{/semesterplannerLua/calendar/.cd,draw,room,time,prio,course,desc,date,end,tikz,period,type,shift,print, ##1}%
832 \directlua{
833 cal.addAppointment{draw=\pgfkeysvalueof{/semesterplannerLua/calendar/draw},
834 room=[[\pgfkeysvalueof{/semesterplannerLua/calendar/room}]],
835 time=[[\pgfkeysvalueof{/semesterplannerLua/calendar/time}]],
836 prio=[[\pgfkeysvalueof{/semesterplannerLua/calendar/prio}]],
837 course=[[\pgfkeysvalueof{/semesterplannerLua/calendar/course}]],
838 desc=[[\pgfkeysvalueof{/semesterplannerLua/calendar/desc}]],
839 date=[[\pgfkeysvalueof{/semesterplannerLua/calendar/date}]],
840 endDate=[[\pgfkeysvalueof{/semesterplannerLua/calendar/end}]],
841 tikz=[[\pgfkeysvalueof{/semesterplannerLua/calendar/tikz}]],
842 period=\pgfkeysvalueof{/semesterplannerLua/calendar/period},
843 shift=\pgfkeysvalueof{/semesterplannerLua/calendar/shift},
844 print=\pgfkeysvalueof{/semesterplannerLua/calendar/print}}}%
845 \ignorespaces
846 }
847 \section*{\faCalendar~Appointments}
848 \begin{tabular}{rlllll}
849 \textbf{Date}&\textbf{Time}&\textbf{Course}&\textbf{Description}&\textbf{#1}&\textbf{Prio.}\\
850 }{
851 \end{tabular}
852 }
853
854 \newenvironment{exams}[1]{
855 \directlua{cal.init(#1)}
856 \newcommand{\exam}[1][]{%
857 \pgfkeys{/semesterplannerLua/calendar/.cd,draw,room,time,prio,course,desc,date,end,tikz,period,type,shift,print, ##1}%
858 \directlua{
859 cal.addExam{
860 draw=\pgfkeysvalueof{/semesterplannerLua/calendar/draw},
861 room=[[\pgfkeysvalueof{/semesterplannerLua/calendar/room}]],
862 time=[[\pgfkeysvalueof{/semesterplannerLua/calendar/time}]],
863 course=[[\pgfkeysvalueof{/semesterplannerLua/calendar/course}]],
864 desc=[[\pgfkeysvalueof{/semesterplannerLua/calendar/desc}]],
865 date=[[\pgfkeysvalueof{/semesterplannerLua/calendar/date}]],
866 tikz=[[\pgfkeysvalueof{/semesterplannerLua/calendar/tikz}]],
867 type=[[\pgfkeysvalueof{/semesterplannerLua/calendar/type}]],
868 shift=\pgfkeysvalueof{/semesterplannerLua/calendar/shift},
869 print=\pgfkeysvalueof{/semesterplannerLua/calendar/print}}}%
870 \ignorespaces
871 }
872 \section*{\faStickyNoteO~Exams}
873 \begin{tabular}{rllll}
874 \textbf{Date}&\textbf{Time}&\textbf{Course}&\textbf{Type}&\textbf{Note}\\
875 }{
876 \end{tabular}
877 }
878
879 \newenvironment{deadlines}[1]{
880 \directlua{cal.init(#1)}
881 \newcommand{\deadline}[1][]{%
882 \pgfkeys{/semesterplannerLua/calendar/.cd,draw,room,time,prio,course,desc,date,end,tikz,period,type,shift,print, ##1}%
883 \directlua{
884 cal.addDeadline{
885 draw=\pgfkeysvalueof{/semesterplannerLua/calendar/draw},
886 course=[[\pgfkeysvalueof{/semesterplannerLua/calendar/course}]],
887 desc=[[\pgfkeysvalueof{/semesterplannerLua/calendar/desc}]],
888 date=[[\pgfkeysvalueof{/semesterplannerLua/calendar/date}]],
889 tikz=[[\pgfkeysvalueof{/semesterplannerLua/calendar/tikz}]],
890 prio=[[\pgfkeysvalueof{/semesterplannerLua/calendar/prio}]],
891 shift=\pgfkeysvalueof{/semesterplannerLua/calendar/shift},
892 print=\pgfkeysvalueof{/semesterplannerLua/calendar/print}}}%
893 \ignorespaces
894 }
895 \section*{\faStickyNoteO~Deadlines}
896 \begin{tabular}{rlll}
897 \textbf{Date}&\textbf{Course}&\textbf{Description}&\textbf{Prio}\\
898 }{
899 \end{tabular}
900 }
901 % \end{macrocode}
902 \endinput
903 %
904 % \iffalse
905 %</package>
906 % \fi
907 %
908 % \Finale
909 \endinput