Browse Source

Merge pull request #1 from abertout/master

use of TikZ/PGF instead of pstrics
Giuseppe Lipari 9 years ago
parent
commit
04c7c84040
4 changed files with 219 additions and 182 deletions
  1. 3
    3
      README.md
  2. 2
    1
      rtsched-beamer-doc.tex
  3. 51
    55
      rtsched-doc.tex
  4. 163
    123
      rtsched.sty

+ 3
- 3
README.md View File

3
 =========================================
3
 =========================================
4
 
4
 
5
 Author:  Giuseppe Lipari (g.lipari@sssup.it)
5
 Author:  Giuseppe Lipari (g.lipari@sssup.it)
6
-Version: 1.1
7
-Date:    2013/01/11
6
+Version: 2.0
7
+Date:    2015/05/01
8
 
8
 
9
 This package contains the rtsched package for drawing GANTT charts
9
 This package contains the rtsched package for drawing GANTT charts
10
 (chronograms). The package can be useful for drawing real-time timing
10
 (chronograms). The package can be useful for drawing real-time timing
11
 diagrams in LaTeX, as often needs to be done for preparing articles,
11
 diagrams in LaTeX, as often needs to be done for preparing articles,
12
 lectures and presentation in the Real-Time Scheduling research
12
 lectures and presentation in the Real-Time Scheduling research
13
-community. The package depends on keyval, multido and pstricks.
13
+community. The package depends on keyval and TikZ/PGF.
14
 
14
 
15
 A more complete documentation, with a set of examples, is available in
15
 A more complete documentation, with a set of examples, is available in
16
 file rtsched-doc.pdf.
16
 file rtsched-doc.pdf.

+ 2
- 1
rtsched-beamer-doc.tex View File

1
-\documentclass[dvips]{beamer}
1
+\documentclass{beamer}
2
 
2
 
3
 \usepackage{rtsched}
3
 \usepackage{rtsched}
4
 \usepackage[english]{babel}
4
 \usepackage[english]{babel}
5
 \usepackage[latin1]{inputenc}
5
 \usepackage[latin1]{inputenc}
6
+\usepackage{multido}
6
 
7
 
7
 \title{An example of using the \texttt{rtsched} package with Beamer}
8
 \title{An example of using the \texttt{rtsched} package with Beamer}
8
 \author{Giuseppe Lipari}
9
 \author{Giuseppe Lipari}

+ 51
- 55
rtsched-doc.tex View File

2
 
2
 
3
 \usepackage{rtsched}
3
 \usepackage{rtsched}
4
 \usepackage{url}
4
 \usepackage{url}
5
+\usepackage{multido}
5
 
6
 
6
-\title{The \texttt{rtsched} package for \LaTeX \\ (version 1.0)}
7
+\title{The \texttt{rtsched} package for \LaTeX \\ (version 2.0)}
7
 \author{Giuseppe Lipari}
8
 \author{Giuseppe Lipari}
8
 
9
 
9
 \begin{document}
10
 \begin{document}
18
 package, which can be used to easily draw chronograms (GANTT charts).
19
 package, which can be used to easily draw chronograms (GANTT charts).
19
 These diagrams are quite common in real-time scheduling research.
20
 These diagrams are quite common in real-time scheduling research.
20
 
21
 
21
-The package depends on keyval, multido and pstricks, all widely
22
+The package depends on keyval and TikZ/PGF, both widely
22
 available on any \TeX distribution.
23
 available on any \TeX distribution.
23
 
24
 
24
-The drawing capabilities are completely based on the PSTricks: for
25
-this reason, it may not be safe to use \texttt{pdfLaTeX} to compile a
26
-document that uses the \texttt{rtsched} package, due to the fact that
27
-at the time of this writing, PSTricks is not well supported by
28
-pdfLatex. If you want to produce pdf files (for example for making
29
-slides with Beamer), consider using the following compilation chain:
30
-
31
-\begin{verbatim}
32
-latex doc.tex && dvips doc.dvi && ps2pdf doc.ps 
33
-\end{verbatim}
25
+The drawing capabilities are completely based on TikZ. Thus, you can compile
26
+ a document that uses \texttt{rtsched} package with modern tools producing pdf document
27
+as \texttt{pdfLaTeX}, \texttt{XeLaTeX} or \texttt{LuaLaTeX}.
34
 
28
 
35
 As said, the style works also with Beamer, and it is also possible to
29
 As said, the style works also with Beamer, and it is also possible to
36
 use animations.
30
 use animations.
73
 \TaskArrDeadl{i}{t}{reld}
67
 \TaskArrDeadl{i}{t}{reld}
74
 \end{verbatim}
68
 \end{verbatim}
75
 \noindent where \texttt{i} is the task index (from 1 to \texttt{n}
69
 \noindent where \texttt{i} is the task index (from 1 to \texttt{n}
76
-included), \texttt{t} is the arival time, and \texttt{reld} is the
70
+included), \texttt{t} is the arrival time, and \texttt{reld} is the
77
 relative deadline; an absolute deadline will be drawn at \texttt{t +
71
 relative deadline; an absolute deadline will be drawn at \texttt{t +
78
   reld}.
72
   reld}.
79
 
73
 
80
 In this example there are a lot of repetitions. These can be avoided
74
 In this example there are a lot of repetitions. These can be avoided
81
-if you use the \texttt{multido} macro, as shown in the example of
75
+if you use the \texttt{multido} macro from the \texttt{multido} package, as shown in the example of
82
 Figure \ref{fig:ex1a}.
76
 Figure \ref{fig:ex1a}.
83
 
77
 
84
 To draw the execution rectangle, you can use the following command:
78
 To draw the execution rectangle, you can use the following command:
95
 you can see an example with 2 tasks with relative deadlines different
89
 you can see an example with 2 tasks with relative deadlines different
96
 from periods (the so-called \emph{constrained deadline tasks}).
90
 from periods (the so-called \emph{constrained deadline tasks}).
97
 
91
 
98
-\begin{figure}[h]
92
+\begin{figure}[!htbp]
99
   \centering
93
   \centering
100
   % 2 tasks, for 20 units of time
94
   % 2 tasks, for 20 units of time
