summaryrefslogtreecommitdiff
path: root/graphics/ecgdraw/ecgdraw.dtx
blob: fd1504cca6c3f3676da17094b791a94142ab6434 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
% \iffalse
%<*system>
\begingroup
\input docstrip.tex
\keepsilent
\preamble
________________________________________
A package to draw ECG.
Copyright (C) 2016 Marco Scavino and Ezio Aimé
All rights reserved
License information appended
\endpreamble
\postamble
Copyright 2016

Distributable under the LaTeX Project Public License,
version 1.3c or higher (your choice). The latest version of
this license is at: http://www.latex-project.org/lppl.txt
This work is "author-maintained"
This work consists of this file ECG.dtx,
and the derived files ECG.sty, archivio.tex and ECG.pdf.
\endpostamble
\askforoverwritefalse
%
\generate{
	\file{ecgdraw.sty}{\from{ecgdraw.dtx}{package}}
	\file{archivio.tex}{\from{ecgdraw.dtx}{archivio}}}
%
\def\tmpa{plain}
\ifx\tmpa\fmtname\endgroup\@xp\bye\fi
\endgroup
%</system>
% \fi
%
% \iffalse
%<*package>
\NeedsTeXFormat{LaTeX2e}[2009/01/01]
\ProvidesPackage{ecgdraw}[2016/06/29 v.1.0 Draw ECG]
%</package>
%<*driver>
\documentclass[dvipsnames, a4paper]{ltxdoc}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern,textcomp}
\usepackage[english]{babel}
\usepackage{layaureo}
\usepackage{ecgdraw}
\usepackage[colorlinks,linkcolor=MidnightBlue]{hyperref}
\usepackage{listings}
\usepackage{hyperref}
\hypersetup{linkcolor=red}
\def\TikZ{\textsf{TikZ}}
\def\env#1{\texttt{#1}}
\def\pkg#1{\textsf{#1}}
\RecordChanges
\CodelineIndex\EnableCrossrefs
\begin{document}
\GetFileInfo{ecgdraw.sty}
\title{\textsf{ecgdraw} package\thanks{Version \fileversion; last revision \filedate.}}
\author{Marco Scavino\thanks{e-mail: \texttt{scavino dot marco93 at gmail dot com}} and Ezio Aimé\thanks{e-mail: \texttt{ezio dot aime at fastwebnet dot it}}}
\maketitle
\DocInput{ecgdraw.dtx}
\end{document}
%</driver>
% \fi
%
%
% \CheckSum{503}
% \changes{v0.1}{2015/09/04}{Initial version}
% \changes{v0.1}{2015/12/05}{New keys |ECG title| and |ECG title align|}
%
% \begin{abstract}
% This package was born to create fake elettrocardiograms, thanks to \TikZ package and \LaTeX3 bundle.
% \end{abstract}
% \tableofcontents
% \section{Introduction}
% To work correctly \textsf{ecgdraw} package are needed
% \begin{itemize}
% 	\item \TikZ package,
% 	\item \LaTeX3 bundle.
% \end{itemize}
%
%
% \section{Use}
%
% \begin{macro}{ecg}
% The package defined |ecg| environment with a optional argument \oarg{options}
% \begin{center}
% |\begin{ecg}| \oarg{options}
% ECG path
% |\end{ecg}|
% \end{center}
% where \meta{options} are \pkg{TikZ} keys. Inside the environment it's possible to draw a ECG thanks the |\ECG| macro
% \begin{center}
% |\ECG| \oarg{TikZ options} \parg{vertical position} \marg{ECG waves}
% \end{center}
% \end{macro}
% The macro have an optional argument \oarg{options}, that accepts Tikz options, an optional argument delimeted by brace \parg{vertical position}, vertical position of the path, and a mandatory argument \marg{ECG waves} which contain the list of ECG waves abbreviation.
%
% Each abbreviation is made of different part:
% \begin{center}
% |\ECG {| \oarg{options} \marg{wave name} \meta{other} |}|
% \end{center}
% \meta{options} aregiven to the single wave, \meta{wave name} is the abbreviation of the wave, while \meta{other} depends on the types of wave.
%
% \subsection{Waves}
% Different wave types are possible:
% \begin{macro}{p}
% |p| wave needs \meta{polarity} (allowed value |p|, |n|), wave height \meta{tenths of millivolts} (between 0.1-0.3 mV) and time \meta{milliseconds}.
% \begin{center}
% |p| \meta{polarity} |0| \meta{tenths of millivolts} \meta{milliseconds}
% \end{center}
% Bifasich wave with |d| and |b| polarity is needed a second wave
% \begin{center}
% |p| \meta{polarity} \meta{first tenths millivolts} \meta{second tenths millivolts} \meta{milliseconds}
% \end{center}
% \end{macro}
% \begin{macro}{q,r,s}
% Waves for QRS complex. Thei take as first argument wave height in millivolts and as second argument the duration in milliseconds.
% \begin{center}
% |q/r/s| \marg{wave height Q/R/S} \meta{milliseconds}
% \end{center}
% \end{macro}
% \begin{macro}{i}
% Isoelettric wave, take only one argument, which is time in \meta{milliseconds}.
%\begin{center}
%	|i| \meta{milliseconds}
%\end{center}
% \end{macro}
% \begin{macro}{t}
% First argument is \meta{polarity}, positive |p| or negative |n|, second argument is \meta{tenth of milliVolts}, as optional argument a correction if wave isn't simmetrical and last argument \meta{milliseconds}.
%\begin{center}
%	|t| \meta{polarity} \meta{tenth of milliVolts} \oarg{correction} \meta{milliseconds}
%\end{center}
% \end{macro}
% \begin{macro}{!}
% Allow to use a wave defined through |\newECG| macro.
%\begin{center}
%	|!| \meta{wave name}
%\end{center}
% \end{macro}
% \begin{macro}{?}
% Insert a label left to the path. Optional argument (default value |1 cm|) set horizontal shift.
%\begin{center}
%	|?| \oarg{horizontal shift} \meta{text}
%\end{center}
% \end{macro}
% \subsection{Options}
% \subsubsection{Grid}
% |ecg| environment accept different options to modify grid dimension.
% \begin{macro}{grid top}
% Accept a dimension as value. Grid is elarged toward top of the set value.
% \end{macro}
% \begin{macro}{grid bottom}
% Similar to |grid top|, but grid is enlarged toward bottom.
% \end{macro}
% \begin{macro}{grid left}
% Similar to |grid top|, but grid is enlarged toward left.
% \end{macro}
% \begin{macro}{grid right}
% Similar to |grid top|, but grid is enlarged toward right.
% \end{macro}
% \begin{macro}{grid border}
% Set bottom, top, left and right with the same \meta{value}.
% \end{macro}
% \subsection{Break ECG path}
% Sometimes ECG are too much wide and cannot fit the textwidth. So it's possible to allow \LaTeX{} to break ECG using the |breaklines| key.
% \begin{macro}{breaklines}\begin{macro}{breakindent}
% This key allow automate wrap ECG pattern. New line has an indent of |breakindent| value (default 1~cm).
% \end{macro}\end{macro}
% \subsection{ECG title}
% \begin{macro}{ECG title}\begin{macro}{ECG title align}
% I's possible to insert a ECG title by |ECG title| and set title align by |ECG title align| key (value |righ|, |left|, |center|).
% \end{macro}\end{macro}
% \subsection{Wave database}
% |\newECG| macro add a custom wave
% \begin{center}
% |\newECG| \marg{wave name} \marg{wave code}
% \end{center}
% It's possible to call \meta{wave name} inside |\ECG| using the key |!|.
% \StopEventually{}
%
% \iffalse
% \section{ECG implementation}
%
%<*package>
% Prima carichiamo i pacchetti \TikZ{} e \textsf{xparse}.
%    \begin{macrocode}
\RequirePackage{tikz}
\RequirePackage{xparse}

\usetikzlibrary{calc}
%    \end{macrocode}

% Questo è necessario per definire un nuovo livello. \pkg{pgf} può gestire più livelli, e questo risulta comodo per sovrappore oggetti collocandoli su livelli diversi. Nel caso definisco il livello |sk@back| e lo colloco dietro a quello principale (qui indicato da |main|).
%    \begin{macrocode}
\pgfdeclarelayer{sk@back}
\pgfsetlayers{sk@back,main}
\ExplSyntaxOn
%    \end{macrocode}

% Definisco alcune chiavi da passare all'ambiente \env{ecg}. Nello specifico permettono di gestire quanto la griglia sottostante sborda rispetto ai tracciati. grid border imposta lo stesso valore a tutti i lati (di default .2~cm) mentre le altre chiavi impostano lo spessore del rispettivo lato. Il booleano |\sk_ECG_breaklines_bool| serve per gestire i tracciati, abilitando o disabilitando la cesura automatica a fine riga.
%    \begin{macrocode}
\bool_new:N \sk_ECG_breaklines_bool
\bool_new:N \sk_ECG_breaklines_arrow_bool

