Debian Codegraph @

texmf-dist/doc/latex/diadia/diadia.dtx

raw
1 % \iffalse meta-comment
2 % !TEX program = pdfLaTeX
3 %<*internal>
4 \iffalse
5 %</internal>
6 %<*readme>
7 The diadia package allows you to keep a diabetes diary.
8 Usually, this means keeping record of certain medical values
9 like blood sugar, blood pressure, pulse or weight. It might
10 also include other medical, pharmaceutical or nutritional
11 data (HbA1c, insulin doses, carbohydrate units). The diadia
12 package supports all of this plus more - simply by adding
13 more columns to the data file!
14 It is able to evaluate the data file and typesets formatted
15 tables and derived plots. Furthermore, it supports medication
16 charts and info boxes.
17
18 Supported languages: english, german
19 Feel free to provide other translation files! ;-)
20
21 License: LPPL
22
23 Changes in v1.1:
24
25 - added diadia.lua
26 It provides the cut, compose and average modes for data
27 management
28
29 - moved style definitions to diadia.cfg
30
31 %</readme>
32 %<*data>
33 date bsl1 bsl2 bsl3 id1 id2 id3 bps bpd weight cu pul
34 2015-02-18 182 197 196 nan nan 10 120 80 102.3 12 64
35 2015-02-19 190 232 159 12 9 9 130 85 102.1 12 68
36 2015-02-20 181 217 153 14 9 9 130 85 103.5 12 72
37 2015-02-21 154 160 146 13 7 9 100 60 102.8 12 60
38 2015-02-22 186 204 152 14 9 9 120 80 102.4 12 64
39 2015-02-23 190 170 131 14 8 9 130 85 102.0 12 68
40 2015-02-24 165 128 97 14 7 6 110 75 101.7 12 64
41 2015-02-25 160 123 129 11 5 7 130 85 101.3 12 68
42 2015-02-26 151 115 128 11 nan 7 120 80 100.9 12 64
43 2015-02-27 141 119 130 11 4 nan 130 85 101.6 12 68
44 2015-02-28 142 137 143 nan nan nan 120 80 101.2 12 64
45 2015-03-01 134 151 128 nan nan nan nan nan nan nan nan
46 2015-03-02 145 124 116 nan nan nan nan nan nan nan nan
47 2015-03-03 133 130 125 nan nan nan nan nan nan nan nan
48 2015-03-04 138 153 nan nan nan nan nan nan nan nan nan
49 2015-03-06 122 150 130 nan nan nan nan nan nan nan nan
50 2015-03-07 nan nan 135 nan nan nan nan nan nan nan nan
51 2015-03-08 132 146 119 nan nan nan nan nan nan nan nan
52 2015-03-11 144 nan 124 nan nan nan nan nan nan nan nan
53 2015-03-13 131 116 nan nan nan nan nan nan nan nan nan
54 2015-03-16 119 nan nan nan nan nan nan nan nan nan nan
55 2015-03-19 109 nan nan nan nan nan nan nan nan nan nan
56 2015-03-20 107 nan nan nan nan nan nan nan nan nan nan
57 2015-03-21 103 nan nan nan nan nan nan nan nan nan nan
58 2015-03-22 97 nan nan nan nan nan nan nan nan nan nan
59 2015-03-23 111 nan nan nan nan nan nan nan nan nan nan
60 2015-03-24 96 nan nan nan nan nan nan nan nan nan nan
61 2015-03-25 109 nan nan nan nan nan nan nan nan nan nan
62 2015-03-26 115 nan nan nan nan nan nan nan nan nan nan
63 2015-03-28 96 nan nan nan nan nan nan nan nan nan nan
64 2015-03-31 90 nan nan nan nan nan nan nan nan nan nan
65 2015-04-02 101 nan nan nan nan nan nan nan nan nan nan
66 2015-04-03 105 nan nan nan nan nan nan nan nan nan nan
67 2015-04-04 116 nan nan nan nan nan nan nan nan nan nan
68 2015-04-05 118 nan nan nan nan nan nan nan nan nan nan
69 2015-04-06 124 nan nan nan nan nan nan nan nan nan nan
70 2015-04-07 97 nan nan nan nan nan nan nan nan nan nan
71 2015-04-08 111 nan nan nan nan nan nan nan nan nan nan
72 2015-04-09 97 nan nan nan nan nan nan nan nan nan nan
73 2015-04-10 102 nan nan nan nan nan nan nan nan nan nan
74 2015-04-11 96 nan nan nan nan nan nan nan nan nan nan
75 2015-04-12 104 nan nan nan nan nan nan nan nan nan nan
76 2015-04-13 105 nan nan nan nan nan nan nan nan nan nan
77 2015-04-14 105 nan nan nan nan nan nan nan nan nan nan
78 2015-04-15 125 nan nan nan nan nan nan nan nan nan nan
79 2015-04-16 102 nan nan nan nan nan nan nan nan nan nan
80 2015-04-17 102 nan nan nan nan nan nan nan nan nan nan
81 2015-04-18 97 nan nan nan nan nan nan nan nan nan nan
82 2015-04-19 96 nan nan nan nan nan nan nan nan nan nan
83 2015-04-20 119 nan nan nan nan nan nan nan nan nan nan
84 2015-04-21 101 nan nan nan nan nan nan nan nan nan nan
85 2015-04-22 96 nan nan nan nan nan nan nan nan nan nan
86 2015-04-23 93 nan nan nan nan nan nan nan nan nan nan
87 2015-04-24 108 nan nan nan nan nan nan nan nan nan nan
88 2015-04-25 114 nan nan nan nan nan nan nan nan nan nan
89 2015-04-26 95 nan nan nan nan nan nan nan nan nan nan
90 2015-04-27 110 nan nan nan nan nan nan nan nan nan nan
91 2015-04-28 114 nan nan nan nan nan nan nan nan nan nan
92 2015-04-29 104 nan nan nan nan nan nan nan nan nan nan
93 2015-04-30 99 nan nan nan nan nan nan nan nan nan nan
94 %</data>
95 %<*dataavg>
96 date value avg07 avg14 avg30 avg60 avg90
97 2015-02-18 182 182 182 182 182 182
98 2015-02-19 190 186 186 186 186 186
99 2015-02-20 181 184 184 184 184 184
100 2015-02-21 154 177 177 177 177 177
101 2015-02-22 186 179 179 179 179 179
102 2015-02-23 190 181 181 181 181 181
103 2015-02-24 165 178 178 178 178 178
104 2015-02-25 160 175 176 176 176 176
105 2015-02-26 151 170 173 173 173 173
106 2015-02-27 141 164 170 170 170 170
107 2015-02-28 142 162 167 167 167 167
108 2015-03-01 134 155 165 165 165 165
109 2015-03-02 145 148 163 163 163 163
110 2015-03-03 133 144 161 161 161 161
111 2015-03-04 138 141 158 159 159 159
112 2015-03-06 122 136 151 157 157 157
113 2015-03-08 132 134 146 156 156 156
114 2015-03-11 144 133 138 155 155 155
115 2015-03-13 131 136 136 154 154 154
116 2015-03-16 119 131 131 152 152 152
117 2015-03-19 109 120 126 150 150 150
118 2015-03-20 107 112 124 146 148 148
119 2015-03-21 103 110 121 142 146 146
120 2015-03-22 97 107 116 138 144 144
121 2015-03-23 111 105 115 136 143 143
122 2015-03-24 96 104 113 132 141 141
123 2015-03-25 109 105 109 128 140 140
124 2015-03-26 115 105 110 126 139 139
125 2015-03-28 96 104 106 121 137 137
126 2015-03-31 90 103 103 117 136 136
127 2015-04-02 101 96 103 113 135 135
128 2015-04-03 105 98 102 111 134 134
129 2015-04-04 116 103 104 111 133 133
130 2015-04-05 118 106 106 111 133 133
131 2015-04-06 124 109 107 112 132 132
132 2015-04-07 97 110 107 110 132 132
133 2015-04-08 111 110 107 110 131 131
134 2015-04-09 97 110 106 109 130 130
135 2015-04-10 102 109 105 107 129 129
136 2015-04-11 96 106 105 107 129 129
137 2015-04-12 104 104 105 106 128 128
138 2015-04-13 105 102 105 106 127 127
139 2015-04-14 105 103 106 106 127 127
140 2015-04-15 125 105 108 106 127 127
141 2015-04-16 102 106 108 106 126 126
142 2015-04-17 102 106 107 106 126 126
143 2015-04-18 97 106 106 105 125 125
144 2015-04-19 96 105 105 105 123 125
145 2015-04-20 119 107 104 105 122 124
146 2015-04-21 101 106 104 105 120 124
147 2015-04-22 96 102 103 105 119 123
148 2015-04-23 93 101 103 105 117 123
149 2015-04-24 108 101 104 105 115 123
150 2015-04-25 114 104 105 105 114 122
151 2015-04-26 95 104 104 104 113 122
152 2015-04-27 110 102 105 105 112 122
153 2015-04-28 114 104 105 105 111 122
154 2015-04-29 104 105 104 105 110 121
155 2015-04-30 99 106 103 105 110 121
156 %</dataavg>
157 %<*feb15>
158 date bsl1 bsl2 bsl3 id1 id2 id3 bps bpd weight cu pul
159 2015-02-18 182 197 196 nan nan 10 120 80 102.3 12 64
160 2015-02-19 190 232 159 12 9 9 130 85 102.1 12 68
161 2015-02-20 181 217 153 14 9 9 130 85 103.5 12 72
162 2015-02-21 154 160 146 13 7 9 100 60 102.8 12 60
163 2015-02-22 186 204 152 14 9 9 120 80 102.4 12 64
164 2015-02-23 190 170 131 14 8 9 130 85 102.0 12 68
165 2015-02-24 165 128 97 14 7 6 110 75 101.7 12 64
166 2015-02-25 160 123 129 11 5 7 130 85 101.3 12 68
167 2015-02-26 151 115 128 11 nan 7 120 80 100.9 12 64
168 2015-02-27 141 119 130 11 4 nan 130 85 101.6 12 68
169 2015-02-28 142 137 143 nan nan nan 120 80 101.2 12 64
170 %</feb15>
171 %<*mar15>
172 date bsl1 bsl2 bsl3 id1 id2 id3 bps bpd weight cu pul
173 2015-03-01 134 151 128 nan nan nan nan nan nan nan nan
174 2015-03-02 145 124 116 nan nan nan nan nan nan nan nan
175 2015-03-03 133 130 125 nan nan nan nan nan nan nan nan
176 2015-03-04 138 153 nan nan nan nan nan nan nan nan nan
177 2015-03-06 122 150 130 nan nan nan nan nan nan nan nan
178 2015-03-07 nan nan 135 nan nan nan nan nan nan nan nan
179 2015-03-08 132 146 119 nan nan nan nan nan nan nan nan
180 2015-03-11 144 nan 124 nan nan nan nan nan nan nan nan
181 2015-03-13 131 116 nan nan nan nan nan nan nan nan nan
182 2015-03-16 119 nan nan nan nan nan nan nan nan nan nan
183 2015-03-19 109 nan nan nan nan nan nan nan nan nan nan
184 2015-03-20 107 nan nan nan nan nan nan nan nan nan nan
185 2015-03-21 103 nan nan nan nan nan nan nan nan nan nan
186 2015-03-22 97 nan nan nan nan nan nan nan nan nan nan
187 2015-03-23 111 nan nan nan nan nan nan nan nan nan nan
188 2015-03-24 96 nan nan nan nan nan nan nan nan nan nan
189 2015-03-25 109 nan nan nan nan nan nan nan nan nan nan
190 2015-03-26 115 nan nan nan nan nan nan nan nan nan nan
191 2015-03-28 96 nan nan nan nan nan nan nan nan nan nan
192 2015-03-31 90 nan nan nan nan nan nan nan nan nan nan
193 %</mar15>
194 %<*apr15>
195 date value avg07 avg14 avg30 avg60 avg90
196 2015-04-02 101 96 103 113 135 135
197 2015-04-03 105 98 102 111 134 134
198 2015-04-04 116 103 104 111 133 133
199 2015-04-05 118 106 106 111 133 133
200 2015-04-06 124 109 107 112 132 132
201 2015-04-07 97 110 107 110 132 132
202 2015-04-08 111 110 107 110 131 131
203 2015-04-09 97 110 106 109 130 130
204 2015-04-10 102 109 105 107 129 129
205 2015-04-11 96 106 105 107 129 129
206 2015-04-12 104 104 105 106 128 128
207 2015-04-13 105 102 105 106 127 127
208 2015-04-14 105 103 106 106 127 127
209 2015-04-15 125 105 108 106 127 127
210 2015-04-16 102 106 108 106 126 126
211 2015-04-17 102 106 107 106 126 126
212 2015-04-18 97 106 106 105 125 125
213 2015-04-19 96 105 105 105 123 125
214 2015-04-20 119 107 104 105 122 124
215 2015-04-21 101 106 104 105 120 124
216 2015-04-22 96 102 103 105 119 123
217 2015-04-23 93 101 103 105 117 123
218 2015-04-24 108 101 104 105 115 123
219 2015-04-25 114 104 105 105 114 122
220 2015-04-26 95 104 104 104 113 122
221 2015-04-27 110 102 105 105 112 122
222 2015-04-28 114 104 105 105 111 122
223 2015-04-29 104 105 104 105 110 121
224 2015-04-30 99 106 103 105 110 121
225 %</apr15>
226 %<*hba1c>
227 date hba1c
228 2015-02-18 10
229 2015-04-23 6
230 %</hba1c>
231 %<*fallback>
232 \DeclareTranslationFallback{dd-BloodSugar}{Blood Sugar}%
233 \DeclareTranslationFallback{dd-Insulin}{Insulin}%
234 \DeclareTranslationFallback{dd-BloodPressure}{Blood Pressure}%
235 \DeclareTranslationFallback{dd-Weight}{Weight}%
236 \DeclareTranslationFallback{dd-MedicationChart}{Medication Chart}%
237 \DeclareTranslationFallback{dd-issued}{issued}%
238 \DeclareTranslationFallback{dd-Pharmaceutical}{Pharmaceutical}%
239 \DeclareTranslationFallback{dd-Morning}{Morning}%
240 \DeclareTranslationFallback{dd-Noon}{Noon}%
241 \DeclareTranslationFallback{dd-Evening}{Evening}%
242 \DeclareTranslationFallback{dd-Night}{Night}%
243 \DeclareTranslationFallback{dd-Note}{Note}%
244 \DeclareTranslationFallback{dd-Info}{Info}%
245 \DeclareTranslationFallback{dd-Date}{Date}%
246 \DeclareTranslationFallback{dd-BSi}{BS(1)}%
247 \DeclareTranslationFallback{dd-BSii}{BS(2)}%
248 \DeclareTranslationFallback{dd-BSiii}{BS(3)}%
249 \DeclareTranslationFallback{dd-IDi}{I(1)}%
250 \DeclareTranslationFallback{dd-IDii}{I(2)}%
251 \DeclareTranslationFallback{dd-IDiii}{I(3)}%
252 \DeclareTranslationFallback{dd-BPs}{BP(s)}%
253 \DeclareTranslationFallback{dd-BPd}{BP(d)}%
254 \DeclareTranslationFallback{dd-Weight}{Weight}%
255 \DeclareTranslationFallback{dd-CU}{CU}%
256 \DeclareTranslationFallback{dd-Pulse}{Pulse}%
257 \DeclareTranslationFallback{dd-Hbaonec}{$\text{HbA}_{\text{1c}}$}%
258 \DeclareTranslationFallback{dd-Value}{Value}%
259 %</fallback>
260 %<*english>
261 \DeclareTranslation{English}{dd-BloodSugar}{Blood Sugar}%
262 \DeclareTranslation{English}{dd-Insulin}{Insulin}%
263 \DeclareTranslation{English}{dd-BloodPressure}{Blood Pressure}%
264 \DeclareTranslation{English}{dd-Weight}{Weight}%
265 \DeclareTranslation{English}{dd-MedicationChart}{Medication Chart}%
266 \DeclareTranslation{English}{dd-issued}{issued}%
267 \DeclareTranslation{English}{dd-Pharmaceutical}{Pharmaceutical}%
268 \DeclareTranslation{English}{dd-Morning}{Morning}%
269 \DeclareTranslation{English}{dd-Noon}{Noon}%
270 \DeclareTranslation{English}{dd-Evening}{Evening}%
271 \DeclareTranslation{English}{dd-Night}{Night}%
272 \DeclareTranslation{English}{dd-Note}{Note}%
273 \DeclareTranslation{English}{dd-Info}{Info}%
274 \DeclareTranslation{English}{dd-Date}{Date}%
275 \DeclareTranslation{English}{dd-BSi}{BS(1)}%
276 \DeclareTranslation{English}{dd-BSii}{BS(2)}%
277 \DeclareTranslation{English}{dd-BSiii}{BS(3)}%
278 \DeclareTranslation{English}{dd-IDi}{I(1)}%
279 \DeclareTranslation{English}{dd-IDii}{I(2)}%
280 \DeclareTranslation{English}{dd-IDiii}{I(3)}%
281 \DeclareTranslation{English}{dd-BPs}{BP(s)}%
282 \DeclareTranslation{English}{dd-BPd}{BP(d)}%
283 \DeclareTranslation{English}{dd-Weight}{Weight}%
284 \DeclareTranslation{English}{dd-CU}{CU}%
285 \DeclareTranslation{English}{dd-Pulse}{Pulse}%
286 \DeclareTranslation{English}{dd-Hbaonec}{$\text{HbA}_{\text{1c}}$}%
287 \DeclareTranslation{English}{dd-Value}{Value}%
288 %</english>
289 %<*german>
290 \DeclareTranslation{German}{dd-BloodSugar}{Blutzucker}%
291 \DeclareTranslation{German}{dd-Insulin}{Insulin}%
292 \DeclareTranslation{German}{dd-BloodPressure}{Blutdruck}%
293 \DeclareTranslation{German}{dd-Weight}{Gewicht}%
294 \DeclareTranslation{German}{dd-MedicationChart}{Medikamentenplan}%
295 \DeclareTranslation{German}{dd-issued}{ausgestellt}%
296 \DeclareTranslation{German}{dd-Pharmaceutical}{Medikament}%
297 \DeclareTranslation{German}{dd-Morning}{morgens}%
298 \DeclareTranslation{German}{dd-Noon}{mittags}%
299 \DeclareTranslation{German}{dd-Evening}{abends}%
300 \DeclareTranslation{German}{dd-Night}{nachts}%
301 \DeclareTranslation{German}{dd-Note}{Bemerkung}%
302 \DeclareTranslation{German}{dd-Info}{Info}%
303 \DeclareTranslation{German}{dd-Date}{Datum}%
304 \DeclareTranslation{German}{dd-BSi}{BZ(1)}%
305 \DeclareTranslation{German}{dd-BSii}{BZ(2)}%
306 \DeclareTranslation{German}{dd-BSiii}{BZ(3)}%
307 \DeclareTranslation{German}{dd-IDi}{I(1)}%
308 \DeclareTranslation{German}{dd-IDii}{I(2)}%
309 \DeclareTranslation{German}{dd-IDiii}{I(3)}%
310 \DeclareTranslation{German}{dd-BPs}{BD(s)}%
311 \DeclareTranslation{German}{dd-BPd}{BD(d)}%
312 \DeclareTranslation{German}{dd-Weight}{Gewicht}%
313 \DeclareTranslation{German}{dd-CU}{BE}%
314 \DeclareTranslation{German}{dd-Pulse}{Puls}%
315 \DeclareTranslation{German}{dd-Hbaonec}{$\text{HbA}_{\text{1c}}$}%
316 \DeclareTranslation{German}{dd-Value}{Wert}%
317 %</german>
318 %<*bibfile>
319 @misc{bib:pgfplots,
320 author = {Dr. Christian Feuersänger},
321 note = {\href{http://mirrors.ctan.org/graphics/pgf/contrib/pgfplots/doc/pgfplots.pdf}{http://mirrors.ctan.org/graphics/pgf/contrib/pgfplots/doc/pgfplots.pdf}},
322 title = {{Manual for Package pgfplots}},
323 year = {2015},
324 }
325
326 @misc{bib:pgfplotstable,
327 author = {Dr. Christian Feuersänger},
328 note = {\href{http://mirrors.ctan.org/graphics/pgf/contrib/pgfplots/doc/pgfplotstable.pdf}{http://mirrors.ctan.org/graphics/pgf/contrib/pgfplots/doc/pgfplotstable.pdf}},
329 title = {{Manual for Package pgfplotstable}},
330 year = {2015},
331 }
332
333 @misc{bib:tcolorbox,
334 author = {Sturm, Thomas F.},
335 note = {\href{http://mirrors.ctan.org/macros/latex/contrib/tcolorbox/tcolorbox.pdf}{http://mirrors.ctan.org/macros/latex/contrib/tcolorbox/tcolorbox.pdf}},
336 title = {{The tcolorbox package}},
337 year = {2015},
338 }
339
340 @misc{bib:multicol,
341 author = {Mittelbach, Frank},
342 note = {\href{http://mirrors.ctan.org/macros/latex/required/tools/multicol.pdf}{http://mirrors.ctan.org/macros/latex/required/tools/multicol.pdf}},
343 title = {{An environment for multicolumn output}},
344 year = {2014},
345 }
346
347 @misc{bib:longtable,
348 author = {Carlisle, David},
349 note = {\href{http://mirrors.ctan.org/macros/latex/required/tools/longtable.pdf}{http://mirrors.ctan.org/macros/latex/required/tools/longtable.pdf}},
350 title = {{The \texttt{longtable} package}},
351 year = {2014},
352 }
353
354 %</bibfile>
355 %<*examplefile>
356 \documentclass[a4paper,DIV=13,parskip]{scrreprt}
357 \usepackage[english]{babel}
358 \usepackage[utf8]{inputenc}
359 \usepackage[T1]{fontenc}
360 \usepackage{textcomp}
361 \usepackage[tabcolor=gray!40,tabstyle=advanced]{diadia}
362 \usepackage{bera}
363 \usepackage{marvosym}
364 \usepackage{hyperref}
365 \begin{document}
366 \pgfplotstableset{columns/date/.append style={date type={\day.\month.\year}}}
367 \pgfplotsset{xlabel=2015,
368 tick label style={font=\footnotesize}}
369 \title{My Diabetes Diary}
370 \author{John Doe}
371 \maketitle
372 \centering
373 \chapter{Long term values}
374
375 \begin{diadiasidebyside}
376 \diadiatab{}{hba1c.dat}
377
378 \begin{diadiaplot}[plotstyle=hbaonec]{xmin=2015-02-01,xmax=2015-04-30}
379 \diadiaaddplot{}{x=date,y=hba1c}{hba1c.dat}
380 \end{diadiaplot}
381 \end{diadiasidebyside}
382
383 \vfill
384 \begin{diadiaplot}[plotstyle=bloodsugar]
385 {width=\textwidth,
386 height=11cm,
387 legend style={at={(0.5,-0.15)},font=\footnotesize,anchor=north,legend columns=-1},
388 xtick={2015-03-01,2015-04-01,2015-05-01},
389 xmin=2015-02-18,
390 xmax=2015-04-30}
391 \diadiaaddplot{plot4,nomarks}{x=date,y=avg90}{ddbsl1avg.dat}
392 \diadiaaddplot{plot3,nomarks}{x=date,y=avg30}{ddbsl1avg.dat}
393 \diadiaaddplot{plot2,nomarks}{x=date,y=avg07}{ddbsl1avg.dat}
394 \diadiaaddplot{plot1}{x=date,y=value}{ddbsl1avg.dat}
395 \legend{$\varnothing_{90}$,$\varnothing_{30}$,$\varnothing_{7}$,morning}
396 \end{diadiaplot}
397 \chapter{February 2015}
398 \section{Data}
399 \diadiatab{font=\small}{201502.dat}
400
401 \vspace{1cm}
402 \begin{diadiasidebyside}
403 \begin{diadiaplot}[plotstyle=bloodsugar]{xmin=2015-02-18,xmax=2015-02-28}
404 \diadiaaddplot{}{x=date,y=bsl1}{diadia.dat}
405 \diadiaaddplot{}{x=date,y=bsl2}{diadia.dat}
406 \diadiaaddplot{}{x=date,y=bsl3}{diadia.dat}
407 \legend{morning,noon,evening}
408 \end{diadiaplot}
409
410 \begin{diadiaplot}[plotstyle=insulin]{xmin=2015-02-18,xmax=2015-02-27}
411 \diadiaaddplot{}{x=date,y=id1}{diadia.dat}
412 \diadiaaddplot{}{x=date,y=id2}{diadia.dat}
413 \diadiaaddplot{}{x=date,y=id3}{diadia.dat}
414 \legend{morning,noon,evening}
415 \end{diadiaplot}
416
417 \begin{diadiaplot}[plotstyle=bloodpressure]{xmin=2015-02-18,xmax=2015-02-27}
418 \diadiaaddplot{}{x=date,y=bps}{diadia.dat}
419 \diadiaaddplot{}{x=date,y=bpd}{diadia.dat}
420 \legend{systolic,diastolic}
421 \end{diadiaplot}
422
423 \begin{diadiaplot}[plotstyle=pulse]{xmin=2015-02-18,xmax=2015-02-27}
424 \diadiaaddplot{}{x=date,y=pul}{diadia.dat}
425 \end{diadiaplot}
426 \end{diadiasidebyside}
427
428 \vspace{1cm}
429 \begin{diadiasidebyside}
430 \begin{diadiaplot}[plotstyle=weight]{xmin=2015-02-18,xmax=2015-02-27}
431 \diadiaaddplot{ddpweightplot}{x=date,y=weight}{diadia.dat}
432 \end{diadiaplot}
433
434 \begin{diadiaplot}[plotstyle=cu]{xmin=2015-02-18,xmax=2015-02-27,enlargelimits=.08}
435 \diadiaaddplot{}{x=date,y=cu}{diadia.dat}
436 \end{diadiaplot}
437 \end{diadiasidebyside}
438 \section{Pharmaceuticals}
439 \begin{medicationchart}{}{16.02.2015}
440 \mcentry{Oxycodon-HCI STADA 10mg Retardtabletten}{1}{1}{1}{0}{}
441 \mcentry{Insulin}{1}{1}{1}{0}{see data}
442 \mcentry{Unacid 3g}{1}{0}{1}{1}{infusion 08:00, 16:00, 00:00}
443 \mcentry{Mono-Embolex 3000 I.E. Prophylaxe}{0}{0}{1}{0}{}
444 \end{medicationchart}
445 \begin{medicationchart}{}{24.02.2015}
446 \mcentry{Oxycodon-HCI STADA 10mg Retardtabletten}{0}{0}{1}{0}{}
447 \mcentry{Insulin}{1}{1}{1}{0}{see data}
448 \mcentry{Mono-Embolex 3000 I.E. Prophylaxe}{0}{0}{1}{0}{}
449 \end{medicationchart}
450 \begin{medicationchart}{}{28.02.2015}
451 \mcentry{Oxycodon-HCI STADA 10mg Retardtabletten}{0}{0}{1}{0}{}
452 \mcentry{Metformin}{2}{0}{2}{0}{}
453 \mcentry{Mono-Embolex 3000 I.E. Prophylaxe}{0}{0}{1}{0}{}
454 \end{medicationchart}
455 \chapter{March 2015}
456 \section{Data}
457 \begin{diadiasidebyside}
458 \diadiatab{columns={date,bsl1,bsl2,bsl3}}{201503.dat}
459
460 \begin{diadiaplot}[plotstyle=bloodsugar]{xmin=2015-03-01,xmax=2015-03-31}
461 \diadiaaddplot{}{x=date,y=bsl1}{diadia.dat}
462 \diadiaaddplot{}{x=date,y=bsl2}{diadia.dat}
463 \diadiaaddplot{}{x=date,y=bsl3}{diadia.dat}
464 \legend{morning,noon,evening}
465 \end{diadiaplot}
466 \end{diadiasidebyside}
467 \section{Pharmaceuticals}
468 \begin{medicationchart}{}{03.03.2015}
469 \mcentry{Oxycodon-HCI STADA 10mg Retardtabletten}{0}{0}{1}{0}{}
470 \mcentry{Januvia 100mg}{1}{0}{0}{0}{replaces Metformin due to op}
471 \mcentry{Mono-Embolex 3000 I.E. Prophylaxe}{0}{0}{1}{0}{}
472 \end{medicationchart}
473 \begin{medicationchart}{}{10.03.2015}
474 \mcentry{Oxycodon-HCI STADA 10mg Retardtabletten}{0}{0}{1}{0}{}
475 \mcentry{Novaminsulfon Lichtenstein 500 mg}{1}{1}{1}{1}{}
476 \mcentry{Januvia 100mg}{1}{0}{0}{0}{}
477 \mcentry{Unacid 3g}{1}{0}{1}{1}{infusion 08:00, 16:00, 00:00}
478 \mcentry{Mono-Embolex 3000 I.E. Prophylaxe}{0}{0}{1}{0}{}
479 \end{medicationchart}
480 \begin{medicationchart}{}{20.03.2015}
481 \mcentry{Oxycodon-HCI STADA 10mg Retardtabletten}{0}{0}{1}{0}{}
482 \mcentry{Novaminsulfon Lichtenstein 500 mg}{1}{1}{1}{1}{}
483 \mcentry{Unacid 3g}{1}{0}{1}{1}{infusion 08:00, 16:00, 00:00}
484 \mcentry{Mono-Embolex 3000 I.E. Prophylaxe}{0}{0}{1}{0}{}
485 \end{medicationchart}
486 \begin{medicationchart}{}{30.03.2015}
487 \mcentry{Oxycodon-HCI STADA 10mg Retardtabletten}{0}{0}{1}{0}{}
488 \mcentry{Novaminsulfon Lichtenstein 500 mg}{1}{1}{1}{1}{}
489 \mcentry{Mono-Embolex 3000 I.E. Prophylaxe}{0}{0}{1}{0}{}
490 \end{medicationchart}
491 \chapter{April 2015}
492 \section{Data}
493 \begin{diadiasidebyside}
494 \diadiatab{columns={date,value,avg07,avg30,avg90}}{201504.dat}
495
496 \begin{diadiaplot}[plotstyle=bloodsugar]{xmin=2015-04-02,xmax=2015-04-29}
497 \annotation[text width=1.4cm]{2015-04-10}{123}{rise after discharge}
498 \diadiaaddplot{plot4,nomarks}{x=date,y=avg90}{ddbsl1avg.dat}
499 \diadiaaddplot{plot3,nomarks}{x=date,y=avg30}{ddbsl1avg.dat}
500 \diadiaaddplot{plot2,nomarks}{x=date,y=avg07}{ddbsl1avg.dat}
501 \diadiaaddplot{plot1}{x=date,y=value}{ddbsl1avg.dat}
502 \legend{$\varnothing_{90}$,$\varnothing_{30}$,$\varnothing_{7}$,morning}
503 \end{diadiaplot}
504 \end{diadiasidebyside}
505
506 \section{Pharmaceuticals}
507 \begin{medicationchart}{}{02.04.2015}
508 \mcentry{Oxycodon-HCI STADA 10mg Retardtabletten}{0}{0}{1}{0}{}
509 \mcentry{Novaminsulfon Lichtenstein 500 mg}{1}{1}{1}{1}{}
510 \mcentry{Mono-Embolex 3000 I.E. Prophylaxe}{0}{0}{1}{0}{}
511 \end{medicationchart}
512
513 \begin{medicationchart}{}{07.04.2015}
514 \mcentry{Oxycodon-HCI STADA 10mg Retardtabletten}{0}{0}{1}{0}{}
515 \mcentry{Novaminsulfon Lichtenstein 500 mg}{1}{1}{1}{1}{}
516 \mcentry{Mono-Embolex 3000 I.E. Prophylaxe Novartis}{0}{0}{1}{0}{}
517 \mcentry{Sultamicillin-ratiopharm 375mg}{1}{0}{1}{0}{}
518 \end{medicationchart}
519
520 \begin{medicationchart}{}{16.04.2015}
521 \mcentry{Oxycodon-HCI STADA 10mg Retardtabletten}{0}{0}{1}{0}{}
522 \mcentry{Novaminsulfon Lichtenstein 500 mg}{1}{1}{1}{1}{}
523 \mcentry{Mono-Embolex 3000 I.E. Prophylaxe Novartis}{0}{0}{1}{0}{}
524 \mcentry{Amoclav 875mg + 125mg (Amoxicillin, Clavulansäure) Hexal}{1}{0}{1}{0}{}
525 \end{medicationchart}
526
527 \begin{medicationchart}{}{20.04.2015}
528 \mcentry{Oxycodon-HCI STADA 10mg Retardtabletten}{0}{0}{1}{0}{}
529 \mcentry{Novaminsulfon Lichtenstein 500 mg}{1}{1}{1}{1}{}
530 \mcentry{ASS protect 100mg}{0}{1}{0}{0}{}
531 \mcentry{Amoclav 875mg + 125mg (Amoxicillin, Clavulansäure) Hexal}{1}{0}{1}{0}{}
532 \end{medicationchart}
533
534 \section{Misc.}
535
536 \infobox{width=8cm}{22.04.2015}{
537 Podiatrist appointment:
538
539 \bigskip
540 22.04.2015 11:30
541
542 \medskip
543 \Telefon\ 089/65831933
544 }
545 \end{document}
546 %</examplefile>
547 %<*manifest>
548 This work consists of the following files:
549
550 diadia.pdf
551 diadia.dtx
552 diadia-example.pdf
553 README
554 makefile
555
556 Files packaged in diadia.dtx:
557
558 diadia.sty
559 diadia.cfg
560 diadia-fallback.trsl
561 diadia-english.trsl
562 diadia-german.trsl
563 diadia.dat
564 201502.dat
565 201503.dat
566 201504.dat
567 hba1c.dat
568 diadia-example.tex
569 manifest.txt
570 %</manifest>
571 %<*internal>
572 \fi
573 \def\nameofplainTeX{plain}
574 \ifx\fmtname\nameofplainTeX\else
575 \expandafter\begingroup
576 \fi
577 %</internal>
578 %<*install>
579 \input docstrip.tex
580 \keepsilent
581 \askforoverwritefalse
582 \preamble
583
584 Copyright (C) 2015 by:
585 Josef Kleber
586 <[email protected]>
587
588 This file may be distributed and/or modified under the conditions of
589 the LaTeX Project Public License, either version 1.3 of this license
590 or (at your option) any later version. The latest version of this
591 license is in:
592
593 http://www.latex-project.org/lppl.txt
594
595 and version 1.3 or later is part of all distributions of LaTeX version
596 2003/12/01 or later.
597
598 This work has the LPPL maintenance status "maintained".
599
600 The Current Maintainer of this work is Josef Kleber.
601
602 This work consists of all files listed in manifest.txt.
603
604 \endpreamble
605
606 \usedir{tex/latex/diadia}
607 \generate{
608 \file{\jobname.sty}{\from{\jobname.dtx}{package}}
609 }
610 \generate{
611 \file{\jobname.cfg}{\from{\jobname.dtx}{cfg}}
612 }
613 \generate{
614 \file{\jobname-fallback.trsl}{\from{\jobname.dtx}{fallback}}
615 }
616 \generate{
617 \file{\jobname-english.trsl}{\from{\jobname.dtx}{english}}
618 }
619 \generate{
620 \file{\jobname-german.trsl}{\from{\jobname.dtx}{german}}
621 }
622 \generate{
623 \file{\jobname-example}{\from{\jobname.dtx}{examplefile}}
624 }
625 \nopreamble\nopostamble
626 \usedir{scripts/diadia}
627 \generate{
628 \file{\jobname.lua}{\from{\jobname.dtx}{lua}}
629 }
630 \usedir{doc/latex/diadia}
631 \generate{
632 \file{\jobname.dat}{\from{\jobname.dtx}{data}}
633 }
634 \generate{
635 \file{ddbsl1avg.dat}{\from{\jobname.dtx}{dataavg}}
636 }
637 %</install>
638 %<install>\endbatchfile
639 %<*internal>
640 \generate{
641 \file{\jobname.dat}{\from{\jobname.dtx}{data}}
642 }
643 \generate{
644 \file{201502.dat}{\from{\jobname.dtx}{feb15}}
645 }
646 \generate{
647 \file{201503.dat}{\from{\jobname.dtx}{mar15}}
648 }
649 \generate{
650 \file{201504.dat}{\from{\jobname.dtx}{apr15}}
651 }
652 \generate{
653 \file{hba1c.dat}{\from{\jobname.dtx}{hba1c}}
654 }
655 \generate{
656 \file{README.txt}{\from{\jobname.dtx}{readme}}
657 }
658 \generate{
659 \file{manifest.txt}{\from{\jobname.dtx}{manifest}}
660 }
661 \generate{
662 \file{\jobname.bib}{\from{\jobname.dtx}{bibfile}}
663 }
664 \ifx\fmtname\nameofplainTeX
665 \expandafter\endbatchfile
666 \else
667 \expandafter\endgroup
668 \fi
669 %</internal>
670 %<*driver>
671 \documentclass[a4paper]{ltxdoc}%
672 \usepackage[english]{babel}%
673 \usepackage[utf8]{inputenc}%
674 \usepackage[T1]{fontenc}%
675 \usepackage{textcomp}%
676 \usepackage{lmodern}%
677 \usepackage{bera}%
678 \usepackage{microtype}%
679 \usepackage{marginnote}%
680 \usepackage[svgnames,rgb]{xcolor}%
681 \usepackage{listings}%
682 \usepackage{makeidx}
683 \usepackage[numbered]{hypdoc}
684 \usepackage{ragged2e}%
685 \usepackage{url}%
686 \usepackage{csquotes}%
687 \usepackage{diadia}%
688 \usepackage{alltt}%
689 \usepackage{marvosym}%
690 \usepackage[automark,nouppercase]{scrpage2}
691 \usepackage{tikz}
692 \usetikzlibrary{calc}%
693 % turn off idiotic tikz error in doc generation
694 \makeatletter
695 \global\let\tikz@ensure@dollar@catcode=\relax
696 \makeatother
697 \usepackage{hyperref}
698 \EnableCrossrefs
699 \CodelineIndex
700 \RecordChanges
701 \makeatletter
702 \setlength{\headheight}{1.1\baselineskip}%
703 \renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
704 {-2.5ex\@plus -1ex \@minus -.25ex}%
705 {1.25ex \@plus .25ex}%
706 {\normalfont\normalsize\bfseries}}
707 \setcounter{secnumdepth}{5}
708 \setcounter{tocdepth}{5}
709 \hypersetup{colorlinks=true,urlcolor=NavyBlue,linkcolor=NavyBlue,citecolor=CornflowerBlue}%
710 \lstset{literate=%
711 {Ö}{{\"O}}1
712 {Ä}{{\"A}}1
713 {Ü}{{\"U}}1
714 {ß}{{\ss}}1
715 {ü}{{\"u}}1
716 {ä}{{\"a}}1
717 {ö}{{\"o}}1
718 {~}{{\textasciitilde}}1
719 }
720 \lstset{language=[LaTeX]TeX,numbers=left,numberstyle=\tiny, basicstyle=\ttfamily, aboveskip=\baselineskip, frame=single, backgroundcolor=\color{LightGoldenrodYellow}, keywordstyle=\color{Blue},
721 emph={}}
722 \renewcommand{\maketitle}%
723 {%
724 \thispagestyle{empty}%
725 \pagecolor{Ivory}%
726 \begin{titlepage}%
727 \begin{tikzpicture}[remember picture,overlay]%
728 \node[yshift=-2cm] at (current page.north west)%
729 {%
730 \begin{tikzpicture}[remember picture, overlay]%
731 \draw[fill=CornflowerBlue,color=CornflowerBlue] (0,0) rectangle%
732 (\paperwidth,2cm);%
733 \draw[anchor=west,yshift=-4cm,xshift=3cm,color=NavyBlue] (0,0) node%
734 {\parbox{15cm}{\RaggedRight\Huge\sffamily\textbf{\@title}}};%
735 \draw[anchor=west,yshift=-5.5cm,xshift=3cm,color=NavyBlue] (0,0) node%
736 {\parbox{15cm}{\huge\sffamily\textbf{\@fileversion}}};%
737 \draw[anchor=west,yshift=-7.5cm,xshift=3cm,color=NavyBlue] (0,0) node%
738 {\parbox{15cm}{\RaggedRight\huge\sffamily\textbf{\@subtitle}}};%
739 \draw[anchor=west,yshift=-13.2cm,xshift=3cm,color=NavyBlue] (0,0) node%
740 {\usebox\logo};%
741 \draw[anchor=west,yshift=-18.5cm,xshift=3cm,color=NavyBlue] (0,0) node%
742 {\parbox{15cm}{\huge\sffamily\textbf{\@date}}};%
743 \draw[anchor=west,yshift=-20.5cm,xshift=3cm,color=NavyBlue] (0,0) node%
744 {\parbox{15cm}{\Large\sffamily{\@authorline\\\textbf{\@author}}}};%
745 \end{tikzpicture}%
746 };%
747 \node[yshift=0cm] at (current page.south west)%
748 {%
749 \begin{tikzpicture}[remember picture, overlay]%
750 \draw[fill=NavyBlue,color=NavyBlue,yshift=6cm,xshift=2cm] (0,0) rectangle (0.2cm,19cm);%
751 \draw[fill=CornflowerBlue,color=CornflowerBlue] (0,0) rectangle (\paperwidth,2cm);%
752 \draw[anchor=west,yshift=1cm,xshift=3cm,color=NavyBlue] (0,0) node%
753 {\parbox{15cm}{\large\sffamily{\@refline}}};%
754 \end{tikzpicture}%
755 };%
756 \end{tikzpicture}%
757 \end{titlepage}%
758 \pagecolor{white}%
759 }%
760 %
761 %
762 \newcommand*{\@tikzhead}[1]%
763 {%
764 \begin{tikzpicture}[remember picture,overlay]%
765 \node[yshift=-2cm] at (current page.north west)%
766 {%
767 \begin{tikzpicture}[remember picture, overlay]%
768 \draw[fill=CornflowerBlue] (0,0) rectangle (\paperwidth,2cm);%
769 \draw[anchor=west,yshift=1cm,xshift=1.5cm,color=NavyBlue] (0,0) node%
770 {\parbox{15cm}{\LARGE\sffamily\textbf{\@title}}};%
771 \node[anchor=east,xshift=.9\paperwidth,rectangle,%
772 rounded corners=15pt,inner sep=11pt,fill=NavyBlue]%
773 {\color{white}\textsc{#1}};%
774 \end{tikzpicture}%
775 };%
776 \end{tikzpicture}%
777 }%
778 \clearscrheadings%
779 \ihead{\@tikzhead{\headmark}}%
780 \cfoot{\upshape\thepage}%
781 \pagestyle{scrheadings}%
782 %
783 \newcommand*{\Headline}[1]{\@mkboth{#1}{#1}}%
784 %
785 \renewcommand{\headfont}{\normalfont\mdseries\scshape}
786 %
787 \gdef\@subtitle{}%
788 \providecommand*{\Subtitle}[1]{\gdef\@subtitle{#1}}%
789 \gdef\@fileversion{}%
790 \providecommand*{\Fileversion}[1]{\gdef\@fileversion{#1}}%
791 \gdef\@author{}%
792 \providecommand*{\Author}[1]{\gdef\@author{#1}}%
793 \gdef\@authorline{Package author:}%
794 \providecommand*{\Authorline}[1]{\gdef\@authorline{#1}}%
795 \gdef\@refline{}%
796 \providecommand*{\Refline}[1]{\gdef\@refline{#1}}%
797 \gdef\and{\unskip{}, }%
798 \newcommand\doubledash{-\kern0.5pt-}
799 \def\enoteformat{\rightskip\z@ \leftskip\z@ \parindent=1em\leavevmode\llap{\makeenmark}}
800 \def\XeLaTeX{Xe\LaTeX}%
801 %
802 \newenvironment{optionlist}
803 {\begin{trivlist}\setlength\leftskip{2em}}
804 {\end{trivlist}}
805 \newcommand\optitem[3]{\item [\texttt{\textbf{\textcolor{DodgerBlue}{#1}} \lbrack\textcolor{Crimson}{#2}\rbrack}] #3}
806 \newcommand\optitemii[2]{\item [\texttt{\textbf{\textcolor{DodgerBlue}{#1}}}] \texttt{\lbrack\textcolor{Crimson}{#2}\rbrack}}
807 \newcommand\optitempgf[2]{\item [\texttt{\textbf{\textcolor{DodgerBlue}{#1}}}] #2}
808 \renewcommand\tableofcontents%
809 {%
810 %\section*{\contentsname}%
811 \@mkboth{%
812 \MakeUppercase\contentsname}{\MakeUppercase\contentsname}%
813 \@starttoc{toc}%
814 }%
815 %
816 \newcommand\env[1]{\texttt{#1}\SortIndex{#1}{\string{\string\ttfamily\space#1\string} (environment)}%
817 \SortIndex{environments:>#1}{\string{\string\ttfamily\space#1\string}}}%
818 \newcommand\stylename[1]{\texttt{#1}\SortIndex{#1}{{\ttfamily #1} (Style file)}%
819 \SortIndex{Style file>#1}{\texttt{#1}}}%
820 \newcommand\package[1]{\texttt{#1}\SortIndex{#1}{{\ttfamily #1} (Package)}%
821 \SortIndex{Package>#1}{\texttt{#1}}}%
822 \newcommand*\margcs[1]{\marginnote{\hbadness=10000\RaggedLeft\scriptsize #1}}%
823 \def\PrintIndex{\clearpage\Headline{Index}\@input@{\jobname.ind}%
824 \global\let\PrintIndex\@empty}
825 \renewenvironment{theindex}
826 {\if@twocolumn
827 \@restonecolfalse
828 \else
829 \@restonecoltrue
830 \fi
831 \columnseprule \z@
832 \columnsep 35\p@
833 \def\see##1##2{\textit{See} ##1}%
834 \def\seealso##1##2{\textit{See also} ##1}%
835 \long\def\cmd##1{\cs{\expandafter\cmd@to@cs\string##1}}%
836 \def\@url##1{\url@break\ttt{##1}\endgroup}%
837 \def\ttt{\begingroup\@sanitize\ttfamily\@ttt}%
838 \def\@ttt##1{##1\endgroup}%
839 \mathchardef\save@secnumdepth\c@secnumdepth
840 \c@secnumdepth\m@ne
841 \phantomsection%
842 \twocolumn%[\section{\indexname}]%
843 \refstepcounter{section}
844 \addcontentsline{toc}{section}{\protect\numberline{\thesection}Index}%
845 \c@secnumdepth\save@secnumdepth
846 %\thispagestyle{plain}
847 \parindent\z@
848 \parskip\z@ \@plus .3\p@\relax
849 \let\item\@idxitem}
850 {\if@restonecol\onecolumn\else\clearpage\fi}
851 \setlength\parindent{0pt}%
852 \newcommand*\myref[1]{[see: \ref{#1} on page \pageref{#1}]}
853 \makeatother
854 \begin{document}
855 \DocInput{\jobname.dtx}
856 \end{document}
857 %</driver>
858 % \fi
859 %
860 % \GetFileInfo{\jobname.sty}
861 %
862 % \hypersetup{pdfauthor={Josef Kleber},pdftitle={A LaTeX package for keeping a diabetes diary},pdfsubject={Documentation for LaTeX package \filename}}%
863 % \lstset{language=[LaTeX]TeX,numbers=left,numberstyle=\tiny, basicstyle=\ttfamily, aboveskip=\baselineskip, frame=single, backgroundcolor=\color{LightGoldenrodYellow}, keywordstyle=\color{Blue},
864 % emph={medicationchart,diadiasidebyside,diadiaplot},emphstyle=\color{Tomato},
865 % emph={[2]columns,column,chol,string,replace,name,ddpuser,font,tabstyle,tabcolor,date,type,bsl1,bsl2,bsl3,plotstyle,xlabel,tick,label,style,xmin,xmax,x,y,
866 % text,width,very,thick,fill,draw,mark,options,anchor},
867 % emphstyle={[2]\color{OliveDrab}},
868 % morekeywords={pgfplotsset,pgfplotstableset,diadiatab,diadiaaddplot,legend,annotation,setlimit,mcentry,infobox,Telefon,varnothing,lastdate}}
869 % \DoNotIndex{\,,\\,\begin,\end,\begingroup,\endgroup,\csname,\def,\else,\endcsname,\equal,\expandafter,
870 % \fi,\gdef,\ifnum,\ifthenelse,\immediate,\MessageBreak,\NeedsTeXFormat,\newcommand,\renewcommand,\NewEnviron,\newenvironment,\newif,
871 % \PackageInfo,\PackageError,\ProcessOptionsX,\ProvidesPackage,\relax,\RequirePackage,
872 % \space,\errmessage,\ExecuteOptionsX,\n}
873 %
874 % \setlength\parskip{6pt}%
875 % \bibliographystyle{plain}
876 % \title{\filename}%
877 % \Subtitle{A \LaTeX{} package for keeping a diabetes diary}%
878 % \author{Josef Kleber}
879 % \Fileversion{\fileversion}
880 % \date{\filedate}
881 % \Refline{\href{mailto:[email protected]}{\texttt{[email protected]}}\\\href{https://bitbucket.org/kleberj/diadia/}{\texttt{https://bitbucket.org/kleberj/diadia/}}}
882 % \newsavebox\logo
883 % \savebox\logo{%
884 % \begin{diadiaplot}[plotstyle=bloodsugar]
885 % {
886 % xlabel=2015,
887 % tick label style={font=\footnotesize},
888 % legend style={draw=NavyBlue},
889 % ytick={90,120,150,210,240},
890 % xmin=2015-02-18,
891 % xmax=2015-02-28,
892 % width=9cm,
893 % color=NavyBlue
894 % }
895 % \diadiaaddplot{}{x=date,y=bsl1}{diadia.dat}
896 % \diadiaaddplot{}{x=date,y=bsl2}{diadia.dat}
897 % \diadiaaddplot{}{x=date,y=bsl3}{diadia.dat}
898 % \annotation[text width=0.9cm]{2015-02-22}{215}{My first annoation}
899 % \setlimit[very thick]{140,180}
900 % \legend{morning,noon,evening}
901 % \end{diadiaplot}
902 %}
903 % \maketitle
904 % \stepcounter{page}
905 % \tableofcontents
906 % \clearpage
907 %
908 %
909 %\StopEventually{^^A
910 % {
911 % \clearpage
912 % \raggedright
913 % \nocite{*}
914 % \bibliography{\jobname}
915 % }
916 % \clearpage
917 % \PrintChanges
918 % \PrintIndex
919 %}
920 %
921 % \Headline{Abstract}
922 % \begin{abstract}
923 % The \package{diadia} package allows you to keep a diabetes diary.
924 % Usually, this means keeping record of certain medical values
925 % like blood sugar, blood pressure, pulse or weight. It might
926 % also include other medical, pharmaceutical or nutritional
927 % data ($\text{HbA}_{\text{1c}}$, insulin doses, carbohydrate units). The \package{diadia}
928 % package supports all of this plus more - simply by adding
929 % more columns to the data file!
930 %
931 % It is able to evaluate the data file and typesets formatted
932 % tables and derived plots. Furthermore, it supports medication
933 % charts and info boxes.
934 % \end{abstract}
935 % \clearpage
936 %
937 % \section{Options}
938 % The following options can be set as package options with global scope,
939 % as well as command options with local scope:
940 %
941 % \begin{optionlist}
942 % \optitem{tabstyle}{simple}{sets the style of the tables}
943 % \optitem{tabcolor}{none}{sets the color of the table}
944 % \optitem{plotstyle}{none}{sets the predefined style of your plot}
945 % \optitem{plotclosedcycle}{false}{sets an implicit \cmd\closedcycle\ command inside a filled plot (weight). This is usually controlled by \texttt{plotstyle.}}
946 % \optitem{mcnotewidth}{3cm}{sets the width of the note column in medication charts}
947 % \optitem{columnsep}{18pt}{sets the distance of columns inside \env{diadiasidebyside} environments}
948 % \optitem{columnseprule}{0pt}{sets the width of the separation rule between columns}
949 % \optitem{columnseprulecolor}{\cmd\normalcolor}{sets the color of the separation rule. The \package{diadia} package follows the usage of options in the \package{multicol}\cite{bib:multicol} package. Thus, this option must be a color command like \cmd\color\{blue\} -- not just a color name!}
950 % \end{optionlist}
951 %
952 % Furthermore, the design of this package is defined by several Ti\textit{k}z-like styles.
953 % These can be (re)defined with \cmd\tikzstyle, \cmd\tcbset, \cmd\pgfplotsset\ or \cmd\pgfplotstableset\ with the usual syntax:
954 %
955 % \verb|key/.style={}| or\\
956 % \verb|key/.append style={}|, e.g.:
957 %
958 % \iffalse
959 %<*example>
960 % \fi
961 \begin{lstlisting}
962 \pgfplotsset{ddpuser/.style={thin}}
963 \end{lstlisting}
964 % \iffalse
965 %</example>
966 % \fi
967 %
968 % These definitions are out-sourced into \texttt{diadia.cfg}. You can copy this file to your local \TeX\ tree
969 % to alter definitions or to add new ones.
970 %
971 % Among other things, it defines the general plot styles \texttt{ddpuser} and \texttt{ddpdefault}, as well as the special
972 % plot styles \texttt{ddpweight}, \texttt{ddpbloodpressure}, \texttt{ddpinsulin}, \texttt{ddpbloodsugar}, \texttt{ddppulse},
973 % \texttt{ddpcu} and \texttt{ddphbaonec}. Additionally, it defines the special styles \texttt{ddpweightplot} for
974 % filled weight plots and \texttt{nomarks} for \enquote{deleting} the data marks.
975 %
976 % Furthermore, it defines the appearance of tables in general and header elements. It defines the usually used color cycle list
977 % \texttt{diadiacyclelist} and make the color styles also available as \texttt{plot1} to \texttt{plot4}.
978 %
979 % Moreover, it defines the \texttt{ddpannotation}, \texttt{setlimit} and \texttt{ddaddplotfill} for filled plots (\texttt{teal!50}).
980 % Finally, it defines the box styles \texttt{medicationchart} and \texttt{infobox} based on \texttt{ddboxdefault}.
981 % See section \ref{sec:config} on page \pageref{sec:config} for a more or less detailed description of the config file.
982 %
983 % The \package{pgfplots}\cite{bib:pgfplots}, \package{pgfplotstable}\cite{bib:pgfplotstable} and \package{tcolorbox}\cite{bib:tcolorbox} packages offer
984 % zillions of options to influence the design!
985 % \Headline{2 Storing data}
986 % \section{Storing data}
987 % The very simple basic structure of the data file is as follows:
988 %
989 % \begin{center}
990 % \begin{alltt}\input{201502.dat}\end{alltt}
991 % \end{center}
992 %
993 % It is a simple text file with columns seperated by <space> or <tab>.
994 % Thus, empty cells must be marked either with an empty group (\texttt{\{\}}) or the special marker \texttt{nan} (not a number).
995 % In plots, empty groups will simply be ignored, where as \texttt{nan} will result in jumps in the plots.
996 % The data file starts with a header row. Its keys will be used to plot the data or to typeset tables.
997 %
998 % \begin{center}
999 % \begin{tabular}{>{\bfseries}rl}
1000 % \toprule
1001 % \multicolumn{2}{c}{standard keys} \\\midrule
1002 % date & entry date \\
1003 % bsl1-3 & three blood sugar levels (morning, noon, evening) \\
1004 % id1-3 & three insulin doses \\
1005 % bps & blood pressure (systolic) \\
1006 % bpd & blood pressure (diastolic) \\
1007 % weight & weight \\
1008 % cu & carbohydrate units \\
1009 % pul & pulse\\
1010 % hba1c\footnotemark & $\text{HbA}_{\text{1c}}$ \\
1011 % \bottomrule
1012 % \end{tabular}
1013 % \footnotetext{long term values can be stored in a seperate data file}
1014 % \end{center}
1015 %
1016 % You can easily add other columns or delete existing ones. You can even rename these columns, but you would have to redefine a lot of internal commands.
1017 % You must not neither rename the \texttt{date} key nor change its format (YYYY-MM-DD)!
1018 %
1019 % Lets say you want to add a cholesterol column, then you should at least define the following key:
1020 %
1021 % \iffalse
1022 %<*example>
1023 % \fi
1024 \begin{lstlisting}
1025 \pgfplotstableset
1026 {
1027 columns/chol/.style=
1028 {
1029 string replace={nan}{},
1030 column name={Chol.}
1031 }
1032 }
1033 \end{lstlisting}
1034 % \iffalse
1035 %</example>
1036 % \fi
1037 %
1038 % This sets the column name in tables and prevents that \texttt{nan} values are printed. For plots you only need the \texttt{chol} key!
1039 %
1040 % \section{Editing data}
1041 % \label{sec:diadialua}
1042 %
1043 % The \texttt{diadia.lua} script offers several ways to edit your data file. At the moment it supports the following modes:
1044 % \begin{itemize}
1045 % \item[\texttt{cut}] This mode allows you to cut chunks of data out of your data file, e.g. for preparing data files for monthly reports.
1046 %
1047 % \iffalse
1048 %<*example>
1049 % \fi
1050 \begin{lstlisting}
1051 $ diadia -m cut -i diadia.dat -o 201504.dat -s 2015-04-01
1052 -e 2015-04-30
1053 set mode to cut
1054 reading data file diadia.dat
1055 writing data file 201504.dat
1056 \end{lstlisting}
1057 % \iffalse
1058 %</example>
1059 % \fi
1060 % \item[\texttt{compose}] This mode allows you to rearrange the columns of your data file, e.g. as preperation for the \texttt{average} mode
1061 %
1062 % \iffalse
1063 %<*example>
1064 % \fi
1065 \begin{lstlisting}
1066 $ diadia -m compose -i diadia.dat -o ddbsl1.dat -c 1,2
1067 set mode to compose
1068 reading data file diadia.dat
1069 writing data file ddbs1.dat
1070 \end{lstlisting}
1071 % \iffalse
1072 %</example>
1073 % \fi
1074 % \item[\texttt{average}] This mode allows you to create a new data file. By definition, it takes the first
1075 % two columns (\texttt{date} and \texttt{value}) of the input file and adds columns for the 7, 14, 30,
1076 % 60 and 90 days average.\footnote {Your data files should be big enough, as a correct 90 day average can
1077 % of course only be calculated with data starting at least 90 days \textbf{before} the date period you
1078 % want to visualize.}
1079 %
1080 % \clearpage
1081 % \iffalse
1082 %<*example>
1083 % \fi
1084 \begin{lstlisting}
1085 $ diadia -m average -i ddbsl1.dat -o bsl1.dat
1086 set mode to average
1087 reading data file ddbs1.dat
1088 writing data file bsl1.dat
1089 \end{lstlisting}
1090 % \iffalse
1091 %</example>
1092 % \fi
1093 % \end{itemize}
1094 %
1095 % As shown in the examples, the script supports the following command line options:
1096 %
1097 % \begin{optionlist}
1098 % \optitempgf{-m}{specify the mode (cut\textbar{}compose\textbar{}average)}
1099 % \optitempgf{-i}{specify the input file}
1100 % \optitempgf{-o}{specify the output file}
1101 % \optitempgf{-c}{specify a list of columns for \texttt{compose} mode, e.g. \texttt{-c 1,2}\footnote{even crazy things like \texttt{-c 1,2,2,2} work}}
1102 % \optitempgf{-s}{specify the start date (\texttt{YYYY-MM-DD}) in \texttt{cut} and \texttt{average} mode}
1103 % \optitempgf{-e}{specify the end date}
1104 % \optitempgf{-v}{prints version information}
1105 % \optitempgf{-h}{prints help information}
1106 % \end{optionlist}
1107 %
1108 % Furthermore, the script provides the following error codes:
1109 %
1110 % \begin{optionlist}
1111 % \optitempgf{\space0}{as usual, everythings fine!}
1112 % \optitempgf{\space1}{general error}
1113 % \optitempgf{11}{no \texttt{mode} specified}
1114 % \optitempgf{12}{invalid \texttt{mode}}
1115 % \optitempgf{21}{wrong date format (\texttt{YYYY-MM-DD})}
1116 % \end{optionlist}
1117 %
1118 %
1119 % \section{Managing data}
1120 %
1121 % In principal, it's enough to have just one data file, but it might be worth considering to use a seperate data
1122 % file for long term values like $\text{HbA}_{\text{1c}}$. You might also want to have monthly data files for the
1123 % \cmd\diadiatab\ command. These can easily be created with the \texttt{cut} mode of \texttt{diadia.lua}! You can simplify
1124 % your data management for example with a \texttt{makefile}\footnote{This works also on a Windows system with an environment like Cygwin.}:
1125 %
1126 % \iffalse
1127 %<*example>
1128 % \fi
1129 \begin{lstlisting}
1130 NAME = mydiadia
1131 TODAY = $(shell date +'%Y-%m-%d')
1132 RM = rm -f
1133
1134 all: doc
1135
1136 today:
1137 echo "\def\lastdate{$(TODAY)}" >today.dat
1138
1139 doc: today
1140 pdflatex $(NAME)
1141 pdflatex $(NAME)
1142 openar ./$(NAME).pdf &
1143
1144 dat:
1145 diadia -m cut -i diadia.data -o diadia.dat -s 2015-02-18
1146 -e $(TODAY)
1147 diadia -m cut -i longterm.data -o longterm.dat -s 2015-02
1148 -18 -e $(TODAY)
1149 diadia -m average -i diadia.dat -o ddbsl1avg.dat
1150 diadia -m cut -i diadia.dat -o 201502.dat -s 2015-02-18 -
1151 e 2015-02-28
1152 diadia -m cut -i diadia.dat -o 201503.dat -s 2015-03-01 -
1153 e 2015-03-31
1154 diadia -m average -i diadia.dat -o 201504.dat -s 2015-04-
1155 01 -e 2015-04-30
1156 diadia -m average -i diadia.dat -o 201505.dat -s 2015-05-
1157 01 -e $(TODAY)
1158
1159 clean:
1160 $(RM) *.aux *.log *.out *.toc
1161
1162 cleanall: clean
1163 $(RM) $(NAME).pdf *.dat
1164
1165 .PHONY: all today doc dat clean cleanall
1166 \end{lstlisting}
1167 % \iffalse
1168 %</example>
1169 % \fi
1170 %
1171 % It provides the two major targets \texttt{dat} for data management and \texttt{doc} for
1172 % creating your diary.\footnote{\texttt{openar} is a simple shell script, which opens the resulting \texttt{PDF} file with Adobe Reader.}
1173 % Furthermore, it provides \texttt{today.dat},\footnote{simply \texttt{\cmd\input\{today.dat\}}}
1174 % which provides the \cmd\lastdate\ macro with current date in \texttt{YYYY-MM-DD} format.
1175 % Finally, it provides the cleanup targets \texttt{clean} and \texttt{cleanall}.
1176 %
1177 % \section{Presenting data}
1178 % \subsection{Tables}
1179 %
1180 % The \cmd\diadiatab\margcs{\cmd\diadiatab\oarg{options}\\\marg{pgfplotstable options}\marg{file}} command typesets the data file specified
1181 % by \marg{file} in a table. Now, you can typeset the example data in a formatted table:
1182 %
1183 % \iffalse
1184 %<*example>
1185 % \fi
1186 \begin{lstlisting}
1187 \diadiatab{font=\scriptsize}{201502.dat}
1188 \end{lstlisting}
1189 % \iffalse
1190 %</example>
1191 % \fi
1192 %
1193 %\diadiatab{font=\scriptsize}{201502.dat}
1194 %
1195 % \bigskip
1196 % You can influence the design with the following options:
1197 %
1198 % \begin{optionlist}
1199 % \optitem{tabstyle}{\underline{simple}, advanced}{}
1200 % \optitem{tabcolor}{\underline{none}, color name}{}
1201 % \end{optionlist}
1202 %
1203 % \iffalse
1204 %<*example>
1205 % \fi
1206 \begin{lstlisting}
1207 \diadiatab[tabstyle=advanced,tabcolor=gray!30]
1208 {font=\scriptsize}{201502.dat}
1209 \end{lstlisting}
1210 % \iffalse
1211 %</example>
1212 % \fi
1213 %
1214 % \diadiatab[tabstyle=advanced,tabcolor=gray!30]{font=\scriptsize}{201502.dat}
1215 %
1216 % \bigskip
1217 % Here's a list of interesting keys for \marg{pgfplotstable options}, but there are of course
1218 % much more in the \package{pgfplotstable}\cite{bib:pgfplotstable} package documentation!
1219 %
1220 % \begin{optionlist}
1221 % \optitempgf{font}{accepts usual font commads}
1222 % \optitempgf{columns}{takes a list of columns, which should be typeset}
1223 % \optitempgf{column name}{sets the column heading (replacement of \texttt{key})}
1224 % \optitempgf{date type}{sets the date format}
1225 % \end{optionlist}
1226 %
1227 % \iffalse
1228 %<*example>
1229 % \fi
1230 \begin{lstlisting}
1231 \diadiatab[tabstyle=advanced,tabcolor=gray!30]
1232 {
1233 font=\small,
1234 columns={date,bsl1,bsl2,bsl3},
1235 columns/bsl1/.append style={column name={B1}},
1236 columns/bsl2/.append style={column name={B2}},
1237 columns/bsl3/.append style={column name={B3}},
1238 columns/date/.append style={
1239 date type={\day.\month.\year}}
1240 }
1241 {201502.dat}
1242 \end{lstlisting}
1243 % \iffalse
1244 %</example>
1245 % \fi
1246 %
1247 % \diadiatab[tabstyle=advanced,tabcolor=gray!30]
1248 % {
1249 % font=\small,
1250 % columns={date,bsl1,bsl2,bsl3},
1251 % columns/bsl1/.append style={column name={B1}},
1252 % columns/bsl2/.append style={column name={B2}},
1253 % columns/bsl3/.append style={column name={B3}},
1254 % columns/date/.append style={
1255 % date type={\day.\month.\year}}
1256 % }
1257 % {201502.dat}
1258 %
1259 % \bigskip
1260 % Note, that the data file was never changed!
1261 %
1262 % Unfortunately, the \package{pgfplotstable} package does not offer a simple method to limit the output
1263 % of the table to certain dates, as the \package{pgfplots} package offers with the \texttt{xmin} and \texttt{xmax} keys.
1264 % Thus, you have to prepare piecewise data files for monthly reports or so. See section \ref{sec:diadialua} on page
1265 % \pageref{sec:diadialua} for a simple solution!
1266 %
1267 % Furthermore, \package{diadia} does not support page breaks for tables. The documentation of the \package{pgfplotstable}\cite[p. 21]{bib:pgfplotstable}
1268 % package describes a way out by using a \package{longtable}\cite{bib:longtable} if you need to typeset long tables!
1269 %
1270 % \subsection{Plots}
1271 % The \env{diadiaplot}\margcs{\cmd\begin\{diadiaplot\}\oarg{options}\\\marg{pgfplots options}\\...\\\cmd\end\{diadiaplot\}}
1272 % environment provides a typical plot structure, where you can add elements like plots, annotations or a legend.
1273 % It will typeset the basic frame of the data plot.
1274 %
1275 % \begin{samepage}
1276 % Possible options:
1277 %
1278 % \begin{optionlist}
1279 % \optitemii{plotstyle}{\underline{none}, bloodsugar, bloodpressure, insulin, weight, cu, pulse, hbaonec}
1280 % \optitem{plotclosedcycle}{\underline{false}, true}{}
1281 % \end{optionlist}
1282 % \end{samepage}
1283 %
1284 % The \cmd\diadiaaddplot\margcs{\cmd\diadiaaddplot\marg{addplot options}\\\marg{key mappings}\marg{file}} command adds a data plot to the basic frame.
1285 % The keys specified in \marg{addplot options} are added to the predefined plot options.
1286 % By contrast, with the starred version \cmd\diadiaaddplot*\margcs{\cmd\diadiaaddplot*\marg{addplot options}\\\marg{key mappings}\marg{file}},
1287 % the keys specified in \marg{addplot options} will completely replace the predefined plot options.
1288 %
1289 % The \cmd\legend\margcs{\cmd\legend\marg{label list}} command will typeset a legend under the plot.
1290 %
1291 % \iffalse
1292 %<*example>
1293 % \fi
1294 \begin{lstlisting}
1295 \begin{diadiaplot}[plotstyle=bloodsugar]
1296 {
1297 xlabel=2015,
1298 tick label style={font=\footnotesize},
1299 xmin=2015-02-18,
1300 xmax=2015-02-28
1301 }
1302 \diadiaaddplot{}{x=date,y=bsl1}{diadia.dat}
1303 \diadiaaddplot{}{x=date,y=bsl2}{diadia.dat}
1304 \diadiaaddplot{}{x=date,y=bsl3}{diadia.dat}
1305 \legend{morning,noon,evening}
1306 \end{diadiaplot}
1307 \end{lstlisting}
1308 % \iffalse
1309 %</example>
1310 % \fi
1311 %
1312 % \begin{diadiaplot}[plotstyle=bloodsugar]
1313 % {
1314 % xlabel=2015,
1315 % tick label style={font=\footnotesize},
1316 % xmin=2015-02-18,
1317 % xmax=2015-02-28
1318 % }
1319 % \diadiaaddplot{}{x=date,y=bsl1}{diadia.dat}
1320 % \diadiaaddplot{}{x=date,y=bsl2}{diadia.dat}
1321 % \diadiaaddplot{}{x=date,y=bsl3}{diadia.dat}
1322 % \legend{morning,noon,evening}
1323 % \end{diadiaplot}
1324 %
1325 % \bigskip
1326 % The \cmd\annotation\margcs{\cmd\annotation\oarg{Ti\textit{k}z options}\\\marg{x}\marg{y}\marg{annotation}} command allows you to annotate
1327 % your plot values. The x and y coordinates must be declared in the context of the plot. That is usually a date and a plot value.
1328 %
1329 % With the \cmd\setlimit\margcs{\cmd\setlimit\oarg{Ti\textit{k}z options}\\\marg{limit list}} command, you can set general and/or individual
1330 % limits agreed with your doctor.
1331 %
1332 % \iffalse
1333 %<*example>
1334 % \fi
1335 \begin{lstlisting}
1336 \begin{diadiaplot}[plotstyle=bloodsugar]
1337 {
1338 xlabel=2015,
1339 tick label style={font=\footnotesize},
1340 xmin=2015-02-18,
1341 xmax=2015-02-28
1342 }
1343 \diadiaaddplot{}{x=date,y=bsl1}{diadia.dat}
1344 \diadiaaddplot{}{x=date,y=bsl2}{diadia.dat}
1345 \diadiaaddplot{}{x=date,y=bsl3}{diadia.dat}
1346 \annotation[text width=0.9cm]{2015-02-22}{215}
1347 {My first annoation}
1348 \setlimit[very thick]{140,180}
1349 \legend{morning,noon,evening}
1350 \end{diadiaplot}
1351 \end{lstlisting}
1352 % \iffalse
1353 %</example>
1354 % \fi
1355 %
1356 % \begin{diadiaplot}[plotstyle=bloodsugar]
1357 % {
1358 % xlabel=2015,
1359 % tick label style={font=\footnotesize},
1360 % legend style={at={(0.5,-0.18)},
1361 % font=\footnotesize,anchor=north,
1362 % legend columns=-1},
1363 % xmin=2015-02-18,
1364 % xmax=2015-02-28
1365 % }
1366 % \diadiaaddplot{}{x=date,y=bsl1}{diadia.dat}
1367 % \diadiaaddplot{}{x=date,y=bsl2}{diadia.dat}
1368 % \diadiaaddplot{}{x=date,y=bsl3}{diadia.dat}
1369 % \annotation[text width=0.9cm]{2015-02-22}{215}{My first annoation}
1370 % \setlimit[very thick]{140,180}
1371 % \legend{morning,noon,evening}
1372 % \end{diadiaplot}
1373 %
1374 % \bigskip
1375 % If you have calculated average values with the \texttt{diadia.lua} script, you can also plot them like this:
1376 %
1377 % \iffalse
1378 %<*example>
1379 % \fi
1380 \begin{lstlisting}
1381 \begin{diadiaplot}[plotstyle=bloodsugar]
1382 {
1383 width=\textwidth,
1384 xlabel=2015,
1385 tick label style={font=\footnotesize},
1386 legend style={at={(0.5,-0.15)},
1387 font=\footnotesize,anchor=north,
1388 legend columns=-1},
1389 xmin=2015-02-18,
1390 xmax=2015-04-30
1391 }
1392 \diadiaaddplot{plot4,nomarks}{x=date,y=avg90}{ddbsl1avg.dat}
1393 \diadiaaddplot{plot3,nomarks}{x=date,y=avg30}{ddbsl1avg.dat}
1394 \diadiaaddplot{plot2,nomarks}{x=date,y=avg07}{ddbsl1avg.dat}
1395 \diadiaaddplot{plot1}{x=date,y=value}{ddbsl1avg.dat}
1396 \legend{$\varnothing_{90}$,$\varnothing_{30}$,$\varnothing_{7}$,
1397 morning}
1398 \end{diadiaplot}
1399 \end{lstlisting}
1400 % \iffalse
1401 %</example>
1402 % \fi
1403 %
1404 % \begin{diadiaplot}[plotstyle=bloodsugar]
1405 % {
1406 % width=\textwidth,
1407 % xlabel=2015,
1408 % tick label style={font=\footnotesize},
1409 % legend style={at={(0.5,-0.15)},
1410 % font=\footnotesize,anchor=north,
1411 % legend columns=-1},
1412 % xmin=2015-02-18,
1413 % xmax=2015-04-30
1414 % }
1415 % \diadiaaddplot{plot4,nomarks}{x=date,y=avg90}{ddbsl1avg.dat}
1416 % \diadiaaddplot{plot3,nomarks}{x=date,y=avg30}{ddbsl1avg.dat}
1417 % \diadiaaddplot{plot2,nomarks}{x=date,y=avg07}{ddbsl1avg.dat}
1418 % \diadiaaddplot{plot1}{x=date,y=value}{ddbsl1avg.dat}
1419 % \legend{$\varnothing_{90}$,$\varnothing_{30}$,$\varnothing_{7}$,morning}
1420 % \end{diadiaplot}
1421 %
1422 % \bigskip
1423 % Here's a list of interesting keys for \marg{pgfplots options}, but there are of course
1424 % much more in the \package{pgfplots}\cite{bib:pgfplots} package documentation!
1425 %
1426 % \begin{optionlist}
1427 % \optitempgf{width}{sets the width of the data plot. Furthermore, there are the special \texttt{normalsize}, \texttt{small}, \texttt{footnotesize} and \texttt{tiny} keys}
1428 % \optitempgf{height}{usually, a 1:1 aspect ratio is used}
1429 % \optitempgf{xlabel}{sets a label under the plot, usually the year}
1430 % \optitempgf{ylabel}{sets a label left to the plot, usually controlled by \texttt{plotstyle}}
1431 % \optitempgf{xmin}{sets the start date of the plot}
1432 % \optitempgf{xmax}{sets the end date of the plot}
1433 % \optitempgf{tick label style}{sets the style of tick labels, usually the font size (see examples)}
1434 % \optitempgf{ytick}{takes a list of values for y ticks, if you are not happy with the standard choice}
1435 % \end{optionlist}
1436 %
1437 % \subsection{Medication charts}
1438 %
1439 % The \env{medicationchart}\margcs{\cmd\begin\{medicationchart\}\oarg{options}\\\marg{tcolorbox options}\marg{date}\\...\\\cmd\end\{medicationchart\}}
1440 % environment allows you to typeset a medication chart. That is, a list of your pharmaceuticals and how to take them. Internally, you must use
1441 % the standard systax of a 6 column tabular. Or you simply use the \cmd\mcentry\margcs{\cmd\mcentry\marg{pharmaceutical}\marg{morning}\\\marg{noon}\marg{evening}\marg{night}\marg{note}} command.
1442 %
1443 % \begin{samepage}
1444 % Possible options:
1445 %
1446 % \begin{optionlist}
1447 % \optitem{mcnotewidth}{\underline{3cm}}{}
1448 % \end{optionlist}
1449 % \end{samepage}
1450 %
1451 % \iffalse
1452 %<*example>
1453 % \fi
1454 \begin{lstlisting}
1455 \begin{medicationchart}{}{07.04.2015}
1456 \mcentry{Oxycodon-HCI STADA 10mg Retardtabletten}{0}{0}{1}{0}{}
1457 \mcentry{Novaminsulfon Lichtenstein 500 mg}{1}{1}{1}{1}{}
1458 \mcentry{Mono-Embolex 3000 I.E. Prophylaxe Novartis}{0}{0}{1}{0}{}
1459 \mcentry{Sultamicillin-ratiopharm 375mg}{1}{0}{1}{0}{}
1460 \end{medicationchart}
1461 \end{lstlisting}
1462 % \iffalse
1463 %</example>
1464 % \fi
1465 %
1466 % \begin{medicationchart}{}{07.04.2015}
1467 % \mcentry{Oxycodon-HCI STADA 10mg Retardtabletten}{0}{0}{1}{0}{}
1468 % \mcentry{Novaminsulfon Lichtenstein 500 mg}{1}{1}{1}{1}{}
1469 % \mcentry{Mono-Embolex 3000 I.E. Prophylaxe Novartis}{0}{0}{1}{0}{}
1470 % \mcentry{Sultamicillin-ratiopharm 375mg}{1}{0}{1}{0}{}
1471 % \end{medicationchart}
1472 %
1473 % \subsection{Info boxes}
1474 %
1475 % The \cmd\infobox\margcs{\cmd\infobox\marg{tcolorbox options}\\\marg{date}\marg{information}}
1476 % environment allows you to typeset info boxes.
1477 % \iffalse
1478 %<*example>
1479 % \fi
1480 \begin{lstlisting}
1481 \infobox{width=8cm}{22.04.2015}{%
1482 Podiatrist appointment:
1483
1484 \bigskip
1485 22.04.2015 11:30
1486
1487 \medskip
1488 \Telefon\ 089/65831933
1489 }%
1490 \end{lstlisting}
1491 % \iffalse
1492 %</example>
1493 % \fi
1494 %
1495 % \infobox{width=8cm}{22.04.2015}{%
1496 % Podiatrist appointment:
1497 %
1498 % \bigskip
1499 % 22.04.2015 11:30
1500 %
1501 % \medskip
1502 % \Telefon\ 089/65831933
1503 % }%
1504 %
1505 % \subsection{Misc.}
1506 %
1507 % The \env{diadiasidebyside}\margcs{\cmd\begin\{diadiasidebyside\}\oarg{options}\\...\\\cmd\end\{diadiasidebyside\}}
1508 % environment is a wrappper for the \env{multicol}\cite{bib:multicol} environment with a two column layout and offers the following options:
1509 %
1510 % \begin{optionlist}
1511 % \optitem{columnsep}{\underline{18pt}}{}
1512 % \optitem{columnseprule}{\underline{0pt}}{}
1513 % \optitem{columnseprulecolor}{\underline{\cmd\normalcolor}}{}
1514 % \end{optionlist}
1515 %
1516 % For plots it sets the width to \cmd\columnwidth, so there's no need to adjust the width!
1517 %
1518 % \iffalse
1519 %<*example>
1520 % \fi
1521 \begin{lstlisting}
1522 \begin{diadiasidebyside}
1523 \pgfplotsset{xlabel=2015,tick label style={font=\footnotesize}}
1524 \begin{diadiaplot}[plotstyle=bloodpressure]
1525 {
1526 xmin=2015-02-18,
1527 xmax=2015-02-27
1528 }
1529 \diadiaaddplot{}{x=date,y=bps}{diadia.dat}
1530 \diadiaaddplot{}{x=date,y=bpd}{diadia.dat}
1531 \legend{systolic,diastolic}
1532 \end{diadiaplot}
1533
1534 \begin{diadiaplot}[plotstyle=weight]
1535 {
1536 xmin=2015-02-18,
1537 xmax=2015-02-27
1538 }
1539 \diadiaaddplot{lime,mark options={fill=lime!50!black},
1540 mark=otimes*,draw=lime!75!black}
1541 {x=date,y=weight}{diadia.dat}
1542 \end{diadiaplot}
1543 \end{diadiasidebyside}
1544 \end{lstlisting}
1545 % \iffalse
1546 %</example>
1547 % \fi
1548 % \vspace{1cm}
1549 % \begin{diadiasidebyside}
1550 % \pgfplotsset{xlabel=2015,tick label style={font=\footnotesize}}
1551 % \begin{diadiaplot}[plotstyle=bloodpressure]
1552 % {
1553 % xmin=2015-02-18,
1554 % xmax=2015-02-27
1555 % }
1556 % \diadiaaddplot{}{x=date,y=bps}{diadia.dat}
1557 % \diadiaaddplot{}{x=date,y=bpd}{diadia.dat}
1558 % \legend{systolic,diastolic}
1559 % \end{diadiaplot}
1560 %
1561 % \begin{diadiaplot}[plotstyle=weight]
1562 % {
1563 % xmin=2015-02-18,
1564 % xmax=2015-02-27
1565 % }
1566 % \diadiaaddplot{lime,mark options={fill=lime!50!black},
1567 % mark=otimes*,draw=lime!75!black}
1568 % {x=date,y=weight}{diadia.dat}
1569 % \end{diadiaplot}
1570 % \end{diadiasidebyside}
1571 %
1572 % \clearpage
1573 % \section{Implementation}
1574 % \subsection{diadia.sty}
1575 % \changes{v1.0}{2015/05/11}{CTAN upload}
1576 % \begin{macrocode}
1577 %<*package>
1578 % \end{macrocode}
1579 % First, we provide the \LaTeX\ package \package{diadia}.
1580 % \begin{macrocode}
1581 \NeedsTeXFormat{LaTeX2e}%
1582 \ProvidesPackage{diadia}[2015/05/20 v1.1 diadia.sty - Josef Kleber (C) 2015]%
1583 % \end{macrocode}
1584 % We load the \texttt{xkeyval} package and define a helper macro to define the (global) options.
1585 % \begin{macrocode}
1586 \RequirePackage{xkeyval}%
1587 %
1588 \newcommand*\DD@JK@define@key[4]%
1589 {%
1590 \expandafter\gdef\csname#1@#3\endcsname{#4}%
1591 \define@key{#2.sty}{#3}[#4]%
1592 {%
1593 \expandafter\gdef\csname#1@#3\endcsname{##1}%
1594 }%
1595 \define@key{#2}{#3}%
1596 {%
1597 \expandafter\def\csname#1@#3\endcsname{##1}%
1598 }%
1599 }%
1600 % \end{macrocode}
1601 % Now, we can define the options and execute them with defaults.
1602 % \begin{macrocode}
1603 \DD@JK@define@key{DD@JK}{diadia}{tabstyle}{simple}%
1604 \DD@JK@define@key{DD@JK}{diadia}{tabcolor}{none}%
1605 \DD@JK@define@key{DD@JK}{diadia}{plotstyle}{none}%
1606 \DD@JK@define@key{DD@JK}{diadia}{plotclosedcycle}{false}%
1607 \DD@JK@define@key{DD@JK}{diadia}{mcnotewidth}{3cm}%
1608 \DD@JK@define@key{DD@JK}{diadia}{columnsep}{18pt}%
1609 \DD@JK@define@key{DD@JK}{diadia}{columnseprule}{0pt}%
1610 \DD@JK@define@key{DD@JK}{diadia}{columnseprulecolor}{\normalcolor}%
1611 %
1612 \ExecuteOptionsX{tabstyle,tabcolor,plotstyle,plotclosedcycle,mcnotewidth,%
1613 columnsep,columnseprule,columnseprulecolor}%
1614 \ProcessOptionsX*\relax%
1615 % \end{macrocode}
1616 % We load the needed packages and libraries!
1617 % \begin{macrocode}
1618 \RequirePackage{pgfplots}%
1619 \RequirePackage{pgfplotstable}%
1620 \RequirePackage{pgfcalendar}%
1621 \RequirePackage{tabularx}%
1622 \RequirePackage{booktabs}%
1623 \RequirePackage{colortbl}%
1624 \RequirePackage{ifthen}%
1625 \RequirePackage{calc}%
1626 \RequirePackage{translations}%
1627 \RequirePackage{amsmath}%
1628 \RequirePackage[many]{tcolorbox}%
1629 \RequirePackage{environ}%
1630 \RequirePackage{multicol}%
1631 \RequirePackage{amssymb}%
1632 %
1633 \usepgfplotslibrary{dateplot}%
1634 %
1635 \def\DD@JK@closedcycle{}%
1636 \def\DD@JK@addplotdefault{}%
1637 % \end{macrocode}
1638 % We load the translation files for supported languages and map the translations of the active language to macros!
1639 % \begin{macrocode}
1640 \input{diadia-fallback.trsl}%
1641 \input{diadia-english.trsl}%
1642 \input{diadia-german.trsl}%
1643 %
1644 \def\DD@JK@trans@BloodSugar{\GetTranslation{dd-BloodSugar}}%
1645 \def\DD@JK@trans@Insulin{\GetTranslation{dd-Insulin}}%
1646 \def\DD@JK@trans@BloodPressure{\GetTranslation{dd-BloodPressure}}%
1647 \def\DD@JK@trans@Weight{\GetTranslation{dd-Weight}}%
1648 \def\DD@JK@trans@MedicationChart{\GetTranslation{dd-MedicationChart}}%
1649 \def\DD@JK@trans@issued{\GetTranslation{dd-issued}}%
1650 \def\DD@JK@trans@Pharmaceutical{\GetTranslation{dd-Pharmaceutical}}%
1651 \def\DD@JK@trans@Morning{\GetTranslation{dd-Morning}}%
1652 \def\DD@JK@trans@Noon{\GetTranslation{dd-Noon}}%
1653 \def\DD@JK@trans@Evening{\GetTranslation{dd-Evening}}%
1654 \def\DD@JK@trans@Night{\GetTranslation{dd-Night}}%
1655 \def\DD@JK@trans@Note{\GetTranslation{dd-Note}}%
1656 \def\DD@JK@trans@Info{\GetTranslation{dd-Info}}%
1657 \def\DD@JK@trans@Date{\GetTranslation{dd-Date}}%
1658 \def\DD@JK@trans@BSi{\GetTranslation{dd-BSi}}%
1659 \def\DD@JK@trans@BSii{\GetTranslation{dd-BSii}}%
1660 \def\DD@JK@trans@BSiii{\GetTranslation{dd-BSiii}}%
1661 \def\DD@JK@trans@IDi{\GetTranslation{dd-IDi}}%
1662 \def\DD@JK@trans@IDii{\GetTranslation{dd-IDii}}%
1663 \def\DD@JK@trans@IDiii{\GetTranslation{dd-IDiii}}%
1664 \def\DD@JK@trans@BPs{\GetTranslation{dd-BPs}}%
1665 \def\DD@JK@trans@BPd{\GetTranslation{dd-BPd}}%
1666 \def\DD@JK@trans@Weight{\GetTranslation{dd-Weight}}%
1667 \def\DD@JK@trans@CU{\GetTranslation{dd-CU}}%
1668 \def\DD@JK@trans@Pulse{\GetTranslation{dd-Pulse}}%
1669 \def\DD@JK@trans@Hbaonec{\GetTranslation{dd-Hbaonec}}%
1670 \def\DD@JK@trans@Value{\GetTranslation{dd-Value}}%
1671 % \end{macrocode}
1672 % We define two new tabular types Z (ragged right X type) and Y (ragged right p with \texttt{mcnotewidth} width).
1673 % \begin{macrocode}
1674 \newcolumntype{Z}{>{\raggedright\let\newline\\\arraybackslash}X}%
1675 \newcolumntype{Y}{>{\raggedright\let\newline\\\arraybackslash}p{\DD@JK@mcnotewidth}}%
1676 % \end{macrocode}
1677 % We load the \texttt{diadia.cfg} config file. It holds all kind of style definitions. You can copy this
1678 % file to your local \TeX\ tree and alter the definitions or add new ones!
1679 % \begin{macrocode}
1680 \IfFileExists{diadia.cfg}%
1681 {%
1682 \input{diadia.cfg}%
1683 }%
1684 {%
1685 \PackageError{diadia}{diadia.cfg not found}%
1686 {Please install diadia.cfg! The style definitions are missing!}%
1687 }%
1688 % \end{macrocode}
1689 % \begin{macro}{\annotation}
1690 % With this command you can annotate your plots. You must use x/y coordinates in the context of your plot. Thus the x coordinate is usually a date.
1691 %
1692 % \cs{annotation}\oarg{Ti\textit{k}z options}\marg{x}\marg{y}\marg{annotation}
1693 % \begin{macrocode}
1694 \newcommand*{\annotation}[4][]%
1695 {%
1696 \node[ddpannotation,#1] at (#2,#3) {#4};%
1697 }%
1698 % \end{macrocode}
1699 % \end{macro}
1700 % \begin{macro}{\diadiatab}
1701 % The \cmd\diadiatab\ command allows you to typeset your data in a formatted table.
1702 %
1703 % \cs{diadiatab}\oarg{options}\marg{pgfplotstable options}\marg{file}
1704 % \begin{macrocode}
1705 \newcommand*{\diadiatab}[3][]%
1706 {%
1707 \begingroup%
1708 % \end{macrocode}
1709 % Initially, we evaluate the options and set \texttt{pgfplotstable} options accordingly.
1710 % \begin{macrocode}
1711 \setkeys{diadia}{#1}%
1712 \ifthenelse{\equal{\DD@JK@tabstyle}{simple}}%
1713 {}%
1714 {%
1715 \ifthenelse{\equal{\DD@JK@tabstyle}{advanced}}%
1716 {%
1717 \pgfplotstableset%
1718 {%
1719 every head row/.style={before row=\toprule,after row=\midrule},%
1720 every last row/.style={after row=\bottomrule}%
1721 }%
1722 }%
1723 {}%
1724 }%
1725 \ifthenelse{\equal{\DD@JK@tabcolor}{none}}%
1726 {}%
1727 {%
1728 \pgfplotstableset%
1729 {%
1730 every even row/.style={before row={\rowcolor{\DD@JK@tabcolor}}}%
1731 }%
1732 }%
1733 % \end{macrocode}
1734 % Finally, we typeset the table.
1735 % \begin{macrocode}
1736 \pgfplotstabletypeset[#2]{#3}%
1737 \endgroup%
1738 }%
1739 % \end{macrocode}
1740 % \end{macro}
1741 % \begin{macro}{\diadiaaddplot}
1742 % The \cmd\diadiaddplot\ command adds a data plot. First of all, it checks for a * and calls
1743 % \cmd\@@diadiaaddplot or \cmd\@@diadiaaddplot!
1744 %
1745 % \cs{diadiaaddplot}\marg{pgfplots options}\marg{key mapping}\marg{file}
1746 % \begin{macrocode}
1747 \newcommand*\diadiaaddplot{\@ifstar\@@diadiaaddplot\@diadiaaddplot}%
1748 % \end{macrocode}
1749 % \end{macro}
1750 % \begin{macrocode}
1751 \newcommand*\@diadiaaddplot[4][]%
1752 {%
1753 \addplot+[\DD@JK@addplotdefault,#2] table[#3] {#4}\DD@JK@closedcycle;%
1754 }%
1755 %
1756 \newcommand*\@@diadiaaddplot[4][]%
1757 {%
1758 \addplot[#2] table[#3] {#4}\DD@JK@closedcycle;%
1759 }%
1760 % \end{macrocode}
1761 % \begin{environment}{diadiaplot}
1762 % The \env{diadiaplot} environment is a wrapper for the \env{tikzpicture} and \env{axis} environments!
1763 %
1764 % \begin{macrocode}
1765 \newenvironment{diadiaplot}[2][]%
1766 {%
1767 % \end{macrocode}
1768 % We use the \texttt{baseline} option to have all plots on the same baseline. Important for sidebyside
1769 % plots with different legends!
1770 % \begin{macrocode}
1771 \begin{tikzpicture}[baseline]%
1772 % \end{macrocode}
1773 % We evalute the options and set the \cmd\DD@JK@closedcycle\ and \cmd\DD@JK@ddpmode\ macros accordingly.
1774 % \begin{macrocode}
1775 \setkeys{diadia}{#1}%
1776 \ifthenelse{\equal{\DD@JK@plotclosedcycle}{true}}%
1777 {\def\DD@JK@closedcycle{\closedcycle}}%
1778 {\def\DD@JK@closedcycle{}}%
1779 \def\DD@JK@ddpmode{}%
1780 \ifthenelse{\equal{\DD@JK@plotstyle}{none}}%
1781 {%
1782 \def\DD@JK@ddpmode{}%
1783 }%
1784 {%
1785 \ifthenelse{\equal{\DD@JK@plotstyle}{weight}}%
1786 {%
1787 \def\DD@JK@ddpmode{ddpweight}%
1788 \def\DD@JK@closedcycle{\closedcycle}%
1789 }%
1790 {%
1791 \ifthenelse{\equal{\DD@JK@plotstyle}{bloodpressure}}%
1792 {%
1793 \def\DD@JK@ddpmode{ddpbloodpressure}%
1794 }%
1795 {%
1796 \ifthenelse{\equal{\DD@JK@plotstyle}{insulin}}%
1797 {%
1798 \def\DD@JK@ddpmode{ddpinsulin}%
1799 }%
1800 {%
1801 \ifthenelse{\equal{\DD@JK@plotstyle}{bloodsugar}}%
1802 {%
1803 \def\DD@JK@ddpmode{ddpbloodsugar}%
1804 }%
1805 {%
1806 \ifthenelse{\equal{\DD@JK@plotstyle}{pulse}}%
1807 {%
1808 \def\DD@JK@ddpmode{ddppulse}%
1809 }%
1810 {%
1811 \ifthenelse{\equal{\DD@JK@plotstyle}{cu}}%
1812 {%
1813 \def\DD@JK@ddpmode{ddpcu}%
1814 \def\DD@JK@addplotdefault{ddaddplotfill}%
1815 }%
1816 {%
1817 \ifthenelse{\equal{\DD@JK@plotstyle}{hbaonec}}%
1818 {%
1819 \def\DD@JK@ddpmode{ddphbaonec}%
1820 \def\DD@JK@addplotdefault{ddaddplotfill}%
1821 }%
1822 {}%
1823 }%
1824 }%
1825 }%
1826 }%
1827 }%
1828 }%
1829 }%
1830 % \end{macrocode}
1831 % We start the \texttt{axis} environment with the right plot style.
1832 % \begin{macrocode}
1833 \begin{axis}[ddpdefault,%
1834 \DD@JK@ddpmode,%
1835 #2%
1836 ]%
1837 }%
1838 {%
1839 \end{axis}%
1840 \end{tikzpicture}%
1841 }%
1842 % \end{macrocode}
1843 % \end{environment}
1844 % \begin{macro}{\mcentry}
1845 % The \cmd\mcentry\ command provides a simple interface for a six column tabular entry needed inside a \env{medicationchart} environment.
1846 %
1847 % \cs{mcentry}\marg{pharmaceutical}\marg{morning}\marg{noon}\marg{evening}\marg{night}\marg{note}
1848 % \begin{macrocode}
1849 \newcommand*{\mcentry}[6]%
1850 {%
1851 #1 & #2 & #3 & #4 & #5 & #6 \\%
1852 }%
1853 % \end{macrocode}
1854 % \end{macro}
1855 % \begin{environment}{medicationchart}
1856 % The \env{medicationchart} environment allows you to typeset a medication chart. It uses the \package{environ} package to collect
1857 % the environment body in the \cmd\Body\ macro. It is later used in a \texttt{medicationchart} style \texttt{tcolorbox} box.
1858 %
1859 % \begin{macrocode}
1860 \NewEnviron{medicationchart}[3][]%
1861 {%
1862 \begingroup%
1863 \setkeys{diadia}{#1}%
1864 \tcbox[medicationchart,%
1865 title={\DD@JK@trans@MedicationChart\space (\DD@JK@trans@issued: #3)},#2]%
1866 {%
1867 \renewcommand{\arraystretch}{1.2}%
1868 \begin{tabularx}{\textwidth-13.64pt}{Z||r|r|r|r||Y}%
1869 \DD@JK@trans@Pharmaceutical & \DD@JK@trans@Morning & \DD@JK@trans@Noon &%
1870 \DD@JK@trans@Evening & \DD@JK@trans@Night & \DD@JK@trans@Note\\\hline\hline%
1871 \BODY%
1872 \end{tabularx}%
1873 }%
1874 \endgroup%
1875 }%
1876 % \end{macrocode}
1877 % \end{environment}
1878 % \begin{macro}{\infobox}
1879 % The \cmd\infobox\ allows you to typeset arbitrary material into a \texttt{infobox} style \texttt{tcolorbox} box.
1880 %
1881 % \cs{infobox}\marg{tcolorbox options}\marg{date}\marg{info}
1882 % \begin{macrocode}
1883 \newcommand{\infobox}[3]%
1884 {%
1885 \begin{tcolorbox}[infobox,title={\DD@JK@trans@Info\space (#2)},#1]%
1886 #3%
1887 \end{tcolorbox}%
1888 }%
1889 % \end{macrocode}
1890 % \end{macro}
1891 % \begin{environment}{diadiasidebyside}
1892 % The \env{diadiasidebyside} environment allows you to typeset (narrow) tables and plots sidebyside.
1893 % It supports the \texttt{columnsep}, \texttt{columnseprule} and \texttt{columnseprulecolor} options of the \package{multicol} package.
1894 %
1895 % \begin{macrocode}
1896 \newenvironment{diadiasidebyside}[1][]%
1897 {%
1898 \setkeys{diadia}{#1}%
1899 \setlength{\columnsep}{\DD@JK@columnsep}%
1900 \setlength{\columnseprule}{\DD@JK@columnseprule}%
1901 \def\columnseprulecolor{\DD@JK@columnseprulecolor}%
1902 \pgfplotsset{width=\columnwidth}%
1903 \begin{multicols}{2}%
1904 }%
1905 {%
1906 \end{multicols}%
1907 }%
1908 % \end{macrocode}
1909 % \end{environment}
1910 % \begin{macro}{\setlimit}
1911 % The \cmd\setlimit\ command allows you to add limits to your plot!
1912 %
1913 % \cs{setlimit}\oarg{Tikz options}\marg{limit list}
1914 % \begin{macrocode}
1915 \newcommand*{\setlimit}[2][]%
1916 {%
1917 \pgfplotsset{%
1918 extra y ticks={#2},%
1919 extra tick style={grid=major, major grid style={setlimit, #1}}%
1920 }%
1921 }%
1922 % \end{macrocode}
1923 % \end{macro}
1924 % \begin{macrocode}
1925 %</package>
1926 % \end{macrocode}
1927 % \subsection{diadia.cfg}
1928 % \label{sec:config}
1929 % \changes{v1.1}{2015/05/17}{added diadia.cfg}
1930 % \begin{macrocode}
1931 %<*cfg>
1932 % \end{macrocode}
1933 % We set \texttt{pgfplot} compat mode to 1.12 and the \texttt{date ZERO} key to \texttt{2015-01-01}.
1934 % Sometimes, values are plotted at the wrong date. Then you should adjust the \texttt{date ZERO} key
1935 % to the start date of your data to avoid rounding errors in date calculation.
1936 % \begin{macrocode}
1937 \pgfplotsset{%
1938 compat=1.12,%
1939 date ZERO=2015-01-01%
1940 }%
1941 % \end{macrocode}
1942 % We define some \texttt{pgfplots} styles with priority order: \texttt{ddpdefault} $\rightarrow$ \texttt{ddpuser} $\rightarrow$
1943 % \{\texttt{ddpbloodsugar}\textbar\texttt{ddpinsulin}\textbar\texttt{ddpbloodpressure}\textbar\texttt{ddpweight}\textbar\texttt{ddpcu}\textbar\texttt{ddppulse}\textbar\newline\texttt{ddphbaonec}\}
1944 %
1945 % Thus, you can redefine \texttt{ddpuser} to adjust the general design set by \texttt{ddpdefault}. Furthermore, we define
1946 % a \texttt{ddpweightplot} to use our standard design also in weight plots, as area style plots use their own color cycle list.
1947 % \begin{macrocode}
1948 \pgfplotsset{%
1949 ddpuser/.style=%
1950 {},%
1951 ddpdefault/.style=%
1952 {%
1953 thick,%
1954 date coordinates in=x,%
1955 cycle list name=diadiacyclelist,%
1956 tick align=inside,%
1957 unbounded coords=jump,%
1958 xticklabel={\day.\month.},%
1959 legend style={at={(0.5,-0.25)},%
1960 font=\footnotesize,%
1961 anchor=north,%
1962 legend columns=-1},%
1963 ddpuser%
1964 },%
1965 ddpweight/.style=%
1966 {%
1967 smooth,%
1968 area style,%
1969 ylabel=\DD@JK@trans@Weight%
1970 },%
1971 ddpweightplot/.style=%
1972 {%
1973 teal,%
1974 fill=teal!50,%
1975 mark=halfcircle*,%
1976 every mark/.append style={solid,fill=.!80!black}%
1977 },%
1978 ddpbloodpressure/.style=%
1979 {%
1980 ylabel=\DD@JK@trans@BloodPressure%
1981 },%
1982 ddpinsulin/.style=%
1983 {%
1984 ylabel=\DD@JK@trans@Insulin%
1985 },%
1986 ddpbloodsugar/.style=%
1987 {%
1988 smooth,%
1989 ylabel=\DD@JK@trans@BloodSugar%
1990 },%
1991 ddppulse/.style=%
1992 {%
1993 smooth,%
1994 ylabel=\DD@JK@trans@Pulse%
1995 },%
1996 ddpcu/.style=%
1997 {%
1998 ybar,%
1999 ylabel=\DD@JK@trans@CU%
2000 },%
2001 ddphbaonec/.style=%
2002 {%
2003 ybar,%
2004 ylabel=\DD@JK@trans@Hbaonec%
2005 },
2006 nomarks/.style=%
2007 {%
2008 mark={},
2009 every mark/.style={}%
2010 }%
2011 }%
2012 % \end{macrocode}
2013 % We set some sensible defaults for \cmd\diadiatab
2014 %
2015 % \begin{itemize}
2016 % \item replace \texttt{nan} with empty string
2017 % \item replace empty cells with --
2018 % \item define \texttt{date} column as \texttt{date type}
2019 % \item define \texttt{weight} and \texttt{hba1c} columns as \texttt{fixed,fixed zerofill,precision=1}
2020 % \end{itemize}
2021 %
2022 % \begin{macrocode}
2023 \pgfplotstableset%
2024 {%
2025 empty cells with={--},%
2026 columns/date/.style={date type},%
2027 columns/bsl1/.style={string replace={nan}{}},%
2028 columns/bsl2/.style={string replace={nan}{}},%
2029 columns/bsl3/.style={string replace={nan}{}},%
2030 columns/id1/.style={string replace={nan}{}},%
2031 columns/id2/.style={string replace={nan}{}},%
2032 columns/id3/.style={string replace={nan}{}},%
2033 columns/bps/.style={string replace={nan}{}},%
2034 columns/bpd/.style={string replace={nan}{}},%
2035 columns/weight/.style={fixed,fixed zerofill,precision=1,string replace={nan}{}},%
2036 columns/cu/.style={string replace={nan}{}},%
2037 columns/pul/.style={string replace={nan}{}},%
2038 columns/hba1c/.style={fixed,fixed zerofill,precision=1,string replace={nan}{}},%
2039 columns/value/.style={string replace={nan}{}},%
2040 columns/avg07/.style={string replace={nan}{}},%
2041 columns/avg14/.style={string replace={nan}{}},%
2042 columns/avg30/.style={string replace={nan}{}},%
2043 columns/avg60/.style={string replace={nan}{}},%
2044 columns/avg90/.style={string replace={nan}{}}%
2045 }%
2046 % \end{macrocode}
2047 % Now, we append the language dependent column headers to the column style!
2048 % \begin{macrocode}
2049 \pgfplotstableset%
2050 {%
2051 columns/date/.append style={column name={\DD@JK@trans@Date}},%
2052 columns/bsl1/.append style={column name={\DD@JK@trans@BSi}},%
2053 columns/bsl2/.append style={column name={\DD@JK@trans@BSii}},%
2054 columns/bsl3/.append style={column name={\DD@JK@trans@BSiii}},%
2055 columns/id1/.append style={column name={\DD@JK@trans@IDi}},%
2056 columns/id2/.append style={column name={\DD@JK@trans@IDii}},%
2057 columns/id3/.append style={column name={\DD@JK@trans@IDiii}},%
2058 columns/bps/.append style={column name={\DD@JK@trans@BPs}},%
2059 columns/bpd/.append style={column name={\DD@JK@trans@BPd}},%
2060 columns/weight/.append style={column name={\DD@JK@trans@Weight}},%
2061 columns/cu/.append style={column name={\DD@JK@trans@CU}},%
2062 columns/pul/.append style={column name={\DD@JK@trans@Pulse}},%
2063 columns/hba1c/.append style={column name={\DD@JK@trans@Hbaonec}},%
2064 columns/value/.append style={column name={\DD@JK@trans@Value}},%
2065 columns/avg07/.append style={column name={$\varnothing_{7}$}},%
2066 columns/avg14/.append style={column name={$\varnothing_{14}$}},%
2067 columns/avg30/.append style={column name={$\varnothing_{30}$}},%
2068 columns/avg60/.append style={column name={$\varnothing_{60}$}},%
2069 columns/avg90/.append style={column name={$\varnothing_{90}$}},%
2070 }%
2071 % \end{macrocode}
2072 % We define the \texttt{diadiacyclelist} color cycle list used in plots. You may adjust it to your needs.
2073 % Furthermore, we make these styles available as \texttt{plot1}, ..., \texttt{plot4}.
2074 % \begin{macrocode}
2075 \pgfplotscreateplotcyclelist{diadiacyclelist}%
2076 {%
2077 {teal,mark=halfcircle*,every mark/.append style={solid,fill=.!80!black}},%
2078 {orange,mark=halfcircle*,every mark/.append style={solid,fill=.!80!black,rotate=180}},%
2079 {cyan,mark=o,every mark/.append style={solid,fill=.!80!black}},%
2080 {yellow,mark=star,every mark/.append style={solid,fill=.!80!black}}%
2081 }%
2082 \tikzset%
2083 {%
2084 plot1/.style=%
2085 {%
2086 teal,%
2087 mark=halfcircle*,%
2088 every mark/.append style={solid,fill=.!80!black}%
2089 },%
2090 plot2/.style=%
2091 {%
2092 orange,%
2093 mark=halfcircle*,%
2094 every mark/.append style={solid,fill=.!80!black,rotate=180}%
2095 },%
2096 plot3/.style=%
2097 {%
2098 cyan,%
2099 mark=o,%
2100 every mark/.append style={solid,fill=.!80!black}%
2101 },%
2102 plot4/.style=%
2103 {%
2104 yellow,%
2105 mark=star,%
2106 every mark/.append style={solid,fill=.!80!black}%
2107 }%
2108 }%
2109 % \end{macrocode}
2110 % We define the Ti\textit{k}z styles for annotations and limits.
2111 % \begin{macrocode}
2112 \tikzset%
2113 {%
2114 ddpannotation/.style=%
2115 {%
2116 fill=yellow!50!white,%
2117 rectangle,%
2118 rounded corners=3pt,%
2119 font=\tiny%
2120 },%
2121 setlimit/.style=%
2122 {%
2123 red,%
2124 thick%
2125 },%
2126 ddaddplotfill/.style=%
2127 {%
2128 fill=teal!50,%
2129 },%
2130 }%
2131 % \end{macrocode}
2132 % Finally, we define the \texttt{medicationchart} and \texttt{infobox} \texttt{tcolorbox} styles based on \texttt{ddboxdefault}!
2133 % \begin{macrocode}
2134 \tcbset%
2135 {%
2136 ddboxdefault/.style=%
2137 {%
2138 enhanced,%
2139 fonttitle=\bfseries\large,%
2140 coltitle=black,%
2141 center title,%
2142 titlerule=.75mm,%
2143 toprule=1mm,%
2144 bottomrule=1mm,%
2145 toptitle=2mm,%
2146 bottomtitle=2mm%
2147 },%
2148 medicationchart/.style=%
2149 {%
2150 ddboxdefault,%
2151 fontupper=\footnotesize,%
2152 colback=yellow!10!white,%
2153 colframe=yellow!60!black,%
2154 colbacktitle=yellow!20!white,%
2155 left=0mm,%
2156 right=0mm,%
2157 top=0mm,%
2158 bottom=0mm,%
2159 boxsep=0mm,%
2160 },%
2161 infobox/.style=%
2162 {%
2163 ddboxdefault,%
2164 width=\linewidth-10.888pt,%
2165 colback=orange!10!white,%
2166 colframe=orange!60!black,%
2167 colbacktitle=orange!20!white%
2168 },%
2169 }%
2170 % \end{macrocode}
2171 % \begin{macrocode}
2172 %</cfg>
2173 % \end{macrocode}
2174 % \subsection{diadia.lua}
2175 % \changes{v1.1}{2015/05/15}{added diadia.lua}
2176 % \begin{macrocode}
2177 %<*lua>
2178 % \end{macrocode}
2179 % \begin{macrocode}
2180 #!/usr/bin/env texlua
2181 --
2182 -- diadia [options]
2183 --
2184 -- loads and processes a diadia data file
2185 --
2186 -- License: LPPL
2187 --
2188 % \end{macrocode}
2189 % At first, we define a version variable and variables for the command line options.
2190 % \begin{macrocode}
2191 local version = "v1.0 (2015/05/15)"
2192
2193 local infile = ""
2194 local outfile = ""
2195 local mode = "*"
2196 local startdate = ""
2197 local enddate = ""
2198 local columns = ""
2199 % \end{macrocode}
2200 % Here, we define the central \texttt{data} variable.
2201 % \begin{macrocode}
2202 local data = {}
2203 % \end{macrocode}
2204 % A simple function to output the version information.
2205 % \begin{macrocode}
2206 function pversion()
2207 print("diadia.lua " .. version)
2208 print("(C) Josef Kleber 2015 License: LPPL")
2209 os.exit(0)
2210 end
2211 % \end{macrocode}
2212 % A function to output the help information.
2213 % \begin{macrocode}
2214 function phelp()
2215 print([[
2216 diadia.lua [options]
2217
2218 allows you to
2219
2220 - cut a chunk out of the data file
2221 e.g.: -i in.dat -o out.dat -s YYYY-MM-DD -e YYYY-MM-DD
2222
2223 - compose a new data file based on given columns of an
2224 existing data file
2225 e.g.: -i in.dat -o out.dat -c 1,2
2226
2227 - create a new data file with date and value (1st and
2228 2nd column of existing file) and added value average
2229 columns of the last 7, 14, 30, 60 and 90 days
2230 e.g.: -i in.dat -o out.dat [-s YYYY-MM-DD -e YYYY-MM-DD]
2231
2232 Options:
2233
2234 -m specify the mode (cut|compose|average)
2235
2236 -i specify the input file
2237
2238 -o specify the output file
2239
2240 -c specify the columns for compose mode
2241
2242 -s specify the start date (YYYY-MM-DD) in
2243 cut and average mode
2244
2245 -e specify the end date
2246
2247 -v prints version information
2248
2249 -h prints help information
2250
2251 ]])
2252 pversion()
2253 end
2254 % \end{macrocode}
2255 % This function checks if a given date string matches the YYYY-MM-DD format.
2256 % \begin{macrocode}
2257 function check_date(date)
2258 if string.find(date, "(%d%d%d%d)-(%d%d)-(%d%d)") == nil
2259 then
2260 io.stderr:write ("Error 21: wrong date format (YYYY-MM-DD)\n")
2261 os.exit(11)
2262 end
2263 end
2264 % \end{macrocode}
2265 % This function parses a date string and returns \texttt{year}, \texttt{month} and \texttt{day}.
2266 % \begin{macrocode}
2267 function parse_date(date)
2268 return string.match(date, "(%d%d%d%d)%-(%d%d)%-(%d%d)")
2269 end
2270 % \end{macrocode}
2271 % This function parses a given line (string) and returns a found date.
2272 % \begin{macrocode}
2273 function parse_dateinline(line)
2274 return string.match(line, "(%d%d%d%d%-%d%d%-%d%d)")
2275 end
2276 % \end{macrocode}
2277 % This function takes a Unix time and returns a date string in the YYYY-MM-DD format.
2278 % \begin{macrocode}
2279 function daystring(unixtime)
2280 return os.date("%Y-%m-%d", unixtime)
2281 end
2282 % \end{macrocode}
2283 % This function computes the Unix time of a given date.
2284 % \begin{macrocode}
2285 function unixtime(year,month,day)
2286 return os.time{year=year, month=month, day=day}
2287 end
2288 % \end{macrocode}
2289 % A simple rounding function.
2290 % \begin{macrocode}
2291 function round(number)
2292 return math.floor(number+0.5)
2293 end
2294 % \end{macrocode}
2295 % This function checks the length of a given string and returns a string of length 3.
2296 % \begin{macrocode}
2297 function ptd(value)
2298 local val = tostring(value)
2299 local slen = string.len(val)
2300 if slen == 3
2301 then
2302 return val
2303 else
2304 return val .. " "
2305 end
2306 end
2307 % \end{macrocode}
2308 % This function calculates the average value of a given \texttt{date} in the last \texttt{days} days in a \texttt{data} table.
2309 % \begin{macrocode}
2310 function calc_avg(data,date,days)
2311 local sum = 0
2312 local wdays = 0
2313 local wday
2314 % \end{macrocode}
2315 % We calculate the Unix time of the given day (\texttt{enddate}) and the derived \texttt{startday}.
2316 % \begin{macrocode}
2317 local endday = unixtime(parse_date(date))
2318 local startday = endday - 60*60*24*(days-1)
2319 % \end{macrocode}
2320 % We loop through our \texttt{data} table until we reach \texttt{endday}
2321 % \begin{macrocode}
2322 while startday <= endday
2323 do
2324 % \end{macrocode}
2325 % We create a date string and check if there is a \texttt{data} entry with this key.
2326 % If so, we sum up the value and increase the \texttt{wdays} counter
2327 % \begin{macrocode}
2328 wday = daystring(startday)
2329 if data[wday] ~= nil
2330 then
2331 sum = sum + data[wday]
2332 wdays = wdays + 1
2333 end
2334 startday = startday + 60*60*24
2335 end
2336 % \end{macrocode}
2337 % If entries were found, we return the rounded average value as string.
2338 % \begin{macrocode}
2339 if wdays == 0
2340 then
2341 return "nan"
2342 else
2343 return tostring(round(sum/wdays))
2344 end
2345 end
2346 % \end{macrocode}
2347 % This function reads in the first two columns of a given \texttt{file} into a \texttt{data} table.
2348 % \begin{macrocode}
2349 function read_data(file)
2350 local data = {}
2351 local date
2352 local startdate
2353 local enddate
2354 local dat
2355 local firstline = true
2356 % \end{macrocode}
2357 % We itertate over \texttt{file} lines.
2358 % \begin{macrocode}
2359 for line in io.lines(file)
2360 do
2361 % \end{macrocode}
2362 % If we match \enquote{date}, we've found the header row and ignore it.
2363 % \begin{macrocode}
2364 if string.match(line, "date")
2365 then
2366 else
2367 % \end{macrocode}
2368 % Otherwise, we match for a \texttt{date} and a \texttt{value}.
2369 % \begin{macrocode}
2370 date, dat = string.match(line, "(%d%d%d%d%-%d%d%-%d%d)%s+(%S+)")
2371 % \end{macrocode}
2372 % We set \texttt{startdate} with the first \texttt{date} we've found.
2373 % \begin{macrocode}
2374 if firstline == true
2375 then
2376 startdate = date
2377 firstline = false
2378 end
2379 % \end{macrocode}
2380 % Moreover, we write a non-empty and non-\texttt{nan} value in our \texttt{data} table.
2381 % \begin{macrocode}
2382 if dat ~= "nan" and dat ~= "{}" and dat ~= ""
2383 then
2384 data[date] = dat
2385 end
2386 end
2387 end
2388 enddate = date
2389 % \end{macrocode}
2390 % Finally, we return \texttt{data}, \texttt{startdate} and \texttt{enddate}.
2391 % \begin{macrocode}
2392 return data,startdate,enddate
2393 end
2394 % \end{macrocode}
2395 % This function writes a new \texttt{data file} based on given start and end date.
2396 % \begin{macrocode}
2397 function write_avg_file(data,file,startdate,enddate)
2398 local sdate
2399 local edate
2400 local wday
2401 % \end{macrocode}
2402 % First, we compute the Unix times of \texttt{startdate} and \texttt{enddate} for comparisons
2403 % \begin{macrocode}
2404 sdate = unixtime(parse_date(startdate))
2405 edate = unixtime(parse_date(enddate))
2406 % \end{macrocode}
2407 % We open a \texttt{file} with write privilege and write the header row.
2408 % \begin{macrocode}
2409 outfile = assert(io.open(file, "w"))
2410 outfile:write("date value avg07 avg14 avg30 avg60 avg90")
2411 % \end{macrocode}
2412 % Then, we loop through our \texttt{data} table. If we do find a \texttt{data} entry, we write the \texttt{date},
2413 % \texttt{value} and averages into the \texttt{file}.
2414 % \begin{macrocode}
2415 while sdate <= edate+7200
2416 do
2417 wday = daystring(sdate)
2418 if data[wday] ~= nil
2419 then
2420 outfile:write("\n" .. wday .. " "
2421 .. ptd(data[wday]) .. " "
2422 .. ptd(calc_avg(data,wday,7)) .. " "
2423 .. ptd(calc_avg(data,wday,14)) .. " "
2424 .. ptd(calc_avg(data,wday,30)) .. " "
2425 .. ptd(calc_avg(data,wday,60)) .. " "
2426 .. ptd(calc_avg(data,wday,90)))
2427 end
2428 sdate = sdate + 60*60*24
2429 end
2430 % \end{macrocode}
2431 % Finally, we close the \texttt{file}.
2432 % \begin{macrocode}
2433 outfile:close()
2434 end
2435 % \end{macrocode}
2436 % It's time to evaluate the commad line options with a \texttt{getopt} routine.
2437 % \begin{macrocode}
2438 do
2439 local newarg = {}
2440 local i, limit = 1, #arg
2441 while (i <= limit) do
2442 if arg[i] == "-i" then
2443 infile = arg[i+1]
2444 i = i + 1
2445 elseif arg[i] == "-o" then
2446 outfile = arg[i+1]
2447 i = i + 1
2448 elseif arg[i] == "-s" then
2449 startdate = arg[i+1]
2450 i = i + 1
2451 elseif arg[i] == "-e" then
2452 enddate = arg[i+1]
2453 i = i + 1
2454 elseif arg[i] == "-c" then
2455 columns = arg[i+1]
2456 i = i + 1
2457 elseif arg[i] == "-m" then
2458 mode = arg[i+1]
2459 i = i + 1
2460 elseif arg[i] == "-v" then
2461 pversion()
2462 elseif arg[i] == "-h" then
2463 phelp()
2464 else
2465 newarg[#newarg+1] = arg[i]
2466 end
2467 i = i + 1
2468 end
2469 arg = newarg
2470 end
2471 % \end{macrocode}
2472 % In \texttt{average} mode, we first read in the \texttt{infile} and check for given start and end dates and use them if present.
2473 % \begin{macrocode}
2474 if mode == "average"
2475 then
2476 local startd
2477 local endd
2478
2479 print("set mode to " .. mode)
2480 print("reading data file " .. infile)
2481 data,startd,endd = read_data(infile)
2482 if startdate ~= ""
2483 then
2484 startd = startdate
2485 end
2486 if enddate ~= ""
2487 then
2488 endd = enddate
2489 end
2490 print("writing data file " .. outfile)
2491 % \end{macrocode}
2492 % Finally, we write the new \texttt{outfile}.
2493 % \begin{macrocode}
2494 write_avg_file(data,outfile,startd,endd)
2495 os.exit(0)
2496 end
2497 % \end{macrocode}
2498 % In \texttt{compose} mode, we first read in the \texttt{data file}.
2499 % \begin{macrocode}
2500 if mode == "compose"
2501 then
2502 local row = 0
2503 local column = 0
2504 local ofile
2505 local cols
2506
2507 print("set mode to " .. mode)
2508 print("reading data file " .. infile)
2509 for line in io.lines(infile)
2510 do
2511 row = row + 1
2512 data[row] = {}
2513 column = 0
2514 for value in string.gmatch(line, "%S+")
2515 do
2516 column = column + 1
2517 data[row][column] = value
2518 end
2519 end
2520 % \end{macrocode}
2521 % Then, we evaluate the given list of columns. I have no idea how it works exactly.
2522 % Many thanks to Paul Kulchenko and Egor Skriptunoff\newline
2523 % \href{https://stackoverflow.com/questions/30242212/how-to-output-more-than-one-column/}{https://stackoverflow.com/questions/30242212/how-to-output-more-than-one-column/}
2524 % \begin{macrocode}
2525 cols = assert(load("return table.concat({"..columns:gsub("%d+","(...)[%0]").."},' ')"))
2526 ofile = assert(io.open(outfile, "w"))
2527 print("writing data file " .. outfile)
2528 % \end{macrocode}
2529 % Finally, we loop through the rows of our \texttt{data} table and write the choosen columns.
2530 % We don't issue a new line character in the last row!
2531 % \begin{macrocode}
2532 for irow = 1,row
2533 do
2534 if irow == row
2535 then
2536 ofile:write(cols(data[irow]))
2537 else
2538 ofile:write(cols(data[irow]).."\n")
2539 end
2540 end
2541 ofile:close()
2542 os.exit(0)
2543 end
2544 % \end{macrocode}
2545 % In \texttt{cut} mode we check the format and compute the Unix times of the given start and end dates.
2546 % \begin{macrocode}
2547 if mode == "cut"
2548 then
2549 local ofile
2550 local date
2551 local sdate
2552 local edate
2553 local cdate
2554
2555 check_date(startdate)
2556 check_date(enddate)
2557 sdate = unixtime(parse_date(startdate))
2558 edate = unixtime(parse_date(enddate))
2559 print("set mode to " .. mode)
2560 print("reading data file " .. infile)
2561 print("writing data file " .. outfile)
2562 % \end{macrocode}
2563 % We open the \texttt{outfile} with writing privilege and loop trough \texttt{infile}.
2564 % \begin{macrocode}
2565 ofile = assert(io.open(outfile, "w"))
2566 for line in io.lines(infile)
2567 do
2568 % \end{macrocode}
2569 % Of course, we copy the header row.
2570 % \begin{macrocode}
2571 if string.match(line, "date")
2572 then
2573 ofile:write(line)
2574 % \end{macrocode}
2575 % Furthermore, we check if the date of the current \texttt{line} is within the given dates and write the \texttt{line} to the file.
2576 % \begin{macrocode}
2577 else
2578 date = parse_dateinline(line)
2579 cdate = unixtime(parse_date(date))
2580 if cdate >= sdate and cdate <= edate
2581 then
2582 ofile:write("\n" .. line)
2583 end
2584 end
2585 end
2586 ofile:close()
2587 os.exit(0)
2588 end
2589 % \end{macrocode}
2590 % Finally, we issue errors for incorrect \texttt{mode}s.
2591 % \begin{macrocode}
2592 if mode == "*"
2593 then
2594 io.stderr:write ("Error 11: no mode specified!")
2595 os.exit(11)
2596 else
2597 io.stderr:write ("Error 12: invalid mode " .. mode)
2598 os.exit(12)
2599 end
2600 % \end{macrocode}
2601 % \begin{macrocode}
2602 %</lua>
2603 % \end{macrocode}
2604 %\Finale