101
   % we specify the width (10cm is the default
95
   % we specify the width (10cm is the default
163
   \label{fig:ex1}
157
   \label{fig:ex1}
164
 \end{figure}
158
 \end{figure}
165
 
159
 
166
-\begin{figure}[h]
160
+\begin{figure}[!htbp]
167
   \centering
161
   \centering
168
   \begin{RTGrid}{2}{20}
162
   \begin{RTGrid}{2}{20}
169
     \multido{\n=0+4}{5}{        % 5 instances of period 4 
163
     \multido{\n=0+4}{5}{        % 5 instances of period 4 
170
-      \TaskArrDead{1}{\n}{4}    % draw the arrival and deadline
171
-      \TaskExecDelta{1}{\n}{1}  % draw execution (highest priority), 
164
+      \TaskArrDead{1}{\n}{4}    % draws the arrival and deadline
165
+      \TaskExecDelta{1}{\n}{1}  % draws execution (highest priority), 
172
                                 % from \n to \n+1
166
                                 % from \n to \n+1
173
     }
167
     }
174
  
168
  
175
     \multido{\n=0+6}{3}{        % 3 instances of period 6 
169
     \multido{\n=0+6}{3}{        % 3 instances of period 6 
176
-      \TaskArrDead{2}{\n}{6}    % draw the arrival and deadline
170
+      \TaskArrDead{2}{\n}{6}    % draws the arrival and deadline
177
     }
171
     }
178
     % no simple formula for lowest priority, sorry!
172
     % no simple formula for lowest priority, sorry!
179
     \TaskExecution{2}{1}{4}
173
     \TaskExecution{2}{1}{4}
185
 \begin{verbatim}
179
 \begin{verbatim}
186
   \begin{RTGrid}{2}{20}
180
   \begin{RTGrid}{2}{20}
187
     \multido{\n=0+4}{5}{        % 4 instances of period 4 
181
     \multido{\n=0+4}{5}{        % 4 instances of period 4 
188
-      \TaskArrDead{1}{\n}{4}    % draw the arrival and deadline
189
-      \TaskExecDelta{1}{\n}{1}  % draw execution (highest priority), 
182
+      \TaskArrDead{1}{\n}{4}    % draws the arrival and deadline
183
+      \TaskExecDelta{1}{\n}{1}  % draws execution (highest priority), 
190
                                 % from \n to \n+1
184
                                 % from \n to \n+1
191
     }
185
     }
192
  
186
  
193
     \multido{\n=0+6}{3}{        % 3 instances of period 6 
187
     \multido{\n=0+6}{3}{        % 3 instances of period 6 
194
-      \TaskArrDead{2}{\n}{6}    % draw the arrival and deadline
188
+      \TaskArrDead{2}{\n}{6}    % draws the arrival and deadline
195
     }
189
     }
196
     % no simple formula for lowest priority, sorry!
190
     % no simple formula for lowest priority, sorry!
197
     \TaskExecution{2}{1}{4}
191
     \TaskExecution{2}{1}{4}
204
   \label{fig:ex1a}
198
   \label{fig:ex1a}
205
 \end{figure}
199
 \end{figure}
206
 
200
 
207
-\begin{figure}[h]
201
+\begin{figure}[!htbp]
208
   \centering
202
   \centering
209
   \begin{RTGrid}{3}{14}
203
   \begin{RTGrid}{3}{14}
210
     \multido{\n=0+3}{4}{        % 4 instances of period 3, starting from 0 
204
     \multido{\n=0+3}{4}{        % 4 instances of period 3, starting from 0 
211
-      \TaskArrival{1}{\n}       % draw only the arrival
212
-      \TaskExecDelta{1}{\n}{1}  % draw execution (highest priority), 
205
+      \TaskArrival{1}{\n}       % draws only the arrival
206
+      \TaskExecDelta{1}{\n}{1}  % draws execution (highest priority), 
213
                                 % from \n to \n+1
207
                                 % from \n to \n+1
214
     }
208
     }
215
  
209
  
216
     \multido{\n=3+4}{3}{        % 3 instances of period 4, starting from 3 
210
     \multido{\n=3+4}{3}{        % 3 instances of period 4, starting from 3 
217
-      \TaskArrival{2}{\n}       % draw only the arrival
211
+      \TaskArrival{2}{\n}       % draws only the arrival
218
     }
212
     }
219
     \TaskExecDelta{2}{4}{1}
213
     \TaskExecDelta{2}{4}{1}
220
     \TaskExecDelta{2}{7}{1}
214
     \TaskExecDelta{2}{7}{1}
221
     \TaskExecDelta{2}{11}{1}
215
     \TaskExecDelta{2}{11}{1}
222
 
216
 
223
     \multido{\n=1+5}{3}{        % 3 instances of period 5, starting from 1 
217
     \multido{\n=1+5}{3}{        % 3 instances of period 5, starting from 1 
224
-      \TaskArrival{3}{\n}       % draw only the arrival
218
+      \TaskArrival{3}{\n}       % draws only the arrival
225
     }
219
     }
226
     \TaskExecDelta{3}{1}{1}
220
     \TaskExecDelta{3}{1}{1}
227
     \TaskExecDelta{3}{8}{1}
221
     \TaskExecDelta{3}{8}{1}
231
 \begin{verbatim}
225
 \begin{verbatim}
232
   \begin{RTGrid}{3}{14}
226
   \begin{RTGrid}{3}{14}
233
     \multido{\n=0+3}{4}{        % 4 instances of period 3 
227
     \multido{\n=0+3}{4}{        % 4 instances of period 3 
234
-      \TaskArrival{1}{\n}       % draw only the arrival
235
-      \TaskExecDelta{1}{\n}{1}} % draw execution (highest priority), 
228
+      \TaskArrival{1}{\n}       % draws only the arrival
229
+      \TaskExecDelta{1}{\n}{1}} % draws execution (highest priority), 
236
                                 % from \n to \n+1
230
                                 % from \n to \n+1
237
  
231
  
238
     \multido{\n=3+4}{3}{        % 3 instances of period 4, starting from 3 
232
     \multido{\n=3+4}{3}{        % 3 instances of period 4, starting from 3 
239
-      \TaskArrival{2}{\n}}      % draw only the arrival
233
+      \TaskArrival{2}{\n}}      % draws only the arrival
240
 
234
 
241
     \TaskExecDelta{2}{4}{1}
235
     \TaskExecDelta{2}{4}{1}
242
     \TaskExecDelta{2}{7}{1}
236
     \TaskExecDelta{2}{7}{1}
243
     \TaskExecDelta{2}{11}{1}
237
     \TaskExecDelta{2}{11}{1}
244
 
238
 
245
     \multido{\n=1+5}{3}{        % 3 instances of period 5, starting from 1 
239
     \multido{\n=1+5}{3}{        % 3 instances of period 5, starting from 1 
246
-      \TaskArrival{3}{\n}}      % draw only the arrival
240
+      \TaskArrival{3}{\n}}      % draws only the arrival
247
 
241
 
248
     \TaskExecDelta{3}{1}{1}
242
     \TaskExecDelta{3}{1}{1}
249
     \TaskExecDelta{3}{8}{1}
243
     \TaskExecDelta{3}{8}{1}
254
   \label{fig:ex1b}
248
   \label{fig:ex1b}
255
 \end{figure}
249
 \end{figure}
256
 
250
 
257
-\begin{figure}[h]
251
+\begin{figure}[!htbp]
258
   \centering
252
   \centering
259
   \begin{RTGrid}[width=8cm]{2}{15}
253
   \begin{RTGrid}[width=8cm]{2}{15}
260
     \multido{\n=0+6}{3}{
254
     \multido{\n=0+6}{3}{
280
   \centering
274
   \centering
281
   \begin{RTGrid}{2}{20}
275
   \begin{RTGrid}{2}{20}
282
     \multido{\n=0+4}{5}{        % 5 instances of period 4 
276
     \multido{\n=0+4}{5}{        % 5 instances of period 4 
283
-      \TaskArrDead{1}{\n}{4}    % draw the arrival and deadline
284
-      \TaskExecDelta{1}{\n}{1}  % draw execution (highest priority), 
277
+      \TaskArrDead{1}{\n}{4}    % draws the arrival and deadline
278
+      \TaskExecDelta{1}{\n}{1}  % draws execution (highest priority), 
285
                                 % from \n to \n+1
279
                                 % from \n to \n+1
286
     }
280
     }
287
  
281
  
288
     \multido{\n=0+6}{3}{        % 3 instances of period 6 
282
     \multido{\n=0+6}{3}{        % 3 instances of period 6 
289
-      \TaskArrDead{2}{\n}{6}    % draw the arrival and deadline
283
+      \TaskArrDead{2}{\n}{6}    % draws the arrival and deadline
290
     }
284
     }
291
 
285
 
292
     \TaskRespTime{2}{0}{4}
286
     \TaskRespTime{2}{0}{4}
305
     \multido{\n=0+6}{3}{        
299
     \multido{\n=0+6}{3}{        
306
       \TaskArrDead{2}{\n}{6}}
300
       \TaskArrDead{2}{\n}{6}}
307
 
301
 
308
-    \TaskRespTime{2}{0}{4}   % draws the hatched rectangle in [0,4]
309
-    \TaskExecution{2}{1}{4}  % draws execution (over the previous rectangle)
310
-    \TaskRespTime{2}{6}{4}   % draws the hatched rectangle in [6,10]
311
-    \TaskExecution{2}{6}{8}  % draws execution
312
-    \TaskExecution{2}{9}{10} % draws execution
302
+    \TaskRespTime{2}{0}{4}    % draws the hatched rectangle in [0,4]
303
+    \TaskExecution{2}{1}{4}   % draws execution (over the previous rectangle)
304
+    \TaskRespTime{2}{6}{4}    % draws the hatched rectangle in [6,10]
305
+    \TaskExecution{2}{6}{8}   % draws execution
306
+    \TaskExecution{2}{9}{10}  % draws execution
313
     \TaskRespTime{2}{12}{4}   % draws the hatched rectangle in [12,16]
307
     \TaskRespTime{2}{12}{4}   % draws the hatched rectangle in [12,16]
314
     \TaskExecution{2}{13}{16} % draws execution   
308
     \TaskExecution{2}{13}{16} % draws execution   
315
   \end{RTGrid}  
309
   \end{RTGrid}  
322
 \subsection{Controlling visualization}
316
 \subsection{Controlling visualization}
323
 
317
 
324
 It is possible to specify many options in the \texttt{RTGrid}
318
 It is possible to specify many options in the \texttt{RTGrid}
325
-environment.  Maybe you don't like the grid: then, you can decide to
319
+environment. Maybe you don't like the grid: then, you can decide to
326
 not visualise it as in Figure \ref{fig:ex2}, where we also removed the
320
 not visualise it as in Figure \ref{fig:ex2}, where we also removed the
327
 task symbols.
321
 task symbols.
328
-\begin{figure}[h]
322
+\begin{figure}[!htbp]
329
   \centering
323
   \centering
330
   %% no grid and no symbols
324
   %% no grid and no symbols
331
   \begin{RTGrid}[nogrid=1,nosymbols=1]{2}{20}
325
   \begin{RTGrid}[nogrid=1,nosymbols=1]{2}{20}
361
 show the numbers on the time line, and the color of the boxes that
355
 show the numbers on the time line, and the color of the boxes that
362
 denote the execution of the second instance of the second task are
356
 denote the execution of the second instance of the second task are
363
 changed to red. Also, I am changing the width, so the figure looks
357
 changed to red. Also, I am changing the width, so the figure looks
364
-smaller.
358
+smaller. Notice that you can directly specify colors using the TikZ
359
+ way (color!percentage for example).
365
 
360
 
366
-\begin{figure}[h]
361
+\begin{figure}[!htbp]
367
   \centering
362
   \centering
368
   %% specify 1) no numbers on the time line, 2) a different symbol, 3)
363
   %% specify 1) no numbers on the time line, 2) a different symbol, 3)