\tikzset {
  breakindent / .store ~ in = \sk_ECG_breakindent_tl ,
  breakindent = 1cm,
  breaklines / .is ~ choice,
  breaklines / true / .code = \bool_set_true:N \sk_ECG_breaklines_bool ,
  breaklines / false / .code = \bool_set_false:N \sk_ECG_breaklines_bool ,
  breaklines / arrow / .code =
  	\bool_set_true:N \sk_ECG_breaklines_bool 
  	\bool_set_true:N \sk_ECG_breaklines_arrow_bool ,
  breaklines / no ~ indent /.code =
  	\bool_set_true:N \sk_ECG_breaklines_bool
  	\tl_set:Nn \sk_ECG_breakindent_tl { 0 } ,
  breaklines / .default = true,
  breaklines = false,
  ECG ~ title / .store ~ in = \sk_ECG_title_tl,
  ECG ~ title  = {},
  ECG ~ title ~ align / .is~choice ,
  ECG ~ title ~ align / center / .code = \tl_set:Nn \sk_ECG_title_align_tl { north } \tl_set:Nn \sk_ECG_title_anchor_tl { south } ,
  ECG ~ title ~ align / right / .code = \tl_set:Nn \sk_ECG_title_align_tl { north ~ east } \tl_set:Nn \sk_ECG_title_anchor_tl { south ~ east } ,
  ECG ~ title ~ align / left / .code = \tl_set:Nn \sk_ECG_title_align_tl { north ~ west } \tl_set:Nn \sk_ECG_title_anchor_tl { south ~ west } ,
  ECG ~ title ~ align = left ,
  grid ~ border / .code =
    \tl_set:Nn \sk_ECG_gridtp_tl { #1 }
    \tl_set:Nn \sk_ECG_gridlf_tl { #1 }
    \tl_set:Nn \sk_ECG_gridrg_tl { #1 }
    \tl_set:Nn \sk_ECG_gridbt_tl { #1 },
  grid ~ top / .store ~ in = \sk_ECG_gridtp_tl,
  grid ~ bottom / .store ~ in = \sk_ECG_gridbt_tl,
  grid ~ left / .store ~ in = \sk_ECG_gridlf_tl,
  grid ~ right / .store ~ in = \sk_ECG_gridrg_tl,
  grid ~ border = .2cm,
}
%    \end{macrocode}

% Nuovo booleano che permette di comprendere se siamo alla prima onda o no. Di base impostato su falso.
%    \begin{macrocode}
\bool_new:N \sk_ECG_start_bool
%    \end{macrocode}

% Viene definito il comando |\ECG| che prende due argomenti: uno opzionale |O{}| (che di default non ha nulla) e uno obbligatorio m. L'opzionale rappresenta le opzioni di \TikZ passate poi al comando |\draw[]| (come i comandi per il colore). L'obbligatorio invece è la lista di onde che va poi processata
%    \begin{macrocode}
\DeclareDocumentCommand \ECG { O{} m }
  {
  \begin{tikzpicture}
  \coordinate(sk_end) at (0,0);
  \sk_ECG:nn { #1 } { #2 }
  \end{tikzpicture}
  }
%    \end{macrocode}

% Sempre analogo del comando |\ECG|, ma pensato per funzionare dentro all'ambiente ecg. Questa versioni infatti non apre ne chiude l'ambiente tikzpicture. Inoltre, oltre ai due precedenti comandi, si introduce il comando facoltativo racchiuso tra parentesi tonde, che permette di collocare il traccaito all'altezza voluta. Il sistema con |\sk_ECG_yshift_dim| toglie per ogni comando |\ECG| 2.5~cm in modo che il successivo comando (se non viene specificato un valore tra parentesi) sia collocato sotto il precedente.
%    \begin{macrocode}
\cs_set_nopar:Npn \sk_ECG_env:nnn #1 #2 #3
{
  \tl_if_empty:nTF { #2 }
      { \coordinate(sk_end) at (0,\sk_ECG_yshift_dim);  }
      { \coordinate(sk_end) at (#2); }
  \sk_ECG:nn { #1 } { #3 }
  \dim_set:Nn \sk_ECG_yshift_dim { \sk_ECG_yshift_dim - 2.5cm }
}
%    \end{macrocode}

% Definisco la dimensione per lo spostamento in verticale dei vari tracciati. Inoltre definisco due contatori per la numerazione di tutte le onde, uno per il tracciato e uno per l'onda.
%    \begin{macrocode}
\dim_new:N \sk_ECG_yshift_dim
\dim_new:N \sk_ECG_x_dim
\int_new:N \sk_ECG_row_int
\int_new:N \sk_ECG_wave_int
%    \end{macrocode}

% Ambiente \env{ecg}. Il suo scopo è permettere di disegnare più tracciati, e collocarci dietro una griglia millimetrata. Inanzitutto azzero il valore dell'altezza per partire nuovamente da zero (non sarebbe necessario, ma per scrupolo è meglio azzerare comunque). Imposto poi che il comando |\ECG| accetti un argomento opzionale tra parentesi quadre, uno opzionale tra tonde e uno obbligatorio. Passo tutto a |\sk_ECG_env:nnn|. Apro l'ambiente \env{tikzpicture}. La versione asteriscata non utilizza l'ambiente \env{center}.
%    \begin{macrocode}
\DeclareDocumentEnvironment { ecg } { O{} }
{
  \int_zero:N \sk_ECG_row_int
  \int_zero:N \sk_ECG_wave_int
  \dim_zero:N \sk_ECG_yshift_dim
  \DeclareDocumentCommand \ECG { O{} D(){} m }
  {
    \dim_zero:N \sk_ECG_x_dim
    \int_incr:N \sk_ECG_row_int
    \sk_ECG_env:nnn { ##1 } { ##2 } { ##3 }
  }
  \begin{center}
  \begin{tikzpicture}[#1]
}
%    \end{macrocode}

% L'ambiente \env{pgfonlayer} permette di selezionare su quale livello porre la nostra griglia millimetrata. Affinché si adatti automaticamente ai tracciati sfrutto un nodo di \pkg{TikZ} speciale: current bounding box, le cui dimensioni sono proprio le attuali dimensioni del disegno \pkg{TikZ}. Sfrutto quindi due ancore del nodo |current bounding box|: quella in altro a destra (ancora |north east|) e in basso a sinistra (ancora |south west|). Le chiavi |xshift| e |yshift| permettono di traslare il punto dei valori passati (quelli impostati con le varie chiavi |border|). In tal modo sono definiti due nodi |sk_start| e |sk_stop| che definiscono i vertici in alto a destra e in basso a sinistra della griglia, che sarà semplicemente disegnata con grid e i settaggi desiderati (colore e step). Il tutto, grazie all'ambiente \env{pfgonlayer}, posto automaticamente sullo sfondo.
%    \begin{macrocode}
{
  \tl_if_empty:NF \sk_ECG_title_tl
      { \node at (current ~ bounding ~ box.\sk_ECG_title_align_tl) [inner ~ sep=\c_zero_dim,anchor=\sk_ECG_title_anchor_tl] {\sk_ECG_title_tl}; }
  \begin{pgfonlayer}{sk@back}
    \coordinate(grid_start) at ([xshift=-\sk_ECG_gridlf_tl,
      yshift=-\sk_ECG_gridbt_tl] current ~ bounding ~ box. south ~ west);
    \coordinate(grid_stop) at ([xshift=\sk_ECG_gridrg_tl,
      yshift=\sk_ECG_gridtp_tl] current ~ bounding ~ box.north ~ east);
    \draw[color=red!20,step=0.1cm,very ~ thin]
      (grid_start) grid (grid_stop);
    \draw [color=red!50,step=.5cm](grid_start)grid(grid_stop);
    \end{pgfonlayer}
  \end{tikzpicture}
  \end{center}
}

% L'ambiente \env{ecg*} è definito in modo simile a \env{ecg}, ma non allinea al centro il grafico.
%    \begin{macrocode}
\DeclareDocumentEnvironment { ecg* } { O{} }
{
  \int_zero:N \sk:ECG_row_int
  \int_zero:N \sk:ECG_wave_int
  \dim_zero:N \sk_ECG_yshift_dim
  \DeclareDocumentCommand \ECG { O{} D(){} m }
  {
    \dim_zero:N \sk_ECG_x_dim
    \int_incr:N \sk_ECG_row_int
    \sk_ECG_env:nnn { ##1 } { ##2 } { ##3 }
  }
  \begin{tikzpicture}[#1]
}
{
  \tl_if_empty:NF \sk_ECG_title_tl
    { \node at (current ~ bounding ~ box.\sk_ECG_title_align_tl) {\sk_ECG_title_tl}; }
  \begin{pgfonlayer}{sk@back}
    \coordinate(grid_start) at ([xshift=-\sk_ECG_gridlf_tl,
      yshift=-\sk_ECG_gridbt_tl] current ~ bounding ~ box. south ~ west);
    \coordinate(grid_stop) at ([xshift=\sk_ECG_gridrg_tl,
      yshift=\sk_ECG_gridtp_tl] current ~ bounding ~ box.north ~ east);
    \draw[color=red!20,step=0.1cm,very ~ thin]
      (grid_start) grid (grid_stop);
    \draw [color=red!50,step=.5cm](grid_start)grid(grid_stop);
    \end{pgfonlayer}
  \end{tikzpicture}
}
%    \end{macrocode}

% Definisce una nuova sequence. È un costrutto speciale di \LaTeX3 che permette di gestire dei dati.
%    \begin{macrocode}
\seq_new:N \sk_ECG_seq
%    \end{macrocode}

% Dopo aver svuotato la token listi delle onde e la sequence (e settato a vero il booleano di onda iniziale) si suddivide la lista di onde rispetto alle virgole (il secondo argomento di |\seq_set_split:Nnn|) e si salva nella sequence. Il comando |\seq_map_inline:Nn| passa poi ogni singolo elemento della sequence al suo argomento come |##1| (l'argomento |#1| sono le opzioni \env{TikZ}).
%    \begin{macrocode}
\cs_set_nopar:Npn \sk_ECG:nn #1 #2
{
  \tl_clear:N \sk_ECG_onda_tl
  \seq_clear:N \sk_ECG_seq
  \bool_set_true:N \sk_ECG_start_bool
  \seq_set_split:Nnn \sk_ECG_seq { , } { #2 }
  \seq_map_inline:Nn \sk_ECG_seq { \sk_ECG_use:w ##1 \q_nil { #1 } }
}
%    \end{macrocode}

% Macro che processa ogni singola onda: prende 4 argomenti.
% \begin{enumerate}
% \item Il primo opzionale sono eventuali opzioni per una singola onda (pensato principalemente per colorare una singola onda, magari per evidenziarla). Viene passato insieme a |#4| (che rappresenta le opzioni globali del tracciato), alle opzioni di |\draw|, che è salvato nella token list |\sk_ECG_onda_tl|. Il comando |\draw| è impostato con le chiavi osservabili. Lo shift pone il punto zero nell'ultimo node |sk_end|. Al termine, prima di espandere la token list (e rendere effettivo il disegno \pkg{TikZ}), si aggiorna la posizione del nodo |sk_end| e si chiude |\draw| con il punto e virgola necessario.
% \item Il secondo è la prima lettera della sigla. Viene passato al comando |\str_case:nn| che lo confronta con tutte quelle presenti e usa quella che coincide con il codice corrente.
% \item Il terzo è un argomento delimitato, ossia anche se non sono presenti tonde, il comando raccoglie tutto ciò che trova fino al delimitatore (in questo caso il mark |\q_nil|). Permette di scrivere indipendentemente costrutti come |!{nome}| o |!nome| e ottenere il medesimo risultato. Il comando viene poi passato alle macro interne selezionate dalla prima lettera dell'onda.
% \end{enumerate}
%    \begin{macrocode}
\DeclareDocumentCommand \sk_ECG_use:w { O{} m u\q_nil m }
{
  \int_incr:N \sk_ECG_wave_int
  \tl_set:Nn \sk_ECG_onda_tl
    { \draw[thick,rounded ~ corners=0.25mm,line ~ cap=round, shift=(sk_end),
    #4,#1] }
  \str_case:nn { #2 }
    {
      { ! } { \tl_put_right:Nx \sk_ECG_onda_tl
        {
          \cs_if_exist_use:cF { sk_ECG_ #3 } { (0,0) }
        } }
      { ? } { \sk_ECG_onda_label:w #3 \q_nil }
      { i } { \sk_ECG_onda_iso:w #3 \q_nil }
      { p } { \sk_ECG_onda_p:nnnw #3 \q_nil }
      { q } { \sk_ECG_onda_q:nw #3 \q_nil }
      { r } { \sk_ECG_onda_r:nw #3 \q_nil }
      { s } { \sk_ECG_onda_s:nw #3 \q_nil }
      { t } { \sk_ECG_onda_t:nw #3 \q_nil }
      { T } { \tl_put_right:Nx \sk_ECG_onda_tl
        { (0,0) -- (.1cm,0) -- (.1cm,#3*1cm) -- (.5cm,#3*1cm) -- (.5,0)
        -- (1,0) } }
      { * } { \int_decr:N \sk_ECG_wave_int \sk_ECG_onda_ripeti:nw #3 \q_nil { #4 }  \tracingmacros=0}
    }
  \tl_put_right:Nn \sk_ECG_onda_tl { coordinate (sk_end)
    let \p1=(current ~ path ~ bounding ~ box.south ~ west),
    \p2=(current ~ path ~ bounding ~ box.north ~ east)
    in ~
    node (ecg-\int_use:N \sk_ECG_row_int-\int_use:N \sk_ECG_wave_int)
       [at=(current ~ path ~ bounding ~ box),text ~ width=\x2-\x1,text ~ height=\y2-\y1]{}
   ; }
  
  \str_if_eq:nnF { #2 } { * } { \sk_ECG_onda_tl }
  \bool_if:NT \sk_ECG_breaklines_bool
    { \pgfgetlastxy{\sk_ECG_lastx_tl}{\sk_ECG_lasty_tl}
  \dim_set:Nn \l_tmpa_dim
    { \textwidth - \sk_ECG_gridlf_tl - \sk_ECG_gridrg_tl - \sk_ECG_lastx_tl }
  \dim_compare:nT { \l_tmpa_dim < 1.5cm }
    {
      \dim_zero:N \sk_ECG_x_dim
      \dim_set:Nn \sk_ECG_yshift_dim { \sk_ECG_yshift_dim - 2.5cm }
      \coordinate(sk_end) at (\sk_ECG_breakindent_tl,\sk_ECG_yshift_dim);
      \bool_if:NT \sk_ECG_breaklines_arrow_bool {
      \draw[thick,<-,rounded ~ corners]([xshift=-.25cm]sk_end) -| ++ (-.5cm,1.5cm); }
    } }
  \bool_if:NT \sk_ECG_start_bool { \bool_set_false:N \sk_ECG_start_bool }
}
%    \end{macrocode}

% Nel caso in cui il primo elemento sia |*|, vengono poi cercati due argomenti: il primo è il numero di ripetizioni, il secondo la lista di onde. Il comando |\prg_replicate:nn| si occupa di ripetere per |#1| volte il comando |\sk_ECG:nn{#3}{#2}|, dove |#3| sono le opioni globali del tracciato, e |#2| la lista di onde da ripetere
%    \begin{macrocode}
\cs_set_nopar:Npn \sk_ECG_onda_ripeti:nw #1 #2 \q_nil #3
{
\group_begin:
  \prg_replicate:nn { #1 } { \sk_ECG:nn { #3 } { #2 } }
\group_end:
}
%    \end{macrocode}

% Se il primo elemento è |?|, si cerca un argomento opzionale (di default posto a .5~cm) e poi uno delimitato (il testo dell'etichetta). L'etichetta viene quindi salvata nella token list e posta al punto |(#1,0)| e l'allineamento del nodo deciso in base al booleano |\sk_ECG_start_bool|: se infatti è vero (siamo all'inizio del tracciato) l'etichetta è allineata a sinistra, altrimenti a destra.
%
%|#2| Decide quale derivazione usare in base alla sigla e nell'eventualità non sia prevista, viene stampato come appare. L'utilizzo dei nodi |sk_deriv| serve per posizionare correttamente il tracciato successivo e impedire la sovrapposizione di questo all'etichetta. Inoltre esso permette lo spostamento automatico del tracciato  (tiene conto infatti della larghezza dell'etichetta).
%    \begin{macrocode}
\DeclareDocumentCommand \sk_ECG_onda_label:w { O{.5cm} u\q_nil }
{
  \tl_put_right:Nx \sk_ECG_onda_tl { (#1,0) node [
  \bool_if:NTF \sk_ECG_start_bool
   { left }
   { right }
  ,name=sk_deriv] 
  { \str_case:nnF { #2 }
  {
   { d1 } { I }
   { d2 } { II }
   { d3 } { III }
   { vr } { aVR }
   { vl } { aVL }
   { vf } { aVF }
   { v1 } { V1 }
   { v2 } { V2 }
   { v3 } { V3 }
   { v4 } { V4 }
   { v5 } { V5 }
   { v6 } { V6 }
  } { #2 } } ; \exp_not:N \path(sk_deriv.east) }
}
%    \end{macrocode}

% Macro associata alla lettera |i|. L'argomento |#1| viene controllato (se uguale a |k| viene sostituito da |1000|) e poi usato per la lunghezza del tratto.
%    \begin{macrocode}
\cs_set_nopar:Npn \sk_ECG_onda_iso:w #1 \q_nil
{
  \tl_put_right:Nx \sk_ECG_onda_tl
  { (0,0) -- ( 0.025 mm *
    \str_if_eq:nnTF { k } { #1 }
      { 1000 }
      { #1 }
   ,0) }
}
%    \end{macrocode}

% Onda Q, il primo argomento è l'altezza, il secondo la durata. Sono moltiplicati per i fattori correttivi affinché corrispondano con i millisecondi e i millimetri.
%    \begin{macrocode}
\cs_set_nopar:Npn \sk_ECG_onda_q:nw #1 #2 \q_nil
{
  \tl_put_right:Nn \sk_ECG_onda_tl {
  (0,0)--(#1*.0125cm,-#2*.1cm)--(#1*.025cm,0) }
}
%    \end{macrocode}

% Onda R: come l'onda Q.
%    \begin{macrocode}
\cs_set_nopar:Npn \sk_ECG_onda_r:nw #1 #2 \q_nil
{
  \tl_put_right:Nn \sk_ECG_onda_tl
    { (0,0) -- (#1*.0125cm,#2*.1) -- (#1*.025cm,0) }
}
%    \end{macrocode}

% Onda S: come l'onda Q.
%    \begin{macrocode}
\cs_set_nopar:Npn \sk_ECG_onda_s:nw #1 #2 \q_nil
{
  \tl_put_right:Nn \sk_ECG_onda_tl
    { (0,0)--(#1*0.0125cm-0.005cm,-#2*.1cm)--(#1*0.025cm,0) }
}
%    \end{macrocode}

% Onda T. |#1| indica se è positiva o negativa (dobbiamo aggiungere la difasica). |#2| sono i millisecondi e |#3| i millimetri.
%    \begin{macrocode}
\cs_set_nopar:Npn \sk_ECG_onda_t:nw #1 #2 #3\q_nil
{
  \str_case:nn { #1 }
  {
    { p }
    { \tl_put_right:Nn \sk_ECG_onda_tl
      { (0,0) .. controls (#2*.0625cm,.05cm) and (#2*.075cm,#3*.065cm)
      .. (#2*.112cm,#3*.1cm) -- (#2*.138cm,#3*.09cm) .. controls
      (#2*.175cm,#3*.065cm) and (#2*.188cm,.05) .. (#2*.25cm,0) }
    }
    { n }
    { \tl_put_right:Nn \sk_ECG_onda_tl
      { (0,0) .. controls (#2*.0625cm,-.05cm) and (#2*.075cm,-#3*.065cm) ..
      (#2*.112cm,-#3*.1cm) -- (#2*.138cm,-#3*.09cm) ..
      controls (#2*.175cm,-#3*.065cm) and (#2*.188cm,-.05) .. (#2*.25cm,0) }
    }
  }
}
%    \end{macrocode}

% Onda P. In modo simile all'onda T, |#1| distingue tra le varie |p|, |n|, |d| e |b|. |#2| e |#3| sono le altezze dei due picchi, |#4| la durata in millisecondi.
%    \begin{macrocode}
\cs_set_nopar:Npn \sk_ECG_onda_p:nnnw #1 #2 #3 #4 \q_nil
{
  \tl_put_right:Nx \sk_ECG_onda_tl { \str_case:nn { #1 }
  {
    { p } { (0,0) -- (.0005*#4,#2#3*.06) -- (.0011*#4,#2#3*.1) --
    (.002*#4,#2#3*.06) -- (.0025*#4,.0) }
    { n } { (0,0) -- (.0005*#4,-#2#3*.06) -- (.0011*#4,-#2#3*.1) --
    (.002*#4,-#2#3*.06) -- (.0025*#4,.0) }
    { d } { (0,0) -- (.01cm,.005cm)
    --  (#4*0.3333-.01cm,#2*.1cm-.008cm)
    -- (#4*0.3333+.01cm,#2*.1cm-.008cm)
    --  (#4*0.6667-.01cm,-#3*.1cm+.008cm)
    -- (#4*0.6667+.01cm,-#3*.1cm+.008cm)
    -- (#4-.01cm,.005cm)
    -- (#4,0) }
    { b } { (0,0) -- (.01cm,.005cm)
    --  (#4*1/3-.01cm,#2*0.045cm+.105cm)
    -- (#4*1/3+.01cm,#2*0.045cm+.105cm)
    -- (#4*1/2-.01cm,.1cm)
    -- (#4*1/2+.01cm,.1cm)
    -- (#4*2/3-.01cm,#3*0.045cm+.105cm)
    -- (#4*2/3+.01cm,#3*0.045cm+.105cm)
    -- (#4-.01cm,.005cm)
    -- (#4,0) }
  } }
}
%    \end{macrocode}

% Il comando |\msg_new:nnn| definisce un messaggio da stampare nel log. Nel caso specifico serve per avertire che la sigla scelta è già utilizzata per un altra onda.
%    \begin{macrocode}
\msg_new:nnn { ECG } { wave ~ defined }
  { wave ~ "#1" ~ already ~ defined. ~ Change ~ name. }
%    \end{macrocode}

% Definisco una nuova onda con sigla |#1| e codice |#3| (il |#2| è codice opzionale, lo messo nel caso volessimo aggiungere funzionalità a questo comando). Nel caso di onda già definita stampa un avvertimento e non rinomina la precendete.
%    \begin{macrocode}
\cs_set_nopar:Npn \sk_ECG_new:nn #1 #2 #3
{
  \cs_if_exist:cTF { sk_ECG_ #1 }
    { \msg_warning:nnn { ECG } { wave ~ defined } { #1 } }
    { \cs_set_nopar:cpn { sk_ECG_ #1 } { #3 } }
}
%    \end{macrocode}

% Interfaccia con l'utente per definire nuove onde nel database. |#1| è obbligatorio e contiene il nome dell'onda, |#2| opzionale (come scritto sopra in previsione di futuri sviluppi) e |#3| è il codice \pkg{TikZ}.
%    \begin{macrocode}
\DeclareDocumentCommand \nuovoECG { m O{} m }
{
  \sk_ECG_new:nn { #1 } { #2 } { #3 }
}
%    \end{macrocode}

% Messaggio nel caso di archivio non trovato
%    \begin{macrocode}
\msg_new:nnn { ECG } { fnotf }
  { File ~ “#1” ~ not ~ found. ~ Please ~ check ~ your ~ installation.}
%    \end{macrocode}

% Include l'achivio delle onde se presente, altrimente avverte l'utente che il file è assente.
%    \begin{macrocode}
\file_if_exist:nTF { archivio }
  { \file_input:n { archivio } }
  { \msg_warning:nnn { ECG } { fnotf } { archivio } }

\ExplSyntaxOff
%    \end{macrocode}
%
%</package>
%
%
% \section{Archivio delle onde}
%
%<*archivio>
%
%    \begin{macrocode}
\ProvidesFile{archivio}[2015/08/31 v.1.0 Draw ECG]
%    \end{macrocode}
% Etichette delle derivazioni
%    \begin{macrocode}
\nuovoECG{d1}{(1cm,0)node[left]         {I}} 
\nuovoECG{d2}{(1cm,0)node[left]{II}} 
\nuovoECG{d3}{(1cm,0)node[left]{III}} 
\nuovoECG{vr}{(1cm,0)node[left]{aVR}} 
\nuovoECG{vl}{(1cm,0)node[left]{aVL}} 
\nuovoECG{vf}{(1cm,0)node[left]{aVF}} 
\nuovoECG{v1}{(1cm,0)node[left]{V1}} 
\nuovoECG{v2}{(1cm,0)node[left]{V2}} 
\nuovoECG{v3}{(1cm,0)node[left]{V3}} 
\nuovoECG{v4}{(1cm,0)node[left]{V4}} 
\nuovoECG{v5}{(1cm,0)node[left]{V5}} 
\nuovoECG{v6}{(1cm,0)node[left]{V6}} 
%    \end{macrocode}

% Comando per la tara.
%    \begin{macrocode}
\nuovoECG{tara}{(0,0)--(.1,0)--(.1,1)--(.5,1)--(.5,0)--(1,0)}
%    \end{macrocode}

% Onde P positive (pp) di ampiezza da 0.1 a 0.3~mVolt x 60, 80 e 100 msec
%    \begin{macrocode}
\nuovoECG{pp0160}{(0,0)--(.04,.06)--(.085,.1)--(.12,.06)--(.15,.0)}
\nuovoECG{pp0260}{(0,0)--(.02,.1)--(.085,.2)--(.13,.1)--(.15,.0)}
\nuovoECG{pp0360}{(0,0)--(.04,.2)--(.085,.3)--(.12,.2)--(.15,.0)}
\nuovoECG{pp0180}{(0,0)--(.04,.06)--(.09,.1)--(.14,.06)--(.2,.0)}
\nuovoECG{pp0280}{(0,0)--(.02,.1)--(.09,.2)--(.15,.1)--(.2,.0)}
\nuovoECG{pp0380}{(0,0)--(.04,.2)--(.09,.3)--(.14,.2)--(.2,.0)}
\nuovoECG{pp0199}{(0,0)--(.1,.08)--(.15,.1)--(.2,.08)--(.25,.0)}
\nuovoECG{pp0299}{(0,0)--(.1,.16)--(.15,.2)--(.2,.16)--(.25,.0)}
\nuovoECG{pp0399}{(0,0)--(.1,.2)--(.15,.3)--(.2,.2)--(.25,.0)}
%    \end{macrocode}

% onde P negative (pn) di ampiezza da 0.1 a 0.3 mVolt x 60, 80 e 100 msec
%    \begin{macrocode}
\nuovoECG{pn0160}{(0,0)--(.04,-.06)--(.085,-.1)--(.12,-.06)--(.15,.0)}
\nuovoECG{pn0260}{(0,0)--(.02,-.1)--(.085,-.2)--(.13,-.1)--(.15,.0)}
\nuovoECG{pn0360}{(0,0)--(.04,-.2)--(.085,-.3)--(.12,-.2)--(.15,.0)}
\nuovoECG{pn0180}{(0,0)--(.04,-.06)--(.09,-.1)--(.14,-.06)--(.2,.0)}
\nuovoECG{pn0280}{(0,0)--(.02,-.1)--(.09,-.2)--(.15,-.1)--(.2,.0)}
\nuovoECG{pn0380}{(0,0)--(.04,-.2)--(.09,-.3)--(.14,-.2)--(.2,.0)}
\nuovoECG{pn0199}{(0,0)--(.1,-.08)--(.15,-.1)--(.2,-.08)--(.25,.0)}
\nuovoECG{pn0299}{(0,0)--(.1,-.16)--(.15,-.2)--(.2,-.16)--(.25,.0)}
\nuovoECG{pn0399}{(0,0)--(.1,-.2)--(.15,-.3)--(.2,-.2)--(.25,.0)}
%    \end{macrocode}

% onda P difasica (pd) e bifida (pb) da 100 msec
%    \begin{macrocode}
\nuovoECG{pd1199}{(0,0)--(0.01,0.005)--(0.09,0.095)--(0.11,0.095)
 --(0.19,-0.095)--(0.21,-0.095)--(0.29,-0.005)--(0.3,0)}
\nuovoECG{pb2199}{(0,0)--(0.01,0.005)--(0.09,0.195)--(0.11,0.195)--(0.14,0.1)
 --(0.16,0.1)--(0.19,0.15)--(0.21,0.15)--(0.29,0.005)-- (0.3,0)}
\nuovoECG{pb1299}{(0,0)--(0.01,0.005)--(0.09,0.15)--(0.11,0.15)--(0.14,0.1)
 --(0.16,0.1)--(0.19,0.195)--(0.21,0.195)--(0.29,0.005)-- (0.3,0)}
%    \end{macrocode}

% Onda Q da 10 e 20 msec con profondità rispettivamente da 1 a 3~mV e da 1 a 5~mm.
%    \begin{macrocode}
\nuovoECG{q21}{(0,0)--(.025,-.1)--(.05,0)}
\nuovoECG{q22}{(0,0)--(.025,-.2)--(.05,0)}
\nuovoECG{q23}{(0,0)--(.025,-.3)--(.05,0)}

\nuovoECG{q41}{(0,0)--(.05,-.1)--(.1,0)}
\nuovoECG{q42}{(0,0)--(.05,-.2)--(.1,0)}
\nuovoECG{q43}{(0,0)--(.05,-.3)--(.1,0)}
\nuovoECG{q44}{(0,0)--(.05,-.4)--(.1,0)}
\nuovoECG{q45}{(0,0)--(.05,-.5)--(.1,0)}
%    \end{macrocode}

% onda R da 30 msec alta da 1 a 5 mm
%    \begin{macrocode}
\nuovoECG{r31}{(0,0)--(.035,.1)--(.075,0)}
\nuovoECG{r32}{(0,0)--(.035,.2)--(.075,0)}
\nuovoECG{r33}{(0,0)--(.035,.3)--(.075,0)}
\nuovoECG{r34}{(0,0)--(.035,.4)--(.075,0)}
\nuovoECG{r35}{(0,0)--(.035,.5)--(.075,0)}
%    \end{macrocode}

% onda R da 40 msec con altezze da 2 a 10 mm in step di 2 mm
%    \begin{macrocode}
\nuovoECG{r42}{(0,0)--(.05,.2)--(.1,0)}
\nuovoECG{r44}{(0,0)--(.05,.4)--(.1,0)}
\nuovoECG{r46}{(0,0)--(.05,.6)--(.1,0)}
\nuovoECG{r48}{(0,0)--(.05,.8)--(.1,0)}
\nuovoECG{r100}{(0,0)--(.05,1)--(.1,0)}
%    \end{macrocode}

% onda R da 40 msec con altezze da 12 a 32 mm in step di 4 mm
%    \begin{macrocode}
\nuovoECG{r412}{(0,0)--(.05,1.2)--(.1,0)}
\nuovoECG{r416}{(0,0)--(.05,1.6)--(.1,0)}
\nuovoECG{r420}{(0,0)--(.05,2)--(.1,0)}
\nuovoECG{r424}{(0,0)--(.05,2.4)--(.1,0)}
\nuovoECG{r428}{(0,0)--(.05,2.8)--(.1,0)}
\nuovoECG{r432}{(0,0)--(.05,3.2)--(.1,0)}
%    \end{macrocode}

% onda R da 50 msec con altezze da 10 a 45 mm in step di 5 mm
%    \begin{macrocode}
\nuovoECG{r510}{(0,0)--(.0625,1)--(.125,0)}
\nuovoECG{r515}{(0,0)--(.0625,1.5)--(.125,0)}
\nuovoECG{r520}{(0,0)--(.0625,2)--(.125,0)}
\nuovoECG{r525}{(0,0)--(.0625,2.5)--(.125,0)}
\nuovoECG{r530}{(0,0)--(.0625,3)--(.125,0)}
\nuovoECG{r535}{(0,0)--(.0625,3.5)--(.125,0)}
\nuovoECG{r540}{(0,0)--(.0625,4)--(.125,0)}
\nuovoECG{r545}{(0,0)--(.0625,4.5)--(.125,0)}
%    \end{macrocode}

% onda S da 30 msec profonda da 1 a 5 mm
%    \begin{macrocode}
\nuovoECG{s31}{(0,0)--(.035,-.1)--(.075,0)}
\nuovoECG{s32}{(0,0)--(.035,-.2)--(.075,0)}
\nuovoECG{s33}{(0,0)--(.035,-.3)--(.075,0)}
\nuovoECG{s34}{(0,0)--(.035,-.4)--(.075,0)}
\nuovoECG{s35}{(0,0)--(.035,-.5)--(.075,0)}
%    \end{macrocode}

% onda S da 40 msec con profondità da 2 a 10 mm in step di 2 mm
%    \begin{macrocode}
\nuovoECG{s42}{(0,0)--(.05,-.2)--(.1,0)}
\nuovoECG{s44}{(0,0)--(.05,-.4)--(.1,0)}
\nuovoECG{s46}{(0,0)--(.05,-.6)--(.1,0)}
\nuovoECG{s48}{(0,0)--(.05,-.8)--(.1,0)}
\nuovoECG{s410}{(0,0)--(.05,-1)--(.1,0)}
%    \end{macrocode}

% onda S da 40 msec con profondità da 12 a 32 mm in step di 4 mm
%    \begin{macrocode}
\nuovoECG{s412}{(0,0)--(.05,-1.2)--(.1,0)}
\nuovoECG{s416}{(0,0)--(.05,-1.6)--(.1,0)}
\nuovoECG{s420}{(0,0)--(.05,-2)--(.1,0)}
\nuovoECG{s424}{(0,0)--(.05,-2.4)--(.1,0)}
\nuovoECG{s428}{(0,0)--(.05,-2.8)--(.1,0)}
\nuovoECG{s432}{(0,0)--(.05,-3.2)--(.1,0)}
%    \end{macrocode}

% onda S da 50 msec con profondità da 10 a 45 mm in step di 5 mm
%    \begin{macrocode}
\nuovoECG{s510}{(0,0)--(.0625,-1)--(.125,0)}
\nuovoECG{s515}{(0,0)--(.0625,-1.5)--(.125,0)}
\nuovoECG{s520}{(0,0)--(.0625,-2)--(.125,0)}
\nuovoECG{s525}{(0,0)--(.0625,-2.5)--(.125,0)}
\nuovoECG{s530}{(0,0)--(.0625,-3)--(.125,0)}
\nuovoECG{s535}{(0,0)--(.0625,-3.5)--(.125,0)}
\nuovoECG{s540}{(0,0)--(.0625,-4)--(.125,0)}
\nuovoECG{s545}{(0,0)--(.0625,-4.5)--(.125,0)}
%    \end{macrocode}

% onda T positiva da 400 msec con altezze da 1 a 11 mm - OK
%    \begin{macrocode}
\nuovoECG{tp2}{(0,0)--(.2,.05)--(.3,.15)--(.45,.2)--(.55,.2)--(.7,.15)--(.8,.05)--(1,0)}   
\nuovoECG{tp3}{(0,0)--(.2,.085)--(.3,.18)--(.45,.3)--(.55,.3)--(.7,.18)--(.8,.085)--(1,0)}   
\nuovoECG{tp4}{(0,0)--(.1,.03)-- (.2,.12)--(.3,.25)--(.45,.4)--(.55,.4)--(.7,.25)--(.8,.12)--(.9,.06)--(1,0)}  
\nuovoECG{tp5}{(0,0)--(.1,.03)--(.2,.13)--(.3,.29)--(.4,.47)--(.45,.5)--(.55,.5)--(.6,.47)--(.7,.29)--(.8,.13)--(.9,.03)--(1,0)}  
\nuovoECG{tp6}{(0,0)--(.1,.04)--(.2,.19)--(.3,.36)--(.4,.53)--(.45,.6)--(.55,.6)--(.6,.53)--(.7,.36)--(.8,.19)--(.9,.04)--(1,0)}  
\nuovoECG{tp7}{(0,0)--(.1,.04)--(.2,.2)--(.3,.39)--(.4,.58)--(.45,.7)--(.55,.7)--(.6,.58)--(.7,.39)--(.8,.2)--(.9,.04)--(1,0)}  
\nuovoECG{tp8}{(0,0)--(.1,.04)--(.2,.21)--(.3,.45)--(.4,.67)--(.45,.8)--(.55,.8)--(.6,.67)--(.7,.45)--(.8,.21)--(.9,.04)--(1,0)}  
\nuovoECG{tp9}{(0,0)--(.1,.05)--(.2,.4)--(.3,.62)--(.4,.85)--(.45,.9)--(.55,.85)--(.7,.62)--(.8,.4)--(.9,.05)--(1,0)}
\nuovoECG{tp10}{(0,0)--(.1,.05)--(.2,.42)--(.3,.66)--(.4,.9)--(.45,1)--(.55,1)--(.6,.9)--(.7,.66)--(.8,.42)--(.9,.05)--(1,0)}  
\nuovoECG{tp11}{(0,0)--(.1,.05)--(.2,.48)--(.3,.73)--(.4,.97)--(.45,1.1)--(.55,1.1)--(.6,.97)--(.7,.73)--(.8,.48)--(.9,.05)--(1,0)}  

% onda T negativa da 400 msec con profondità da 1 a 11 mm - OK
\nuovoECG{tn2}{(0,0)--(.2,-.05)--(.3,-.15)--(.45,-.2)--(.55,-.2)--(.7,-.15)--(.8,-.05)--(1,0)}   
\nuovoECG{tn3}{(0,0)--(.2,-.085)--(.3,-.18)--(.45,-.3)--(.55,-.3)--(.7,-.18)--(.8,-.085)--(1,0)}   
\nuovoECG{tn4}{(0,0)--(.1,-.03)-- (.2,-.12)--(.3,-.25)--(.45,-.4)--(.55,-.4)--(.7,-.25)--(.8,-.12)--(.9,-.06)--(1,0)}
\nuovoECG{tn5}{(0,0)--(.1,-.03)--(.2,-.13)--(.3,-.29)--(.4,-.47)--(.45,-.5)--(.55,-.5)--(.6,-.47)--(.7,-.29)--(.8,-.13)--(.9,-.03)--(1,0)}  
\nuovoECG{tn6}{(0,0)--(.1,-.04)--(.2,-.19)--(.3,-.36)--(.4,-.53)--(.45,-.6)--(.55,-.6)--(.6,-.53)--(.7,-.36)--(.8,-.19)--(.9,-.04)--(1,0)}  
\nuovoECG{tn7}{(0,0)--(.1,-.04)--(.2,-.2)--(.3,-.39)--(.4,-.58)--(.45,-.7)--(.55,-.7)--(.6,-.58)--(.7,-.39)--(.8,-.2)--(.9,-.04)--(1,0)}  
\nuovoECG{tn8}{(0,0)--(.1,-.04)--(.2,-.21)--(.3,-.45)--(.4,-.67)--(.45,-.8)--(.55,-.8)--(.6,-.67)--(.7,-.45)--(.8,-.21)--(.9,-.04)--(1,0)}  
\nuovoECG{tn9}{(0,0)--(.1,-.05)--(.2,-.4)--(.3,-.62)--(.4,-.85)--(.45,-.9)--(.55,-.85)--(.7,-.62)--(.8,-.4)--(.9,-.05)--(1,0)}   
\nuovoECG{tn10}{(0,0)--(.1,-.05)--(.2,-.42)--(.3,-.66)--(.4,-.9)--(.45,-1)--(.55,-1)--(.6,-.9)--(.7,-.66)--(.8,-.42)--(.9,-.05)--(1,0)}  
\nuovoECG{tn11}{(0,0)--(.1,-.05)--(.2,-.48)--(.3,-.73)--(.4,-.97)--(.45,-1.1)--(.55,-1.1)--(.6,-.97)--(.7,-.73)--(.8,-.48)--(.9,-.05)--(1,0)}  
%    \end{macrocode}

% Morfologie normali (P-QRS-T) - tipologia normale (n) in classe (n) per 12 derivazioni (D1-3, aVR aVL aVF, V1-6)
%    \begin{macrocode}
\nuovoECG{nnd1}{(0,0)--(.1,.08)--(.18,0)--(.3,0)--(.4,-.1)--(.42,.8)--(.48,.1)--(.55,0)--(.8,0)--(.9,.1)--(1,.2)--(1.1,.3)--(1.2,.2)--(1.3,0)--(1.8,0)}
\nuovoECG{nnd2}{(0,0)--(.05,.05)--(.08,.1)--(.15,.05)--(.2,0)--(.3,0)--(.35,-.1)--(.4,.9)--(.5,-.02)--(.6,0)--(.9,0)--(1,.1)--(1.1,.2)--(1.15,.3)--(1.25,.2)--(1.3,.05)--(1.8,0)}
\nuovoECG{nnd3}{(0,0)--(0.08,0.05)--(0.15,0.02)--(0.3,0)--(0.4,0.08)--(0.43,0.21)--(0.48,-0.1)--(0.52,0)--(1.05,0)--(1.1,0.07)--(1.2,0)--(1.8,0)}
\nuovoECG{nnvr}{(0,0)--(0.08,-0.05)--(0.12,-0.14)--(0.2,0)--(0.3,0)--(0.4,0.01)--(0.43,0.08)--(0.48,-0.9)--(0.52,-0.1)--(0.8,0)--(0.9,-0.1)--(1,-0.2)--(1.1,-0.3)--(1.15,-0.3)--(1.25,-0.1)--(1.3,0)--(1.5,0)}
\nuovoECG{nnvl}{(0,0)--(0.08,-0.05)--(0.16,0.1)--(0.21,0)--(0.4,0)--(0.41,-0.01)--(0.45,0.38)--(0.55,0.05)--(0.6,0)--(0.8,0)--(0.9,0.05)--(1,0.1)--(1.1,0.18)--(1.2,0.05)--(1.3,0)--(1.5,0)}
\nuovoECG{nnvf}{(0,0)--(0.1,0.05)--(0.17,-0.05)--(0.2,0)--(0.4,0)--(0.46,0.6)--(0.5,-0.1)--(0.55,0)--(.7,.02)--(.8,.03)--(0.9,.04)--(1.0,0.5)--(1.1,0.1)--(1.15,0.15)--(1.2,0.1)--(1.3,0)--(1.5,0)}

\nuovoECG{nnv1}{(0,0)--(0.08,0)--(0.1,0.05)--(0.17,0.1)--(0.2,-0.05)--(0.24,0)--(0.4,0)--(0.42,0.2)--(0.5,-1.1)--(0.6,0)--(0.7,0)--(0.8,0.08)--(0.9,0.1)--(1,0)--(1.1,-0.08)--(1.18,-0.1)--(1.2,-0.04)--(1.3,0)--(1.5,0)}
\nuovoECG{nnv2}{(0,0)--(.05,.05)--(.15,.2)--(.2,0)--(.4,0)--(.45,.3)--(.5,-.55)--(.6,0)--(.7,.08)--(.8,.12)--(.9,.2)--(1,.35)--(1.1,.5)--(1.2,.4)--(1.3,.05)--(1.5,0)}
\nuovoECG{nnv3}{(0,0)--(0.1,0)--(0.15,0.1)--(0.2,0)--(0.4,0)--(0.5,1)--(0.55,-0.1)--(0.6,0)--(0.7,0)--(0.8,0.05)--(0.9,0.1)--(1,0.3)--(1.1,0.6)--(1.15,0.7)--(1.2,0.4)--(1.3,0.1)--(1.4,0)--(1.6,0)}
\nuovoECG{nnv4}{(0,0)--(0.1,0)--(0.14,0.1)--(0.2,0)--(0.4,0)--(0.41,-0.07)--(0.5,1.35)--(0.55,-0.03)--(0.6,0)--(0.8,0)--(0.9,0.1)--(1,0.2)--(1.1,0.4)--(1.15,0.55)--(1.2,0.4)--(1.3,0.1)--(1.5,0)--(1.6,0)}
\nuovoECG{nnv5}{(0,0)--(0.1,0)--(0.15,0.1)--(0.2,0)--(0.4,0)--(0.45,-0.1)--(0.5,1.2)--(0.55,-0.05)--(0.6,0)--(0.8,0)--(0.9,0.05)--(1,0.1)--(1.1,0.3)--(1.2,0.4)--(1.3,0.02)--(1.4,0)--(1.6,0)}
\nuovoECG{nnv6}{(0,0)--(0.1,0)--(0.16,0.09)--(0.2,0)--(0.4,0)--(0.44,-0.09)--(0.5,0.9)--(0.55,0.01)--(0.6,0)--(0.9,0)--(1,0.1)--(1.1,0.2)--(1.18,0.34)--(1.2,0.25)--(1.3,0.1)--(1.4,0)--(1.6,0)}
%    \end{macrocode}

% Morfologie di un ritmo sinusale normale (n) bradicarico (b) (d1-d2-d3-vr-vl-vf-v1-v2-v3-v4-v5-v6)
%    \begin{macrocode}
\nuovoECG{nbd1}{(0,0)--(0.1,0.05)--(0.18,0)--(0.2,0.1)--(0.25,0)--(0.4,0)--(0.45,-0.1)--(0.5,0.9)--(0.6,-0.15)--(0.65,0)--(0.9,0)--(1,0.05)--(1.1,0.1)--(1.2,0.2)--(1.3,0.35)--(1.4,0.4)--(1.5,0.1)--(1.6,0)--(1.8,0)}
\nuovoECG{nbd2}{(0,0)--(0.1,0.08)--(0.2,0.12)--(0.3,0)--(0.5,0)--(0.6,0.02)--(0.7,0.75)--(0.8,-0.2)--(0.9,0)--(1.1,0)--(1.2,0.05)--(1.3,0.08)--(1.4,0.3)--(1.45,0.35)--(1.5,0.3)--(1.6,0.05)--(1.7,0)--(1.8,0)}
\nuovoECG{nbd3}{(0,0)--(0.05,0)--(0.1,0.05)--(0.15,0.1)--(0.2,0.05)--(0.3,0)--(0.4,0)--(0.5,0)--(0.6,0.1)--(0.7,-0.7)--(0.8,0)--(1.3,0)--(1.4,-0.08)--(1.5,0)--(1.6,0)--(1.8,0)}
\nuovoECG{nbvr}{(0,0)--(0.1,-0.05)--(0.2,-0.1)--(0.3,0)--(0.5,0)--(0.6,0.02)--(0.65,-0.8)--(0.7,0.2)--(0.8,0)--(1,0)--(1.1,-0.05)--(1.2,-0.1)--(1.3,-0.2)--(1.4,-0.3)--(1.5,-0.2)--(1.6,-0.1)--(1.7,0)--(1.8,0)}
\nuovoECG{nbvl}{(0,0)--(0.09,-0.05)--(0.16,-0.05)--(0.26,0.05)--(0.4,0)--(0.5,0)--(0.57,-0.1)--(0.65,0.8)--(0.7,-0.02)--(0.75,0)--(1.1,0)--(1.2,0.03)--(1.3,0.1)--(1.4,0.2)--(1.5,0.1)--(1.6,0.02)--(1.7,0)--(1.8,0)}
\nuovoECG{nbvf}{(0,0)--(0.09,0.1)--(0.16,0.12)--(0.2,0.02)--(0.3,0)--(0.5,0)--(0.6,0.1)--(0.65,0.3)--(0.7,-0.1)--(0.75,0)--(0.8,0.01)--(0.9,0.02)--(1,0.03)--(1.1,0.04)--(1.2,0.06)--(1.3,0.12)--(1.4,0.16)--(1.45,0.2)--(1.5,0.15)--(1.6,0.06)--(1.7,0.01)--(1.8,0)}

\nuovoECG{nbv1}{(0,0)--(0.1,0)--(0.2,-0.1)--(0.3,-0.04)--(0.4,0)--(0.5,0)--(0.58,0.12)--(0.66,-0.7)--(0.72,0.02)--(0.8,0)--(1.2,0)--(1.3,-0.04)--(1.4,-0.12)--(1.5,-0.15)--(1.6,0)--(1.8,0)}
\nuovoECG{nbv2}{(0,0)--(0.1,0)--(0.15,0.04)--(0.2,-0.04)--(0.3,0)--(0.5,0)--(0.58,0.75)--(0.65,-0.45)--(0.7,-0.2)--(0.75,0)--(1,0.01)--(1.1,0.1)--(1.2,0.2)--(1.3,0.3)--(1.4,0.45)--(1.5,0.3)--(1.6,0.08)--(1.7,0)--(1.8,0)}
\nuovoECG{nbv3}{(0,0)--(0.1,0.02)--(0.2,0.11)--(0.3,0)--(0.5,0)--(0.58,1.4)--(0.67,-0.6)--(0.7,-0.3)--(0.8,0.1)--(0.9,0.15)--(1.0,0.2)--(1.1,0.25)--(1.2,0.35)--(1.3,0.6)--(1.4,0.9)--(1.5,0.5)--(1.6,0.1)--(1.7,0)--(1.8,0)}
\nuovoECG{nbv4}{(0,0)--(0.1,0.03)--(0.16,0.1)--(0.2,0)--(0.3,0.05)--(0.4,0)--(0.5,0)--(0.58,2.2)--(0.68,-0.4)--(0.74,0)--(0.8,0.03)--(0.9,0.05)--(1,0.1)--(1.1,0.15)--(1.2,0.22)--(1.3,0.4)--(1.4,0.8)--(1.45,1)--(1.5,0.5)--(1.6,0.1)--(1.7,0.02)--(1.8,0)--(1.9,0)}
\nuovoECG{nbv5}{(0,0)--(0.1,0)--(0.2,0.03)--(0.3,0.08)--(0.4,0.02)--(0.5,0)--(0.6,0)--(0.63,-0.1)--(0.7,2.3)--(0.8,-0.3)--(0.85,0)--(0.9,0)--(1.0,0.02)--(1.1,0.08)--(1.2,0.1)--(1.3,0.2)--(1.4,0.4)--(1.5,0.8)--(1.6,0.5)--(1.7,0.1)--(1.8,0.05)--(1.9,0)--(2,0)}
\nuovoECG{nbv6}{(0,0)--(0.1,0.05)--(0.2,0.1)--(0.3,0.04)--(0.4,0)--(0.5,0)--(0.55,-0.12)--(0.6,1.9)--(0.7,-0.09)--(0.75,0)--(0.9,0)--(1,0.05)--(1.1,0.1)--(1.2,0.15)--(1.3,0.4)--(1.4,0.7)--(1.5,0.25)--(1.6,0.07)--(1.7,0)--(1.8,0)}
%    \end{macrocode}

% Morfologia di una extrasistole (e) ventricolare (v) nelle 12 derivazioni (d1-d2-d3-vr-vl-vf-v1-v2-v3-v4-v5-v6)
%    \begin{macrocode}
\nuovoECG{evd1}{(0,0)--(.1,0)--(.2,.15)--(.3,.1)--(.4,.44)--(.5,0)--(.7,0)--(.8,-.1)--(.9,0)--(1.0,.1)--(1.1,.15)--(1.2,-.05)--(1.3,-.02)--(1.4,0)--(1.5,0)}
\nuovoECG{evd2}{(0,0)--(.1,.05)--(.2,.5)--(.3,.9)--(.4,1.4)--(.5,.5)--(.6,-.15)--(.7,-.25)--(.8,-.35)--(.9,-.5)--(1.0,-.62)--(1.1,-.43)--(1.2,-.1)--(1.3,.04)--(1.4,0)--(1.5,0)}
\nuovoECG{evd3}{(0,0)--(.1,.05)--(.2,.1)--(.3,.7)--(.4,1.1)--(.45,1.35)--(.5,0)--(.6,-.2)--(.7,-.2)--(.8,-.3)--(.9,-.5)--(1,-.6)--(1.1,-.5)--(1.2,-.2)--(1.3,.1)--(1.4,.05)--(1.5,0)--(1.6,0)}
\nuovoECG{evvr}{(0,0)--(.1,0)--(.2,.05)--(.3,-.05)--(.4,-.05)--(.5,-.2)--(.6,-.5)--(.68,-.9)--(.7,-.7)--(.8,0)--(.9,.09)--(1,.12)--(1.1,.18)--(1.2,.2)--(1.3,.2)--(1.4,.16)--(1.5,.1)--(1.6,0)--(1.7,0)}
\nuovoECG{evvl}{(0,0)--(.1,0)--(.2,0)--(.3,.09)--(.4,-.3)--(.5,-.65)--(.6,0)--(.7,.05)--(.8,.1)--(.9,.2)--(1,.3)--(1.1,.4)--(1.15,.4)--(1.2,.3)--(1.3,0)--(1.4,-.1)--(1.5,0)--(1.6,0)}
\nuovoECG{evvf}{(0,0)--(0.1,.05)--(.2,.07)--(.3,.4)--(.4,.8)--(.5,1.32)--(.6,-.05)--(.7,-.18)--(.8,-.21)--(.9,-.3)--(1,-.5)--(1.1,-.67)--(1.2,-.05)--(1.3,-.01)--(1.4,.05)--(1.5,0)--(1.6,0)}

\nuovoECG{evv1}{(0,0)--(.2,0)--(.3,.02)--(.4,.4)--(.45,1)--(.5,.3)--(.55,-.2)--(.6,-.15)--(.7,-.25)--(.8,-.25)--(.9,-.3)--(1,-.4)--(1.1,-.5)--(1.2,-.3)--(1.3,0)--(1.6,0)}
\nuovoECG{evv2}{(0,0)--(.2,0)--(.3,.3)--(.4,1.6)--(.47,2.5)--(.5,1.7)--(.54,-.3)--(.6,-.25)--(.7,-.3)--(.8,-.35)--(.9,-.4)--(1,-.52)--(1.1,-.6)--(1.2,-.4)--(1.3,-.15)--(1.4,-.1)--(1.5,-.02)--(1.6,0)}
\nuovoECG{evv3}{(0,0)--(.2,0)--(.3,.7)--(.4,1.7)--(.46,2.8)--(.5,2.3)--(.6,0)--(.7,-.35)--(.8,-.4)--(.9,-.6)--(1,-.8)--(1.1,-1.05)--(1.2,-.8)--(1.3,-.3)--(1.4,-.05)--(1.5,0)--(1.6,0)}
\nuovoECG{evv4}{(0,0)--(.2,0)--(.3,.6)--(.4,1.7)--(.5,2.25)--(.6,-.2)--(.7,-.3)--(.8,-.45)--(.9,-.6)--(1,-.87)--(1.1,-1)--(1.2,-.6)--(1.3,-.2)--(1.4,-.1)--(1.5,-.04)--(1.55,0)--(1.6,0)}
\nuovoECG{evv5}{(0,0)--(.2,0)--(.3,.5)--(.4,1.5)--(.45,1.75)--(.5,1.1)--(.6,-.2)--(.7,-.28)--(.8,-.4)--(.9,-.5)--(1,-.7)--(1.07,-.8)--(1.1,-.7)--(1.2,-.4)--(1.3,-.2)--(1.4,-.1)--(1.5,0)--(1.6,0)}
\nuovoECG{evv6}{(0,0)--(.2,0)--(.3,.45)--(.4,1.3)--(.45,1.4)--(.5,.7)--(.6,-.1)--(.7,-.2)--(.8,-.25)--(.9,-.4)--(1,-.5)--(1.1,-.4)--(1.2,-.2)--(1.3,-.05)--(1.4,0)--(1.6,0)}
%    \end{macrocode}

% morfologia di un caso giovanile di WPW con evidenza di onda delta; si utilizza "w" (per Wolf) e "b" (per bradicardia)
%    \begin{macrocode}
\nuovoECG{wbd1}{(0,0)--(.08,.07)--(.1,.04)--(.18,0)--(.2,-.02)--(.25,-.02)--(.26,0)--(.28,.22)--(.3,.15)--(.32,-.1)--(.4,0)--(.42,.02)--(.6,.05)--(.7,.12)--(.8,.19)--(.85,.05)--(.9,.02)--(1,.01)--(1.2,0)--(1.5,0)}
\nuovoECG{wbd2}{(0,0)--(.05,-.02)--(.15,.1)--(.25,-.02)--(.3,.1)--(.35,1.7)--(.4,0)--(.45,.1)--(.5,.05)--(.6,.1)--(.7,.15)--(.8,.3)--(.85,.37)--(.9,.2)--(1,.07)--(1.1,.07)--(1.2,.04)--(1.3,.02)--(1.4,0)--(1.5,0)}
\nuovoECG{wbd3}{(0,0)--(.1,.07)--(.12,.09)--(.2,0)--(.22,-.05)--(.3,.2)--(.34,1.55)--(.4,.15)--(.5,.05)--(.6,.07)--(.7,.09)--(.8,.15)--(.85,.22)--(.9,.15)--(1,.05)--(1.1,.05)--(1.2,.04)--(1.3,.02)--(1.4,0)--(1.5,0)}
\nuovoECG{wbvr}{(0,0)--(.1,0)--(.2,-.08)--(.3,.02)--(.35,0)--(.41,-.95)--(.46,0)--(.5,0)--(.6,-.07)--(.7,-.08)--(.8,-.11)--(.9,-.27)--(1,-.05)--(1.1,-.03)--(1.2,-.02)--(1.3,-.01)--(1.4,0)--(1.5,0)}
\nuovoECG{wbvl}{(0,0)--(.1,-.03)--(.15,-.05)--(.2,-.02)--(.27,0)--(.3,-.02)--(.37,-.7)--(.42,-.1)--(.5,-.05)--(.55,-.02)--(.6,-.02)--(.7,-.02)--(.8,.02)--(.9,-.05)--(1,-.03)--(1.1,0)--(1.5,0)}
\nuovoECG{wbvf}{(0,0)--(.1,.05)--(.15,.1)--(.22,-.02)--(.3,.15)--(.35,1.65)--(.4,.06)--(.5,.075)--(.6,.1)--(.7,.12)--(.75,.14)--(.8,.2)--(.85,.27)--(.9,.15)--(.95,.07)--(1,.05)--(1.1,.05)--(1.2,.04)--(1.3,.01)--(1.4,0)--(1.5,0)}

\nuovoECG{wbv1}{(0,0)--(.075,.05)--(.15,0)--(.24,0)--(.32,.4)--(.38,-.37)--(.4,-.1)--(.5,0)--(.6,0)--(.7,-.03)--(.8,-.1)--(.9,.07)--(1,0)--(1.5,0)}
\nuovoECG{wbv2}{(0,0)--(.05,.05)--(.2,0)--(.3,1.4)--(.35,-.95)--(.4,-.1)--(.5,.05)--(.6,.07)--(.7,.1)--(.8,.15)--(.85,.3)--(.9,.2)--(1,.06)--(1.1,.05)--(1.2,.04)--(1.3,.03)--(1.4,.01)--(1.5,0)}
\nuovoECG{wbv3}{(0,0)--(.12,.07)--(.19,-.01)--(.25,.1)--(.33,2.1)--(.37,-.21)--(.42,.05)--(.5,.06)--(.6,.1)--(.72,.1)--(.8,.04)--(.87,.17)--(.98,.1)--(1.1,.08)--(1.2,.06)--(1.3,.04)--(1.4,.01)--(1.5,0)}
\nuovoECG{wbv4}{(0,0)--(.1,.05)--(.18,-.05)--(.25,.1)--(.3,1.7)--(.33,0)--(.37,.05)--(.5,.075)--(.6,.12)--(.7,.2)--(.81,.4)--(.9,.2)--(.95,.1)--(1.05,.1)--(1.1,.07)--(1.2,.04)--(1.3,.02)--(1.4,.01)--(1.5,0)}
\nuovoECG{wbv5}{(0,0)--(.06,.05)--(.12,-.02)--(.2,0)--(.26,1.75)--(.3,.03)--(.4,.05)--(.5,.08)--(.6,.15)--(.7,.33)--(.76,.43)--(.8,.3)--(.9,.07)--(1,.06)--(1.1,.05)--(1.2,.02)--(1.3,.01)--(1.4,0)--(1.5,0)}
\nuovoECG{wbv6}{(0,0)--(.07,.05)--(.15,0)--(.23,-.03)--(.27,1.06)--(.3,.04)--(.4,.05)--(.5,.08)--(.6,.12)--(.7,.25)--(.76,.39)--(.8,.3)--(.9,.04)--(1,.04)--(1.1,.03)--(1.2,.02)--(1.3,.01)--(1.4,0)--(1.5,0)}
%    \end{macrocode}

% morfologia di un caso giovanile di WPW durante accesso di TPSV; si utilizza "w" (per Wolf) e "t" (per tachicardia) 
%    \begin{macrocode}
\nuovoECG{wtd1}{(0,0)--(.05,.77)--(.08,-.46)--(.1,-.2)--(.15,-.13)--(.2,-.08)--(.25,.2)--(.29,.24)--(.35,.1)--(.4,0)}
\nuovoECG{wtd2}{(0,0)--(.05,1.2)--(.08,-.15)--(.1,-.15)--(.15,-.1)--(.2,-.15)--(.25,.1)--(.28,.18)--(.35,.05)--(.4,0)}
\nuovoECG{wtd3}{(0,0)--(.04,.88)--(.06,.12)--(.1,.07)--(.15,.04)--(.2,-.075)--(.22,-.08)--(.25,-.04)--(.3,.08)--(.33,.1)--(.35,.04)--(.4,0)}
\nuovoECG{wtvr}{(0,0)--(.05,-1.03)--(.08,.25)--(.12,.2)--(.15,.2)--(.2,.15)--(.25,0)--(.28,-.16)--(.35,-.05)--(.4,0)}
\nuovoECG{wtvl}{(0,0)--(.05,.22)--(.08,-.52)--(.1,-.08)--(.2,-.05)--(.28,.13)--(.3,.1)--(.38,0)--(.4,0)}
\nuovoECG{wtvf}{(0,0)--(.04,1.16)--(.07,-.09)--(.15,-.1)--(.18,-.12)--(.28,.13)--(.33,.13)--(.38,.01)--(.4,0)}

\nuovoECG{wtv1}{(0,0)--(.04,-1.17)--(.07,-.1)--(.1,-.1)--(.2,-.2)--(.27,-.4)--(.3,-.25)--(.38,-.1)--(.4,0)}
\nuovoECG{wtv2}{(0,0)--(.06,1.18)--(.08,-1.3)--(.14,-.25)--(.21,-.2)--(.28,0)--(.33,.06)--(.38,.01)--(.4,0)}
\nuovoECG{wtv3}{(0,0)--(.04,1.68)--(.06,-1.34)--(.11,-.5)--(.13,-.34)--(.2,-.3)--(.29,.24)--(.31,.2)--(.38,.01)--(.4,0)}
\nuovoECG{wtv4}{(0,0)--(.04,1.65)--(.07,-.88)--(.1,-.4)--(.2,-.33)--(.28,.35)--(.3,.3)--(.38,.01)--(.4,0)}
\nuovoECG{wtv5}{(0,0)--(.04,1.97)--(.06,-.47)--(.1,-.3)--(.15,-.27)--(.2,-.18)--(.27,.33)--(.3,.3)--(.38,.01)--(.4,0)}
\nuovoECG{wtv6}{(0,0)--(.05,1.53)--(.07,-.25)--(.13,-.2)--(.19,-.2)--(.21,-.1)--(.28,.2)--(.3,.2)--(.37,.02)--(.4,0)}
%    \end{macrocode}

% morfologia di un caso giovanile di PR corto senza preeccitazione e con BBD minore (b per blocco di branca, b per bradicardico)
%    \begin{macrocode}
\nuovoECG{bbd1}{(0,0)--(.1,.05)--(.13,-.02)--(.2,0)--(.25,-.05)--(.3,.5)--(.35,-.35)--(.4,-.05)--(.5,.02)--(.6,.05)--(.7,.1)--(.8,.2)--(.9,.3)--(.95,.35)--(1,.3)--(1.1,.08)--(1.2,0)--(3,0)}
\nuovoECG{bbd2}{(0,0)--(.05,.1)--(.1,.11)--(.17,0)--(.23,0)--(.27,-.1)--(.33,1.57)--(.43,-.25)--(.5,0)--(.6,.05)--(.7,.08)--(.8,.12)--(.9,.23)--(1,.37)--(1.05,.4)--(1.1,.3)--(1.2,.05)--(1.3,0)--(3,0)}
\nuovoECG{bbd3}{(0,0)--(.04,0)--(.1,.1)--(.15,0)--(.25,0)--(.3,-.07)--(.38,1.1)--(.42,-.07)--(.5,0)--(.7,0)--(.8,-.03)--(.9,-.05)--(1,0)--(1.1,.05)--(1.15,.1)--(1.2,.04)--(1.3,0)--(3,0)}
\nuovoECG{bbvr}{(0,0)--(.1,-.06)--(.15,-.1)--(.25,0)--(.3,.04)--(.35,.08)--(.41,-1.02)--(.47,.26)--(.55,0)--(.6,0)--(.7,-.05)--(.8,-.1)--(.9,-.18)--(1,-.3)--(1.08,-.38)--(1.2,-.15)--(1.3,0)--(3,0)}
\nuovoECG{bbvl}{(0,0)--(.1,-.05)--(.2,.05)--(.22,0)--(.32,0)--(.33,.1)--(.4,-.32)--(.42,-.21)--(.44,-.28)--(.5,0)--(.6,0)--(.7,.04)--(.8,.08)--(.9,.13)--(1,.19)--(1.1,.1)--(1.2,0)--(3,0)}
\nuovoECG{bbvf}{(0,0)--(.1,.1)--(.15,.1)--(.2,0)--(.3,0)--(.35,-.1)--(.4,1.35)--(.5,-.12)--(.55,0)--(.7,.03)--(.8,.05)--(.9,.07)--(1,.15)--(1.1,.22)--(1.2,.1)--(1.3,0)--(3,0)}

\nuovoECG{bbv1}{(0,0)--(.1,.02)--(.12,-.1)--(.2,-.04)--(.3,0)--(.32,.27)--(.38,-1.46)--(.45,.25)--(.5,.05)--(.6,0)--(.7,0)--(.8,-.05)--(.9,-.11)--(1,-.24)--(1.05,-.27)--(1.1,-.2)--(1.2,-.05)--(1.3,0)--(3,0)}
\nuovoECG{bbv2}{(0,0)--(.1,.06)--(.15,-.04)--(.2,0)--(.3,0)--(.36,.46)--(.41,-1.95)--(.52,0)--(.6,.13)--(.7,.17)--(.8,.23)--(.9,.32)--(1,.4)--(1.1,.33)--(1.2,.15)--(1.3,.07)--(1.4,.09)--(1.5,.12)--(1.6,.1)--(1.7,.05)--(1.8,0)--(3,0)}
\nuovoECG{bbv3}{(0,0)--(.1,.07)--(.2,0)--(.3,0)--(.35,.45)--(.41,-.8)--(.45,-.5)--(.47,-.7)--(.5,0)--(.55,.15)--(.6,.2)--(.7,.25)--(.8,.33)--(.9,.5)--(1,.65)--(1.1,.52)--(1.2,.23)--(1.3,.11)--(1.4,.12)--(1.5,.13)--(1.6,.09)--(1.7,.06)--(1.8,0)--(3,0)}
\nuovoECG{bbv4}{(0,0)--(.1,.07)--(.2,0)--(.3,0)--(.4,1.5)--(.45,-.35)--(.5,0)--(.55,.12)--(.6,.15)--(.7,.22)--(.8,.32)--(.9,.5)--(1,.7)--(1.08,.75)--(1.1,.65)--(1.2,.3)--(1.3,.13)--(1.4,.15)--(1.5,.15)--(1.6,.09)--(1.7,.05)--(1.8,.02)--(1.9,0)--(3,0)}
\nuovoECG{bbv5}{(0,0)--(.1,.06)--(.2,0)--(.26,0)--(.3,-.1)--(.37,1.92)--(.41,-.21)--(.5,.07)--(.6,.1)--(.7,.18)--(.8,.3)--(.9,.5)--(1,.75)--(1.1,.5)--(1.2,.15)--(1.3,.1)--(1.4,.1)--(1.5,.1)--(1.6,.07)--(1.7,.02)--(1.8,0)--(3,0)}
\nuovoECG{bbv6}{(0,0)--(.1,.1)--(.2,0)--(.3,0)--(.32,-.1)--(.41,1.6)--(.45,-.13)--(.5,.05)--(.6,.07)--(.7,.1)--(.8,.15)--(.9,.3)--(1,.45)--(1.08,.58)--(1.2,.2)--(1.3,.06)--(1.4,.04)--(1.5,.04)--(1.6,.03)--(1.7,.02)--(1.8,0)--(3,0)}
%    \end{macrocode}

% altro tracciato con morfologia normale
%    \begin{macrocode}
\nuovoECG{n2d1}{(0,0)--(.08,.07)--(.2,0)--(.3,0)--(.35,-.04)--(.4,-.1)--(.45,1)--(.5,-.17)--(.55,.02)--(.6,.02)--(.7,.03)--(.8,.06)--(.9,.15)--(1,.32)--(1.07,.37)--(1.1,.3)--(1.2,.08)--(1.3,0)--(2,0)}
\nuovoECG{n2d2}{(0,0)--(.1,.07)--(.2,.05)--(.3,0)--(.4,0)--(.45,-.08)--(.53,.83)--(.59,-.06)--(.65,.06)--(.7,.06)--(.8,.08)--(.9,.12)--(1,.2)--(1.14,.35)--(1.2,.25)--(1.3,.06)--(1.4,-.04)--(1.5,.02)--(2,0)}
\nuovoECG{n2d3}{(0,0)--(.07,.04)--(.14,-.01)--(.2,-.01)--(.3,0)--(.45,0)--(.52,-.25)--(.55,.2)--(.6,.04)--(.7,.02)--(.8,.03)--(.9,0)--(1,-.03)--(1.1,-.04)--(1.2,0)--(2,0)}
\nuovoECG{n2vr}{(0,0)--(.1,-.06)--(.15,-.08)--(.2,-.05)--(.3,0)--(.42,0)--(.45,.1)--(.52,-.85)--(.58,.13)--(.62,-.03)--(.7,-.05)--(.8,-.07)--(.9,-.1)--(1,-.2)--(1.12,-.36)--(1.2,-.2)--(1.3,-.05)--(1.4,0)--(1.6,-.03)--(2,0)}
\nuovoECG{n2vl}{(0,0)--(.1,.05)--(.2,.03)--(.39,0)--(.44,.58)--(.5,-.15)--(.55,0)--(.7,.02)--(.8,.04)--(.9,.1)--(1,.2)--(1.05,.23)--(1.1,.18)--(1.2,.03)--(1.3,.01)--(1.5,0)--(2,0)}
\nuovoECG{n2vf}{(0,0)--(.1,.05)--(.2,.01)--(.3,0)--(.42,0)--(.46,-.06)--(.54,.33)--(.55,.19)--(.57,.21)--(.6,-.02)--(.7,.02)--(.8,.01)--(.9,.04)--(1,.06)--(1.1,.12)--(1.15,.15)--(1.25,.1)--(1.3,.03)--(1.5,0)--(2,0)}

\nuovoECG{n2v1}{(0,0)--(.1,.05)--(.17,-.02)--(.2,0)--(.4,.01)--(.46,.24)--(.52,-.71)--(.63,0)--(.7,0)--(.8,.01)--(.9,-.03)--(1,-.06)--(1.1,-.13)--(1.15,-.13)--(1.2,-.05)--(1.3,0)--(2,0)}
\nuovoECG{n2v2}{(0,0)--(.13,.07)--(.16,0)--(.3,-.02)--(.4,0)--(.45,.35)--(.55,-1.13)--(.63,0)--(.7,.05)--(.8,.08)--(.9,.12)--(1,.22)--(1.05,.25)--(1.12,.2)--(1.2,.12)--(1.3,.04)--(1.4,0)--(1.5,0)--(1.7,.02)--(2,0)}
\nuovoECG{n2v3}{(0,0)--(.1,.08)--(.2,.03)--(.3,0)--(.42,0)--(.44,.3)--(.5,.4)--(.55,-1.05)--(.63,0)--(.7,.07)--(.8,.1)--(.9,.15)--(1,.25)--(1.1,.33)--(1.2,.2)--(1.3,.05)--(1.4,.03)--(1.5,.02)--(1.7,.01)--(2,0)}
\nuovoECG{n2v4}{(0,0)--(.12,.06)--(.22,0)--(.3,-.01)--(.42,0)--(.5,.83)--(.55,-.81)--(.62,.03)--(.7,.05)--(.8,.1)--(.9,.15)--(1,.25)--(1.1,.37)--(1.2,.2)--(1.3,.04)--(1.4,.02)--(1.6,.02)--(1.8,.01)--(2,0)}
\nuovoECG{n2v5}{(0,0)--(.1,.04)--(.2,.06)--(.3,0)--(.46,.03)--(.5,-.06)--(.56,1.13)--(.6,-.5)--(.67,.04)--(.8,.09)--(.9,.13)--(1,.2)--(1.1,.35)--(1.15,.42)--(1.2,.38)--(1.3,.15)--(1.4,.05)--(1.5,.04)--(1.7,.06)--(1.9,0)--(2,0)}
\nuovoECG{n2v6}{(0,0)--(.15,.06)--(.3,0)--(.42,.02)--(.45,-.11)--(.52,1.15)--(.6,-.2)--(.65,.05)--(.7,.06)--(.8,.08)--(.9,.11)--(1,.21)--(1.1,.38)--(1.15,.38)--(1.2,.3)--(1.3,.07)--(1.4,0)--(1.5,.01)--(1.7,.01)--(1.9,0)--(2,0)}
%    \end{macrocode}

%
% \paragraph{Costruzioni speciali}
%    \begin{macrocode}
\nuovoECG{pbav1}{(0,0)--(.08,.15)--(.2,0)--(.8,0)}
\nuovoECG{pbavlw}{(0,0)--(.1,.08)--(.15,.15)--(.2,.05)--(.3,0)}
\nuovoECG{qrsbav1}{(0,0)--(.05,0)--(.1,.08)--(.15,.12)--(.2,-.1)--(.25,-1.1)
 --(.3,0)--(.35,.7)--(.4,.3)--(.5,.2)--(.7,.1)--(1,.07)--(1.2,0)}
\nuovoECG{tpbav1}{(0,0)--(0.7,0)}
\nuovoECG{qrslw}{(0,0)--(0.05,0.9)--(0.12,-0.08)--(0.14,0)--(0.3,0)
 --(0.38,0.05)--(0.43,0.1)--(0.7,0.3)--(0.8,0.4)--(0.9,0.2)--(1.1,0)}
%    \end{macrocode}

% Un battito normale (di un tracciato in FA) seguito da BEV (fatv) che poi degenera in TV (tvtv)
%    \begin{macrocode}
\nuovoECG{fatv}{(0,0)--(.1,0)--(.2,.02)--(.3,.05)--(.35,.05)--(.4,.7)
 --(.42,1.1)--(.5,.05)--(.6,.0)--(.7,.05)--(.8,.08)--(.9,.1)--(1.0,.2)
 --(1.1,.3)--(1.2,.15)--(1.3,0)--(2,0)--(2.1,.08)--(2.2,.65)--(2.3,1.9)
 --(2.33,2.1)--(2.4,1.2)--(2.5,-.1)--(2.6,-.3)--(2.7,-.4)--(2.8,-.55)
 --(2.9,-.8)--(3,-.6)--(3.15,0)}
\nuovoECG{tvtv}{(0,0)--(.1,.08)--(.2,.65)--(.3,1.9)--(.33,2.1)--(0.4,1.2)
 --(.5,-.1)--(.6,-.3)--(.7,-.4)--(.8,-.55)--(.9,-.8)--(1.0,-.6)--(1.15,0)}
%    \end{macrocode}
%
%</archivio>
%\fi
%% \Finale
%
% \endinput