369
-  %% a different size of the symbol (default is 8pt).
364
+  %% a different size of the symbol using latex size commands (default is \normalsize).
370
   %% Notice that you should not use the math mode in the
365
   %% Notice that you should not use the math mode in the
371
   %% specification of the symbol, as the symbol is already used in a
366
   %% specification of the symbol, as the symbol is already used in a
372
   %% math environment inside the macro
367
   %% math environment inside the macro
373
-  \begin{RTGrid}[width=8cm,symbol=\gamma,nonumbers=1,labelsize=11pt]{2}{20}
368
+  \begin{RTGrid}[width=8cm,symbol=\gamma,nonumbers=1,labelsize=\small]{2}{20}
374
     \multido{\n=0+4}{5}{         
369
     \multido{\n=0+4}{5}{         
375
       \TaskArrDead{1}{\n}{4}    
370
       \TaskArrDead{1}{\n}{4}    
376
       \TaskExecDelta{1}{\n}{1}}
371
       \TaskExecDelta{1}{\n}{1}}
381
     \TaskExecution[linecolor=cyan,color=white]{2}{1}{4}
376
     \TaskExecution[linecolor=cyan,color=white]{2}{1}{4}
382
     %% the next two boxes are filled with red instead of gray
377
     %% the next two boxes are filled with red instead of gray
383
     \TaskExecution[color=red]{2}{6}{8}
378
     \TaskExecution[color=red]{2}{6}{8}
384
-    \TaskExecution[color=red]{2}{9}{10}
379
+    \TaskExecution[color=red!50]{2}{9}{10}
385
     \TaskExecution{2}{13}{16}        
380
     \TaskExecution{2}{13}{16}        
386
   \end{RTGrid}
381
   \end{RTGrid}
387
 
382
 
388
 \begin{verbatim}
383
 \begin{verbatim}
389
   %% specify 1) no numbers on the time line, 2) a different symbol, 3)
384
   %% specify 1) no numbers on the time line, 2) a different symbol, 3)
390
-  %% a different size of the symbol (default is 8pt).
385
+  %% a different size of the symbol (default is \normalsize).
391
   %% Notice that you should not use the math mode in the
386
   %% Notice that you should not use the math mode in the
392
   %% specification of the symbol, as the symbol is already used in a
387
   %% specification of the symbol, as the symbol is already used in a
393
   %% math environment inside the macro
388
   %% math environment inside the macro
394
-  \begin{RTGrid}[symbol=\gamma,nonumbers=1,labelsize=11pt]{2}{20}
389
+  \begin{RTGrid}[symbol=\gamma,nonumbers=1,labelsize=\Large]{2}{20}
395
     \multido{\n=0+4}{5}{         
390
     \multido{\n=0+4}{5}{         
396
       \TaskArrDead{1}{\n}{4}    
391
       \TaskArrDead{1}{\n}{4}    
397
       \TaskExecDelta{1}{\n}{1}}
392
       \TaskExecDelta{1}{\n}{1}}
406
     \TaskExecution{2}{13}{16}        
401
     \TaskExecution{2}{13}{16}        
407
   \end{RTGrid}
402
   \end{RTGrid}
408
 \end{verbatim}
403
 \end{verbatim}
409
-  \caption{Different symbols (with size 11pt), no numbers, a different
404
+  \caption{Different symbols (with \textbackslash Large size), no numbers, a different
410
     task color}
405
     task color}
411
   \label{fig:ex2a}
406
   \label{fig:ex2a}
412
 \end{figure}
407
 \end{figure}
420
 the top). Here we show also how to specify an arbitrary starting
415
 the top). Here we show also how to specify an arbitrary starting
421
 number in the time line, using the \texttt{numoffset=12} option.
416
 number in the time line, using the \texttt{numoffset=12} option.
422
 
417
 
423
-\begin{figure}[h]
418
+\begin{figure}[!htbp]
424
   \centering
419
   \centering
425
   %% specify 1) no numbers on the time line, 2) number starting from
420
   %% specify 1) no numbers on the time line, 2) number starting from
426
   %% 12
421
   %% 12
466
 % In the last example (Figure \ref{fig:ex2c}), we show an empty grid in
461
 % In the last example (Figure \ref{fig:ex2c}), we show an empty grid in
467
 % which we specify width and height.
462
 % which we specify width and height.
468
 
463
 
469
-% \begin{figure}[h]
464
+% \begin{figure}[!htbp]
470
 %   \centering
465
 %   \centering
471
 %   %% 3 tasks, 10 units of time
466
 %   %% 3 tasks, 10 units of time
472
 %   \begin{RTGrid}[width=12cm, height=4cm]{3}{10}
467
 %   \begin{RTGrid}[width=12cm, height=4cm]{3}{10}
506
 \RTBox{t1}{t2}
501
 \RTBox{t1}{t2}
507
 \end{verbatim}
502
 \end{verbatim}
508
 
503
 
509
-\begin{figure}[h]
504
+\begin{figure}[!htbp]
510
   \centering
505
   \centering
511
   \begin{RTGrid}{2}{20}
506
   \begin{RTGrid}{2}{20}
512
     \RTBox{12}{16}
507
     \RTBox{12}{16}
535
 \end{figure}
530
 \end{figure}
536
 
531
 
537
 Notice that the order with which the objects are drawn is exactly the
532
 Notice that the order with which the objects are drawn is exactly the
538
-same as the order in which they are specified in the code. For
539
-example, in Figure \ref{fig:ex3a}, the executions of all the tasks are
533
+same as the order in which they are specified in the code, excepted 
534
+for horizontal axes, arrivals and deadlines that are always drawn on the foreground.
535
+ For example, in Figure \ref{fig:ex3a}, the executions of all the tasks are
540
 drawn on top of the box. You can try to move the \texttt{RTBox}
536
 drawn on top of the box. You can try to move the \texttt{RTBox}
541
 command at the end to see what happens.
537
 command at the end to see what happens.
542
 
538
 

+ 163
- 123
rtsched.sty View File

1
+  %% rtsched.sty
2
+  %% Copyright 2005 M. G. Lipari
3
+  %
4
+  % This work may be distributed and/or modified under the
5
+  % conditions of the LaTeX Project Public License, either version 1.3
6
+  % of this license or (at your option) any later version.
7
+  % The latest version of this license is in
8
+  %   http://www.latex-project.org/lppl.txt
9
+  % and version 1.3 or later is part of all distributions of LaTeX
10
+  % version 2005/12/01 or later.
11
+  %
12
+  % This work has the LPPL maintenance status `maintained'.
13
+  % 
14
+  % The Current Maintainer of this work is G. Lipari
15
+  %
16
+  % This work consists of the file pig.sty.
17
+  
18
+  
1
 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
19
 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
2
 \ProvidesPackage{rtsched}[2005/01/01]
20
 \ProvidesPackage{rtsched}[2005/01/01]
3
-\typeout{'rtsched' style for Latex and PSTricks}
21
+\typeout{'rtsched' style for Latex and TikZ/PGF}
4
 \typeout{Easily draw real-time schedules in TeX/Latex.}
22
 \typeout{Easily draw real-time schedules in TeX/Latex.}
5
 \typeout{(c) 2005, Giuseppe Lipari, Pisa, Italy (g.lipari@sssup.it)}
23
 \typeout{(c) 2005, Giuseppe Lipari, Pisa, Italy (g.lipari@sssup.it)}
6
-\typeout{Version 1.2beta}
24
+\typeout{Version 2.0}
7
 
25
 
8
-\RequirePackage{multido}
9
-\RequirePackage{pstricks}
26
+\RequirePackage{tikz}
27
+\usetikzlibrary{shadows, patterns}
10
 \RequirePackage{keyval}
28
 \RequirePackage{keyval}
29
+\newcommand\rtfont{\usefont{T1}{phv}{m}{n}}
30
+
11
 
31
 
12
 %%
32
 %%
13
 %% These can be changed at any time
33
 %% These can be changed at any time
14
 %% 
34
 %% 
15
 \def\RTWindowLength{10cm}    % window length
35
 \def\RTWindowLength{10cm}    % window length
16
-\def\RTWindowHeight{0cm}     % window height
17
-\def\RTNullWindowHeight{0cm} % nullwindow height
18
-\def\RTTaskLabelSize{10pt}   % Size in pt of the task label
19
-\def\RTNumberLabelSize{10pt} % Size in pt of the number labels
20
-\def\RTDefTaskSymbol{\tau}
36
+\def\RTWindowHeight{0}     % window height
37
+\def\RTNullWindowHeight{0} % nullwindow height
38
+\def\RTTaskLabelSize{\normalsize}   % font size the task label
39
+\def\RTNumberLabelSize{\normalsize} % font size of the number labels
40
+\def\RTDefTaskSymbol{\tau} 
21
 \def\RTDefNumberOffset{0}
41
 \def\RTDefNumberOffset{0}
22
 \def\RTDefTaskFill{solid}
42
 \def\RTDefTaskFill{solid}
23
 \def\RTDefTaskColor{gray}
43
 \def\RTDefTaskColor{gray}
31
 \def\RTDefLineWidth{1pt}
51
 \def\RTDefLineWidth{1pt}
32
 \def\RTDefLineStyle{solid}
52
 \def\RTDefLineStyle{solid}
33
 \def\RTDefExecHeight{1}
53
 \def\RTDefExecHeight{1}
54
+\def\RTArrowStyle{-stealth} %arrow style for deadlines, arrivals and horizontal axes
55
+% -{Triangle 45}[length=x] with length is a more modern arrow style but requires arrows.meta tikz library (available on latest texlive but rarely up to date on linux distribution)
56
+%-stealth is a predefined more classical arrow style
34
 
57
 
35
 \def\RTExecLabel{\ }
58
 \def\RTExecLabel{\ }
36
 \def\RTTaskSymbol{\RTDefTaskSymbol}
59
 \def\RTTaskSymbol{\RTDefTaskSymbol}
40
 \def\RTXScale{\RTDefXScale}
63
 \def\RTXScale{\RTDefXScale}
41
 \def\RTWriteSymbols{\RTDefWriteSymbols}
64
 \def\RTWriteSymbols{\RTDefWriteSymbols}
42
 \def\RTNumberOffset{\RTDefNumberOffset}
65
 \def\RTNumberOffset{\RTDefNumberOffset}
43
-\def\RTNumberOffset{\RTDefNumberOffset}
44
 \def\RTGridInvisible{\RTDefGridInvisible}
66
 \def\RTGridInvisible{\RTDefGridInvisible}
67
+\def\RTNumbersInvisible{\RTDefNumbersInvisible}
45
 \def\RTAxisInvisible{\RTDefAxisInvisible}
68
 \def\RTAxisInvisible{\RTDefAxisInvisible}
46
-\def\RTNumbersInvisible{\RTDefGridInvisible}
47
 \def\RTRowLabelOffset{\RTDefRowLabelOffset}
69
 \def\RTRowLabelOffset{\RTDefRowLabelOffset}
48
 \def\RTLineWidth{\RTDefLineWidth}
70
 \def\RTLineWidth{\RTDefLineWidth}
49
 \def\RTLineStyle{\RTDefLineStyle}
71
 \def\RTLineStyle{\RTDefLineStyle}
50
 \def\RTExecHeight{\RTDefExecHeight}
72
 \def\RTExecHeight{\RTDefExecHeight}
51
 
73
 
74
+
75
+
76
+
52
 \define@key{RT}{height}[\RTNullWindowHeight]{\def\RTWindowHeight{#1}}
77
 \define@key{RT}{height}[\RTNullWindowHeight]{\def\RTWindowHeight{#1}}
53
-\define@key{RT}{width}[10cm]{\def\RTWindowLength{#1}}
54
-\define@key{RT}{labelsize}[10pt]{\def\RTTaskLabelSize{#1}}
55
-\define@key{RT}{numbersize}[10pt]{\def\RTNumberLabelSize{#1}}
78
+\define@key{RT}{width}[10]{\def\RTWindowLength{#1}}
79
+\define@key{RT}{labelsize}[\normalsize]{\def\RTTaskLabelSize{#1}}
80
+\define@key{RT}{numbersize}[\normalsize]{\def\RTNumberLabelSize{#1}}
56
 \define@key{RT}{color}[\RTDefTaskColor]{\def\RTTaskColor{#1}}
81
 \define@key{RT}{color}[\RTDefTaskColor]{\def\RTTaskColor{#1}}
57
 \define@key{RT}{linecolor}[\RTDefLineColor]{\def\RTLineColor{#1}}
82
 \define@key{RT}{linecolor}[\RTDefLineColor]{\def\RTLineColor{#1}}
58
 \define@key{RT}{execlabel}[\ ]{\def\RTExecLabel{#1}}
83
 \define@key{RT}{execlabel}[\ ]{\def\RTExecLabel{#1}}
70
 \define@key{RT}{style}[\RTDefLineStyle]{\def\RTLineStyle{#1}}
95
 \define@key{RT}{style}[\RTDefLineStyle]{\def\RTLineStyle{#1}}
71
 \define@key{RT}{exeheight}[\RTDefExecHeight]{\def\RTExecHeight{#1}}
96
 \define@key{RT}{exeheight}[\RTDefExecHeight]{\def\RTExecHeight{#1}}
72
 
97
 
98
+
73
 %%
99
 %%
74
 %% temporaries
100
 %% temporaries
101
+
75
 \newdimen\sx % slot length
102
 \newdimen\sx % slot length
76
 \newdimen\sy % slot height
103
 \newdimen\sy % slot height
77
 \newdimen\hy % frame height
104
 \newdimen\hy % frame height
81
 \newdimen\yyy % y position
108
 \newdimen\yyy % y position
82
 \newcount\nsx % number of horizontal slots
109
 \newcount\nsx % number of horizontal slots
83
 \newcount\nsy % number of vertical slots
110
 \newcount\nsy % number of vertical slots
84
-\newcount\nhl % number of horizonatal lines
111
+\newcount\nhl % number of horizontal lines
85
 \newcount\nvl % number of vertical lines
112
 \newcount\nvl % number of vertical lines
113
+\newcount\ntasks % number of tasks
114
+\newcount\ntaskslessone %number of tasks less one
86
 \newcount\tmp % temp
115
 \newcount\tmp % temp
87
 
116
 
117
+
88
 \newcounter{myLabel}
118
 \newcounter{myLabel}
89
 
119
 
90
 \def\RTGrid{\@ifnextchar[\@mygrid@begin{\@mygrid@begin[]}}
120
 \def\RTGrid{\@ifnextchar[\@mygrid@begin{\@mygrid@begin[]}}
91
 
121
 
92
 \def\RTGridBegin{\@ifnextchar[\@mygrid@begin{\@mygrid@begin[]}}
122
 \def\RTGridBegin{\@ifnextchar[\@mygrid@begin{\@mygrid@begin[]}}
93
 \def\@mygrid@begin[#1]#2#3{\setkeys{RT}{#1}%
123
 \def\@mygrid@begin[#1]#2#3{\setkeys{RT}{#1}%
124
+  %% get the number of tasks
125
+  \ntasks = #2
126
+  \ntaskslessone = \ntasks
127
+  \advance \ntaskslessone by -1
94
   %% number of horizontal steps in the grid
128
   %% number of horizontal steps in the grid
95
   \nsx = #3 \advance \nsx by 2 %
129
   \nsx = #3 \advance \nsx by 2 %
96
-  %% real lenght of the window (approx)
130
+  %% real length of the window (approx)
97
   \nvl = \nsx \advance \nvl by 1 %
131
   \nvl = \nsx \advance \nvl by 1 %
98
-  %% compute lenght of a step
132
+  %% compute length of a step
99
   \sx = \RTWindowLength \divide \sx by \nsx %
133
   \sx = \RTWindowLength \divide \sx by \nsx %
100
   %% number of vertical steps in the grid
134
   %% number of vertical steps in the grid
101
   \nsy = #2 \multiply \nsy by 3 \advance \nsy by 1 %
135
   \nsy = #2 \multiply \nsy by 3 \advance \nsy by 1 %
102
-  %% compute lenght of a vertical step (if height is null, \sy is the
136
+  %% compute length of a vertical step (if height is null, \sy is the
103
   %% same as \sx)
137
   %% same as \sx)
104
   \ifx\RTWindowHeight\RTNullWindowHeight%
138
   \ifx\RTWindowHeight\RTNullWindowHeight%
105
     \sy = \sx%
139
     \sy = \sx%
106
-    \hy = \sy \multiply \hy by \nsy \advance \hy by \sy%
140
+    \hy = \sy \multiply \hy by \nsy %\advance \hy by \sy%
107
   \else 
141
   \else 
108
     \sy = \RTWindowHeight \divide \sy by \nsy %
142
     \sy = \RTWindowHeight \divide \sy by \nsy %
109
-    \hy = \RTWindowHeight \advance \hy by \sy %
143
+    \hy = \RTWindowHeight %\advance \hy by \sy %
110
   \fi
144
   \fi
111
   %% compute real height
145
   %% compute real height
112
   \nhl = \nsy \advance \nhl by 1 %
146
   \nhl = \nsy \advance \nhl by 1 %
113
   \advance \nsy by -1 \advance \nsx by -1
147
   \advance \nsy by -1 \advance \nsx by -1
114
   %% the picture
148
   %% the picture
115
-  \begin{pspicture}(0,0)(\RTWindowLength,\hy) %
149
+  \pgfdeclarelayer{foreground} 
150
+  \pgfsetlayers{main,foreground}
151
+
152
+  \begin{tikzpicture}
116
     %% draw grid (if not invisible)
153
     %% draw grid (if not invisible)
117
     \if\RTGridInvisible\RTDefGridInvisible
154
     \if\RTGridInvisible\RTDefGridInvisible
118
-      \multips(0,\sy)(0,\sy){\nsy}{\psline[linecolor=lightgray]{-}(0,\sy)(\RTWindowLength,\sy)}%
119
-      \multips(\sx,0)(\sx,0){\nsx}{\psline[linecolor=lightgray]{-}(0,\sy)(0,\hy)}%
120
-      \psframe(0,\sy)(\RTWindowLength,\hy)%
155
+      \draw[lightgray, semithick] (0,0) grid[xstep = \sx,ystep=\sy ] (\RTWindowLength,\hy);
156
+    %% draw border grid
157
+      \draw [black, thick] (0,0) rectangle (\RTWindowLength,\hy);
121
     \else\relax
158
     \else\relax
122
     \fi
159
     \fi
160
+
123
     %% draw numbers (if not invisible)
161
     %% draw numbers (if not invisible)
124
     \if\RTNumbersInvisible\RTDefNumbersInvisible
162
     \if\RTNumbersInvisible\RTDefNumbersInvisible
125
-      \tmp = #3 \divide \tmp by 2 \advance \tmp by 1%
126
-      \pssetlength{\xx}{\sx}%
127
-      \setcounter{myLabel}{\RTNumberOffset}
128
-      \multido{\n=0+1}{\tmp}{%
129
-        \uput{4pt}[d](\xx,\sy){%
130
-          \usefont{T1}{phv}{m}{n}%
131
-          \fontsize{\RTNumberLabelSize}{\RTNumberLabelSize}%
132
-          \selectfont{\arabic{myLabel}}}%
133
-        \psaddtolength{\xx}{\sx}%
134
-        \psaddtolength{\xx}{\sx}%
135
-        \addtocounter{myLabel}{2}
136
-      }
137
-    \else\relax
163
+       \foreach \i [evaluate = \i as \j using \i*\sx] in {0,...,#3}{
164
+       \ifodd \i
165
+       \else
166
+       \pgfmathsetmacro\nbwithoffset{\i + \RTNumberOffset};
167
+       \node[below, font=\RTNumberLabelSize \rtfont] at (\j +\sx , 0) {\pgfmathprintnumber[int trunc,/pgf/number format/assume math mode=true]{\nbwithoffset }};
168
+       \fi
169
+       }
170
+    \else
171
+    \relax
138
     \fi
172
     \fi
139
-    % 
173
+
140
     %% Task Names
174
     %% Task Names
141
-    \setcounter{myLabel}{1}
142
-    \pssetlength{\yy}{\hy}%
143
-    \psaddtolength{\yy}{-\sy}
144
-    \multido{\n=0+1}{#2}{%
145
-      \uput{4pt}[d](-\sx,\yy){
146
-        \usefont{T1}{phv}{m}{n}
147
-        \fontsize{\RTTaskLabelSize}{\RTTaskLabelSize}
148
-        \if\RTWriteSymbols\RTDefWriteSymbols\selectfont{$\RTTaskSymbol_{\arabic{myLabel}}$}
149
-          \else\relax
150
-        \fi
151
-      }%
152
-      \psaddtolength{\yy}{-3\sy}%
153
-      \addtocounter{myLabel}{1}
154
-    }%    
175
+    \if\RTWriteSymbols\RTDefWriteSymbols
176
+     \foreach \i  [evaluate = \i as \j using (\hy -3*\i*\sy)] in {0,...,\ntaskslessone}{
177
+      \pgfmathsetmacro\task{\i + 1};
178
+      \node[below, font=\rtfont] at (-\sx , \j-\sy) {\RTTaskLabelSize $\RTTaskSymbol_{\pgfmathprintnumber[int trunc]{\task}}$};
179
+     }
180
+     \else\relax
181
+     \fi
182
+          
155
     %% Horizontal axes
183
     %% Horizontal axes
156
-
157
     \if\RTAxisInvisible\RTDefAxisInvisible
184
     \if\RTAxisInvisible\RTDefAxisInvisible
158
-      \xx = \sx \xxx = \RTWindowLength \advance \xxx by -\sx
159
-      \yy = 2\sy 
160
-      \multido{\n=0+1}{#2}{
161
-        \psline{->}(\xx,\yy)(\xxx,\yy)
162
-        \advance \yy by 3\sy
185
+      \begin{pgfonlayer}{foreground} 
186
+      \foreach \i [evaluate = \i as \j using (\hy -3*\i*\sy)] in {0,...,\ntaskslessone}{
187
+      \draw [very thick,\RTArrowStyle] (\sx,\j-3*\sy) -- (\RTWindowLength - \sx,\j-3*\sy);
163
       }
188
       }
164
-    \fi
189
+      \end{pgfonlayer} 
190
+    \fi 
165
 }
191
 }
166
-
167
-
168
-
192
+ 
169
 \def\@RTDefaultValues{%
193
 \def\@RTDefaultValues{%
170
   \setkeys{RT}{height}%
194
   \setkeys{RT}{height}%
171
   \setkeys{RT}{width}%
195
   \setkeys{RT}{width}%
186
 }
210
 }
187
 
211
 
188
 \def\RTGridEnd{
212
 \def\RTGridEnd{
189
-    \end{pspicture}%
213
+    \end{tikzpicture}%
190
     \@RTDefaultValues%
214
     \@RTDefaultValues%
191
 }
215
 }
192
 
216
 
193
 \def\endRTGrid{
217
 \def\endRTGrid{
194
-    \end{pspicture}%
218
+    \end{tikzpicture}%
195
     \@RTDefaultValues%
219
     \@RTDefaultValues%
196
 }
220
 }
197
 
221
 
221
   \advance \yy by \hy
245
   \advance \yy by \hy
222
 }
246
 }
223
 
247
 
248
+
224
 \newcommand{\DrawTaskAxis}[2][nocommand=1]{%
249
 \newcommand{\DrawTaskAxis}[2][nocommand=1]{%
225
     \setkeys{RT}{#1}%
250
     \setkeys{RT}{#1}%
226
     \@compute@yy{#2}
251
     \@compute@yy{#2}
227
     \@compute@xx{0}
252
     \@compute@xx{0}
228
     \xxx = \RTWindowLength \advance \xxx by -\sx 
253
     \xxx = \RTWindowLength \advance \xxx by -\sx 
254
+    \draw [\RTLineColor,\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
229
     \psline[linecolor=\RTLineColor]{->}(\xx,\yy)(\xxx,\yy)%
255
     \psline[linecolor=\RTLineColor]{->}(\xx,\yy)(\xxx,\yy)%
230
     \@RTExecDefaultValues%
256
     \@RTExecDefaultValues%
231
 }
257
 }
235
     \@compute@yy{#2}
261
     \@compute@yy{#2}
236
     \@compute@xx{0}
262
     \@compute@xx{0}
237
     \xxx = \RTWindowLength \advance \xxx by -\sx 
263
     \xxx = \RTWindowLength \advance \xxx by -\sx 
238
-    \psline[linecolor=\RTLineColor]{->}(\xx,\yy)(\xxx,\yy)%
264
+    \draw [\RTLineColor,\RTArrowStyle] (\xx,\yy) -- (\xxx,\yy);
239
     \yyy = 3\sy \multiply \yyy by #3 \advance \yyy by \yy
265
     \yyy = 3\sy \multiply \yyy by #3 \advance \yyy by \yy
240
     \advance \yyy by -\sy
266
     \advance \yyy by -\sy
241
-    \psline[linecolor=\RTLineColor]{->}(\xx,\yy)(\xx,\yyy)%
267
+    \draw [\RTLineColor,\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
242
     \@RTExecDefaultValues%
268
     \@RTExecDefaultValues%
243
 }
269
 }
244
 
270
 
248
     \@compute@xxx{#4}
274
     \@compute@xxx{#4}
249
     \yy = #3\sy \advance \yy by 2\sy
275
     \yy = #3\sy \advance \yy by 2\sy
250
     \yyy = #5\sy \advance \yyy by 2\sy
276
     \yyy = #5\sy \advance \yyy by 2\sy
251
-    \psline[linecolor=\RTLineColor,linestyle=\RTLineStyle,linewidth=\RTLineWidth]{-}(\xx,\yy)(\xxx,\yyy)
277
+    \draw [\RTLineColor, line width=\RTLineWidth,\RTLineStyle] (\xx,\yy) -- (\xxx,\yyy);
252
     \@RTExecDefaultValues%
278
     \@RTExecDefaultValues%
253
 }
279
 }
254
 
280
 
260
     \@compute@yy{#2}
286
     \@compute@yy{#2}
261
     \@compute@xx{#3}
287
     \@compute@xx{#3}
262
     \yyy = \yy \advance \yyy by 2\sy%
288
     \yyy = \yy \advance \yyy by 2\sy%
263
-    \psline[linecolor=\RTLineColor]{->}(\xx,\yy)(\xx,\yyy)%
289
+     \begin{pgfonlayer}{foreground} 
290
+    \draw [\RTLineColor, thick,\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
291
+     \end{pgfonlayer}
292
+
264
     \@RTExecDefaultValues%
293
     \@RTExecDefaultValues%
265
 }
294
 }
266
 
295
 
273
   \@compute@yy{#2}
302
   \@compute@yy{#2}
274
   \@compute@xx{#3}
303
   \@compute@xx{#3}
275
   \yyy = \yy \advance \yyy by 2\sy
304
   \yyy = \yy \advance \yyy by 2\sy
276
-  \psline[linecolor=\RTLineColor]{->}(\xx,\yy)(\xx,\yyy)
305
+  \begin{pgfonlayer}{foreground} 
306
+  \draw [\RTLineColor, thick,\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
307
+  \end{pgfonlayer}
277
   \advance \xx by #4\sx
308
   \advance \xx by #4\sx
278
-  \psline[linecolor=\RTLineColor]{->}(\xx,\yyy)(\xx,\yy)
309
+  \begin{pgfonlayer}{foreground} 
310
+  \draw [\RTLineColor, thick,\RTArrowStyle] (\xx,\yyy) -- (\xx,\yy);
311
+  \end{pgfonlayer}
279
   \@RTExecDefaultValues
312
   \@RTExecDefaultValues
280
 }
313
 }
281
 
314
 
288
   \@compute@yy{#2}
321
   \@compute@yy{#2}
289
   \@compute@xx{#3}
322
   \@compute@xx{#3}
290
   \yyy = \yy \advance \yyy by 2\sy
323
   \yyy = \yy \advance \yyy by 2\sy
291
-  \psline[linecolor=\RTLineColor]{<-}(\xx,\yy)(\xx,\yyy)
324
+  \begin{pgfonlayer}{foreground} 
325
+  \draw [\RTLineColor, thick,<-] (\xx,\yy) -- (\xx,\yyy);
326
+  \end{pgfonlayer}
292
   \@RTExecDefaultValues
327
   \@RTExecDefaultValues
293
 }
328
 }
294
 
329
 
298
   \@compute@xx{#3}
333
   \@compute@xx{#3}
299
   \yyy = \yy \advance \yyy by \RTExecHeight\sy
334
   \yyy = \yy \advance \yyy by \RTExecHeight\sy
300
   \@compute@xxx{#4}
335
   \@compute@xxx{#4}
301
-  \psframe[fillstyle=\RTTaskFill,fillcolor=\RTTaskColor,linecolor=\RTLineColor](\xx,\yy)(\xxx,\yyy)
336
+ \draw [fill=\RTTaskColor,\RTTaskFill,draw=\RTLineColor, thick] (\xx,\yy) rectangle (\xxx,\yyy);
302
   \advance \xx by \xxx \xx = .5\xx
337
   \advance \xx by \xxx \xx = .5\xx
303
-  \uput{2pt}[u](\xx,\yy){%
304
-    \usefont{T1}{phv}{m}{n}%
305
-    \fontsize{\RTNumberLabelSize}{\RTNumberLabelSize}%
306
-    \selectfont{\RTExecLabel}%
307
-  }
338
+ \draw (\xx,\yy) node[above, font=\rtfont] {\RTNumberLabelSize \RTExecLabel};%\RTNumberLabelSize
308
   \@RTExecDefaultValues
339
   \@RTExecDefaultValues
309
 }
340
 }
310
-
341
+%
311
 % Task Lock
342
 % Task Lock
312
 % par 1:  task 
343
 % par 1:  task 
313
 % par 2:  time
344
 % par 2:  time
318
   \@compute@yy{#2}
349
   \@compute@yy{#2}
319
   \@compute@xx{#3}
350
   \@compute@xx{#3}
320
   \yyy = \yy \advance \yyy by \sy
351
   \yyy = \yy \advance \yyy by \sy
321
-  \uput{2pt}[u](\xx,\yyy){%
322
-    \usefont{T1}{phv}{m}{n}%
323
-    \fontsize{\RTNumberLabelSize}{\RTNumberLabelSize}%
324
-    \selectfont{L(#4)}%
325
-  }
352
+   \node[above,font=\rtfont] at (\xx , \yyy) {\RTNumberLabelSize L(#4)}; %\RTNumberLabelSize
326
   \@RTExecDefaultValues
353
   \@RTExecDefaultValues
327
 }
354
 }
328
-
329
-% \TaskUnlock
355
+%
356
+% TaskUnlock
330
 % par 1:  task 
357
 % par 1:  task 
331
 % par 2:  time
358
 % par 2:  time
332
 % par 3:  resource
359
 % par 3:  resource
336
   \@compute@yy{#2}
363
   \@compute@yy{#2}
337
   \@compute@xx{#3}
364
   \@compute@xx{#3}
338
   \yyy = \yy \advance \yyy by \sy
365
   \yyy = \yy \advance \yyy by \sy
339
-  \uput{2pt}[u](\xx,\yyy){%
340
-    \usefont{T1}{phv}{m}{n}%
341
-    \fontsize{\RTNumberLabelSize}{\RTNumberLabelSize}%
342
-    \selectfont{U(#4)}%
343
-  }
366
+   \node[above, font=\rtfont] at (\xx , \yyy) {\RTNumberLabelSize U(#4)}; %\RTNumberLabelSize
344
   \@RTExecDefaultValues
367
   \@RTExecDefaultValues
345
 }
368
 }
346
-
347
-% 
369
+%
370
+% Label
348
 % par 1:  number of vertical slot 
371
 % par 1:  number of vertical slot 
349
 % par 2:  time
372
 % par 2:  time
350
 % par 3:  label
373
 % par 3:  label
355
   \@compute@xx{#3}
378
   \@compute@xx{#3}
356
   \yy = -\sy \multiply \yy by #2
379
   \yy = -\sy \multiply \yy by #2
357
   \advance \yy by \hy
380
   \advance \yy by \hy
358
-  \yyy = \yy \advance \yyy by \sy
359
-  \uput{2pt}[u](\xx,\yyy){%
360
-    \psshadowbox{
361
-      \usefont{T1}{phv}{m}{n}%
362
-      \fontsize{\RTNumberLabelSize}{\RTNumberLabelSize}%
363
-      \selectfont{{#4}}}%
364
-  }
381
+  \yyy = \yy \advance \yyy by 2\sy   %\yyy = \yy \advance \yyy by \sy
382
+
383
+  \node[font=\rtfont, fill = white, draw=\RTLineColor, thin,  drop shadow = {color = black}] at (\xx , \yyy) {\RTNumberLabelSize #4}; %\RTNumberLabelSize
365
   \@RTExecDefaultValues
384
   \@RTExecDefaultValues
366
 }
385
 }
367
-
368
-% 
386
+%
387
+% Inherit
369
 % par 1:  higher priority task (from) 
388
 % par 1:  higher priority task (from) 
370
 % par 2:  lower priority task (to)
389
 % par 2:  lower priority task (to)
371
 % par 3:  time
390
 % par 3:  time
376
   \@compute@xx{#4}
395
   \@compute@xx{#4}
377
   \yyy = -3\sy \multiply \yyy by #3 \advance \yyy by \sy
396
   \yyy = -3\sy \multiply \yyy by #3 \advance \yyy by \sy
378
   \advance \yyy by \hy \advance \yyy by -\sy % \RTWindowHeight
397
   \advance \yyy by \hy \advance \yyy by -\sy % \RTWindowHeight
379
-  \psline[linestyle=dashed,linewidth=1.5pt]{->}(\xx,\yy)(\xx,\yyy)
398
+  \begin{pgfonlayer}{foreground} 
399
+  \draw [dashed, thick,\RTArrowStyle] (\xx,\yy) -- (\xx,\yyy);
400
+  \end{pgfonlayer}
380
   \@RTExecDefaultValues
401
   \@RTExecDefaultValues
381
 }
402
 }
382
 
403
 
383
 % 
404
 % 
405
+% Activation
384
 % par 1:  activating task (from) 
406
 % par 1:  activating task (from) 
385
 % par 2:  signal start time 
407
 % par 2:  signal start time 
386
 % par 3:  activated task (to)
408
 % par 3:  activated task (to)
387
 % par 4:  signal arrival time
409
 % par 4:  signal arrival time
388
-%
410
+
389
 \newcommand{\Activation}[5][nocommand=1]{
411
 \newcommand{\Activation}[5][nocommand=1]{
390
   \setkeys{RT}{#1}%
412
   \setkeys{RT}{#1}%
391
   \@compute@yy{#2}
413
   \@compute@yy{#2}
393
   \yyy = -3\sy \multiply \yyy by #4 %\advance \yyy by \sy
415
   \yyy = -3\sy \multiply \yyy by #4 %\advance \yyy by \sy
394
   \advance \yyy by \hy %\advance \yyy by -\sy %\RTWindowHeight
416
   \advance \yyy by \hy %\advance \yyy by -\sy %\RTWindowHeight
395
   \xxx = #5\sx \advance \xxx by \sx
417
   \xxx = #5\sx \advance \xxx by \sx
396
-  \psline[linestyle=dashed,linewidth=1pt]{->}(\xx,\yy)(\xxx,\yyy)
418
+   \begin{pgfonlayer}{foreground} 
419
+  \draw [dashed, thick,\RTArrowStyle] (\xx,\yy) -- (\xxx,\yyy);
420
+   \end{pgfonlayer}
421
+
397
 }
422
 }
398
 
423
 
399
 % 
424
 % 
425
+% RTBox
400
 % par 1:  time1
426
 % par 1:  time1
401
 % par 2:  time2
427
 % par 2:  time2
402
 %
428
 %
404
   \setkeys{RT}{#1}%
430
   \setkeys{RT}{#1}%
405
   \yy = 0cm
431
   \yy = 0cm
406
   \advance \yy by \hy
432
   \advance \yy by \hy
407
-  \yyy = \sy
433
+    \yyy = 0cm  %  \yyy = \sy
408
   \@compute@xx{#2}
434
   \@compute@xx{#2}
409
   \@compute@xxx{#3}
435
   \@compute@xxx{#3}
410
-  \psframe[fillstyle=crosshatch,hatchwidth=.2pt,hatchsep=2pt,hatchcolor=lightgray,linewidth=0pt,framearc=.2](\xx,\yy)(\xxx,\yyy)
436
+   \draw [pattern color=lightgray, draw=\RTLineColor, pattern=crosshatch, rounded corners, thin](\xx,\yy) rectangle (\xxx,\yyy);
411
   \@RTExecDefaultValues
437
   \@RTExecDefaultValues
412
 }
438
 }
413
 
439
 
414
-% %
440
+
441
+
442
+%% %
415
 % % par 1: task
443
 % % par 1: task
416
 % % par 2: first instant (arrival)
444
 % % par 2: first instant (arrival)
417
 % % par 3: second instant (deadline)
445
 % % par 3: second instant (deadline)
426
 %   \pscurve*[linecolor=\RTLineColor]{-}(\xx,\yy)(\xxx,\yy)
454
 %   \pscurve*[linecolor=\RTLineColor]{-}(\xx,\yy)(\xxx,\yy)
427
 %   \@RTExecDefaultValues  
455
 %   \@RTExecDefaultValues  
428
 % }
456
 % }
457
+%
429
 
458
 
459
+
460
+% 
461
+% RowLabel
462
+% par 1:  task
463
+% par 2:  label
464
+%
430
 \newcommand{\RowLabel}[3][nocommand=1]{
465
 \newcommand{\RowLabel}[3][nocommand=1]{
431
   \setkeys{RT}{#1}%
466
   \setkeys{RT}{#1}%
432
   \@compute@yy{#2}
467
   \@compute@yy{#2}
433
   \advance \yy by 1.5\sy
468
   \advance \yy by 1.5\sy
434
   \xx = \RTRowLabelOffset %\advance \xx by \sx
469
   \xx = \RTRowLabelOffset %\advance \xx by \sx
435
-  \uput{4pt}[dl](-\xx,\yy){
436
-    \usefont{T1}{phv}{m}{n}
437
-    \fontsize{\RTTaskLabelSize}{\RTTaskLabelSize}
438
-    \selectfont{#3}
439
-  }%
470
+  \node[below left,font=\rtfont] at (-\xx , \yy) {\RTTaskLabelSize #3};%\RTTaskLabelSize
440
 }
471
 }
441
 
472
 
473
+% 
474
+% TaskExecDelta
475
+% par 1:  task
476
+% par 2:  start time
477
+% par 3:  delta
478
+%
442
 \newcommand{\TaskExecDelta}[4][nocommand=1]{
479
 \newcommand{\TaskExecDelta}[4][nocommand=1]{
443
   \setkeys{RT}{#1}%
480
   \setkeys{RT}{#1}%
444
   \@compute@yy{#2}
481
   \@compute@yy{#2}
445
   \@compute@xx{#3}
482
   \@compute@xx{#3}
446
-  \yyy = \yy \advance \yyy by \RTExecHeight\sy
483
+  \yyy = \yy \advance \yyy by \RTExecHeight \sy
447
   %\@compute@xxx{#4}
484
   %\@compute@xxx{#4}
448
   \xxx = \xx \advance \xxx by #4\sx
485
   \xxx = \xx \advance \xxx by #4\sx
449
-  \psframe[fillstyle=\RTTaskFill,fillcolor=\RTTaskColor,linecolor=\RTLineColor](\xx,\yy)(\xxx,\yyy)
486
+   \draw [fill=\RTTaskColor,\RTTaskFill,draw=\RTLineColor, thick] (\xx,\yy) rectangle (\xxx,\yyy);
450
   \advance \xx by \xxx \xx = .5\xx
487
   \advance \xx by \xxx \xx = .5\xx
451
-  \uput{2pt}[u](\xx,\yy){%
452
-    \usefont{T1}{phv}{m}{n}%
453
-    \fontsize{\RTNumberLabelSize}{\RTNumberLabelSize}%
454
-    \selectfont{\RTExecLabel}%
455
-  }
488
+   \draw (\xx,\yy) node[above, font=\rtfont] {\RTTaskLabelSize \RTExecLabel}; %\RTNumberLabelSize
456
   \@RTExecDefaultValues
489
   \@RTExecDefaultValues
457
 }
490
 }
458
 
491
 
492
+
493
+% 
494
+% TaskRespTime
495
+% par 1:  task
496
+% par 2:  start time
497
+% par 3:  finish time
498
+%
459
 \newcommand{\TaskRespTime}[4][nocommand=1]{
499
 \newcommand{\TaskRespTime}[4][nocommand=1]{
460
   \setkeys{RT}{#1}
500
   \setkeys{RT}{#1}
461
   \@compute@yy{#2}
501
   \@compute@yy{#2}
462
   \@compute@xx{#3}
502
   \@compute@xx{#3}
463
   \yyy = \yy \advance \yyy by \sy  
503
   \yyy = \yy \advance \yyy by \sy  
464
   \xxx = \xx \advance \xxx by #4\sx
504
   \xxx = \xx \advance \xxx by #4\sx
465
-  \psframe[fillstyle=crosshatch*,hatchcolor=white,
466
-  hatchwidth=.4pt,hatchsep=1pt,
467
-  linestyle=none,fillcolor=\RTTaskColor](\xx,\yy)(\xxx,\yyy)
505
+  \draw [pattern color=\RTTaskColor,draw=\RTLineColor, pattern=crosshatch, thin] (\xx,\yy) rectangle (\xxx,\yyy);
468
   \@RTExecDefaultValues
506
   \@RTExecDefaultValues
469
 }
507
 }
470
 
508
 
509
+
471
 \@ifclassloaded{beamer}{
510
 \@ifclassloaded{beamer}{
472
   \renewcommand<>{\TaskArrival}[3][nocommand=1]{
511
   \renewcommand<>{\TaskArrival}[3][nocommand=1]{
473
     \only#4{\beameroriginal{\TaskArrival}[#1]{#2}{#3}}
512
     \only#4{\beameroriginal{\TaskArrival}[#1]{#2}{#3}}
511
 }
550
 }
512
 {\typeout{beamer not loaded}}
551
 {\typeout{beamer not loaded}}
513
 
552
 
514
-\endinput
553
+\endinput
554
+

Loading…
Cancel
Save