-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtikz-vowel.sty
2615 lines (2514 loc) · 102 KB
/
tikz-vowel.sty
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
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% tikz-vowel.sty
%% Copyright 2016-2017 by Christopher Weedall <[email protected]>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `author-maintained'.
%
% The Current Maintainer of this work is Christopher Weedall.
%
% This work consists of the files tikz-vowel.dtx, tikz-vowel.ins, tikz-vowel.tex, tikz-vowel.pdf
% and the derived file tikz-vowel.sty.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% based on TikZ implementation of vowel chart from:
% http://tex.stackexchange.com/questions/156955/tikz-pgf-linguistics-vowel-chart
% based on concepts in vowel.sty Copyright 2002 by Rei Fukui
% based on concepts in pst-vowel.sty Copyright 2009 by Alan Munn
%
% This package creates a sagittal grid based on the IPA vowel grid.
%
% The grid is created within a tikz-picture environment.
%
% Coordinates for cardinal vowels are created which correspond to the 16 vowel nodes
% which exist in vowel.sty. There are two coordinates for each vowel.
% The first coordinate is labeled with an ordinal numeral (e.g. 1, 2, 3, etc.) while
% the second coordinate is labeled with `v' prepended to the ordinal numeral (e.g. v1, v2, v3, etc.)
%
% Several new commands are created which mirror the concept of vowel.sty,
% but have additional options available. For example, instead of being limited to
% `left' and `right' for the label of a vowel, `above', `below' and the corners
% `above left', `above right', etc. are allowed. Another example is the introduction
% of a `scale' optional argument.
%
% Similar to the pst-vowel.sty package, there are four methods that allow
% diphthong lines and labels to be created. One for diphthongs between cardinal vowels,
% another from a cardinal vowel to a manual coordinate, another from a manual
% coordinate to a cardinal vowel, and the last between two manual coordinates.
%
% No code was taken directly from either vowel.sty or pst-vowel.sty.
% However, the commands provided inspiration for this package to
% accomplish the same/similar with little-to-no learning curve.
%
% This package uses coordinate, node, and draw commands from the
% tikz package . TikZ is used to essentially draw everything.
%
% Version 1.0 2017/03/18
% Version 1.1 2019/08/18
% Version 1.2 2020/12/13
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\RequirePackage{expl3}
\ProvidesExplPackage
% Package name
{tikz-vowel}
% Release date
{2020/12/13}
% Release version
{1.2}
% Description
{tikz-vowel package provides an environment allowing a (stylized) sagittal view for vowel plotting.}
%
%DEPRECATED,REPLACED WITH LINE BELOW%\RequirePackage{l3regex}%
\RequirePackage{expl3}
\RequirePackage{xstring}%
\RequirePackage{xparse}%
\RequirePackage{environ}%
%
\RequirePackage{tikz}%
%%%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%%%%%%FIX - PATCH TIKZ TO FOLLOW LATEX2E WITHIN THE LATEX3 ENVIRONMENT
\RequirePackage{etoolbox}
\ExplSyntaxOff
\patchcmd
{\pgfutil@InputIfFileExists}
{\input #1}
{%
\@pushfilename
\expandafter\expandafter\expandafter\input #1 %
\@popfilename
}
{}{}
\usetikzlibrary{arrows.meta,backgrounds,calc,fit,intersections,positioning,shapes.misc,shapes.geometric}%
%\usetikzlibrary{external}%
%\tikzexternalize%
%\tikzset{external/force remake}
%
\ExplSyntaxOn
%
%%% Set default label styles
\tikzset
{%
tikzvowel~labels/.style= {font=\footnotesize,},
tikzvowel~top~labels/.style= {},
tikzvowel~side~labels/.style= {anchor=east,align=right,},
}%
%
%%%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%
% Generate a nfT variant for \regex_match:nnT
\cs_generate_variant:Nn \regex_match:nnT {nfT}
%
% Generate a nVTF variant for \regex_match:nnTF
\cs_generate_variant:Nn \regex_match:nnTF {nVTF}
%
% Generate a xVTF variant for \regex_match:nVTF
\cs_generate_variant:Nn \regex_match:nVTF {xVTF}
%
% Generate a xnNF variant for \regex_replace_once:nnNF
\cs_generate_variant:Nn \regex_replace_once:nnNF {xnNF}
%
% Generate a NT variant for \tl_if_blank:nT
%\cs_generate_variant:Nn \tl_if_blank:nT {NT}% <---- 'N' is DEPRECATED
\cs_generate_variant:Nn \tl_if_blank:nT {VT}
%
%----------------------------------------------------------------------
% Define the x and y coordinates of vowel nodes v1 - v16
% -see `Create vowel coordinates (node) v1 - v16 using x and y coordinates' for creation of TikZ coordinates/nodes
%----------------------------------------------------------------------
%Vowel i - Node v1 (x + y coordinates)
\tl_new:c { g_tikzvowel_xV1_tl }
\tl_gset:cn { g_tikzvowel_xV1_tl } { 0 }
\tl_new:c { g_tikzvowel_yV1_tl }
\tl_gset:cn { g_tikzvowel_yV1_tl } { 3 }
%Vowel e - Node v2 (x + y coordinates)
\tl_new:c { g_tikzvowel_xV2_tl }
\tl_gset:cn { g_tikzvowel_xV2_tl } { 0.66666 }
\tl_new:c { g_tikzvowel_yV2_tl }
\tl_gset:cn { g_tikzvowel_yV2_tl } { 2 }
%Vowel ɛ - Node v3 (x + y coordinates)
\tl_new:c { g_tikzvowel_xV3_tl }
\tl_gset:cn { g_tikzvowel_xV3_tl } { 1.33333 }
\tl_new:c { g_tikzvowel_yV3_tl }
\tl_gset:cn { g_tikzvowel_yV3_tl } { 1 }
%Vowel a - Node v4 (x + y coordinates)
\tl_new:c { g_tikzvowel_xV4_tl }
\tl_gset:cn { g_tikzvowel_xV4_tl } { 2 }
\tl_new:c { g_tikzvowel_yV4_tl }
\tl_gset:cn { g_tikzvowel_yV4_tl } { 0 }
%Vowel ɑ - Node v5 (x + y coordinates)
\tl_new:c { g_tikzvowel_xV5_tl }
\tl_gset:cn { g_tikzvowel_xV5_tl } { 4 }
\tl_new:c { g_tikzvowel_yV5_tl }
\tl_gset:cn { g_tikzvowel_yV5_tl } { 0 }
%Vowel ɔ - Node v6 (x + y coordinates)
\tl_new:c { g_tikzvowel_xV6_tl }
\tl_gset:cn { g_tikzvowel_xV6_tl } { 4 }
\tl_new:c { g_tikzvowel_yV6_tl }
\tl_gset:cn { g_tikzvowel_yV6_tl } { 1 }
%Vowel o - Node v7 (x + y coordinates)
\tl_new:c { g_tikzvowel_xV7_tl }
\tl_gset:cn { g_tikzvowel_xV7_tl } { 4 }
\tl_new:c { g_tikzvowel_yV7_tl }
\tl_gset:cn { g_tikzvowel_yV7_tl } { 2 }
%Vowel u - Node v8 (x + y coordinates)
\tl_new:c { g_tikzvowel_xV8_tl }
\tl_gset:cn { g_tikzvowel_xV8_tl } { 4 }
\tl_new:c { g_tikzvowel_yV8_tl }
\tl_gset:cn { g_tikzvowel_yV8_tl } { 3 }
%Vowel ɨ - Node v9 (x + y coordinates)
\tl_new:c { g_tikzvowel_xV9_tl }
\tl_gset:cn { g_tikzvowel_xV9_tl } { 2 }
\tl_new:c { g_tikzvowel_yV9_tl }
\tl_gset:cn { g_tikzvowel_yV9_tl } { 3 }
%Vowel ɘ - Node v10 (x + y coordinates)
\tl_new:c { g_tikzvowel_xV10_tl }
\tl_gset:cn { g_tikzvowel_xV10_tl } { 2.33333 }
\tl_new:c { g_tikzvowel_yV10_tl }
\tl_gset:cn { g_tikzvowel_yV10_tl } { 2 }
%Vowel ə - Node v11 (x + y coordinates)
\tl_new:c { g_tikzvowel_xV11_tl }
\tl_gset:cn { g_tikzvowel_xV11_tl } { 2.5 }
\tl_new:c { g_tikzvowel_yV11_tl }
\tl_gset:cn { g_tikzvowel_yV11_tl } { 1.5 }
%Vowel ɜ - Node v12 (x + y coordinates)
\tl_new:c { g_tikzvowel_xV12_tl }
\tl_gset:cn { g_tikzvowel_xV12_tl } { 2.66666 }
\tl_new:c { g_tikzvowel_yV12_tl }
\tl_gset:cn { g_tikzvowel_yV12_tl } { 1 }
%Vowel ɪ - Node v13 (x + y coordinates)
\tl_new:c { g_tikzvowel_xV13_tl }
\tl_gset:cn { g_tikzvowel_xV13_tl } { 1.2 }
\tl_new:c { g_tikzvowel_yV13_tl }
\tl_gset:cn { g_tikzvowel_yV13_tl } { 2.5 }
%Vowel ʊ - Node v14 (x + y coordinates)
\tl_new:c { g_tikzvowel_xV14_tl }
\tl_gset:cn { g_tikzvowel_xV14_tl } { 3.3 }
\tl_new:c { g_tikzvowel_yV14_tl }
\tl_gset:cn { g_tikzvowel_yV14_tl } { 2.5 }
%Vowel ɐ - Node v15 (x + y coordinates)
\tl_new:c { g_tikzvowel_xV15_tl }
\tl_gset:cn { g_tikzvowel_xV15_tl } { 2.8 }
\tl_new:c { g_tikzvowel_yV15_tl }
\tl_gset:cn { g_tikzvowel_yV15_tl } { 0.6 }
%Vowel æ - Node v16 (x + y coordinates)
\tl_new:c { g_tikzvowel_xV16_tl }
\tl_gset:cn { g_tikzvowel_xV16_tl } { 1.66666 }
\tl_new:c { g_tikzvowel_yV16_tl }
\tl_gset:cn { g_tikzvowel_yV16_tl } { 0.5 }
%
%
% Create a temporary token list to store and modify the value of a regex match (plus changes)
\tl_if_exist:NF \l_tikzvowel_update_tl
{ \tl_new:N \l_tikzvowel_update_tl }
\tl_set:Nn \l_tikzvowel_update_tl { }
%
% Create a temporary token list to store and modify the value of a regex match (plus changes)
\tl_if_exist:NF \l_tikzvowel_temp_tl
{ \tl_new:N \l_tikzvowel_temp_tl }
\tl_set:Nn \l_tikzvowel_temp_tl { }
%
% Create a temporary token list to store X,Y coordinates and remove commas
\tl_if_exist:NF \l_tikzvowel_temp_XY_remove_comma_tl
{ \tl_new:N \l_tikzvowel_temp_XY_remove_comma_tl }
\tl_set:Nn \l_tikzvowel_temp_XY_remove_comma_tl { }
%
% Create a new token list to store the node commands
\tl_if_exist:NF \g_tikzvowel_nodes_tl
{ \tl_new:N \g_tikzvowel_nodes_tl }
\tl_gset:Nx \g_tikzvowel_nodes_tl { }
%
% Create a new token list to store the draw commands
\tl_if_exist:NF \g_tikzvowel_draw_tl
{ \tl_new:N \g_tikzvowel_draw_tl }
\tl_gset:Nx \g_tikzvowel_draw_tl { }
%
% Create a new token list to store the fixed vowel node label/name
\tl_if_exist:NF \l_tikzvowel_stripped_label_tl
{ \tl_new:N \l_tikzvowel_stripped_label_tl }
\tl_set:Nx \l_tikzvowel_stripped_label_tl { }
%
%Create a counter, set to 0, for creating coordinates
\int_if_exist:NF \l_tikzvowel_counter_int
{ \int_new:N \l_tikzvowel_counter_int }
\int_zero:N \l_tikzvowel_counter_int
%
% Create a new int variable to store the cardinal vowel number
\int_if_exist:NF \l_tikzvowel_cardinal_vowel_number_int
{ \int_new:N \l_tikzvowel_cardinal_vowel_number_int }
% Set default cardinal vowel number to 0 (this is invalid, and should be changed within a function)
\int_zero:N \l_tikzvowel_cardinal_vowel_number_int
%
% Create a sequence (i.e. list of tokens) to aid in separating X and Y
\seq_if_exist:NF \l_tikzvowel_coordinates_seq
{ \seq_new:N \l_tikzvowel_coordinates_seq }
%
% Create a sequence (i.e. list of tokens) to aid in separating starting X and Y
\seq_if_exist:NF \l_tikzvowel_starting_coordinates_seq
{ \seq_new:N \l_tikzvowel_starting_coordinates_seq }
% Create a sequence (i.e. list of tokens) to aid in separating ending X and Y
\seq_if_exist:NF \l_tikzvowel_ending_coordinates_seq
{ \seq_new:N \l_tikzvowel_ending_coordinates_seq }
%
%
%----------------------------------------------------------------------
% Create vowel coordinates (node) v1 - v16 using x and y coordinates
% -see `Define the x and y coordinates of vowel nodes v1 - v16' for details
%----------------------------------------------------------------------
%\DeclareDocumentCommand{\cs_tikzvowel_populate_cardinal_vowel_coordinates}{}
\cs_new:Nn \cs_tikzvowel_populate_cardinal_vowel_coordinates:
{%
% Re/set counter to 0, for creating coordinates
\int_zero:N \l_tikzvowel_counter_int
%Create coordinates (nodes) with a label such as v1, v2, ... v16 and 1, 2, ... 16
\int_while_do:nn { \l_tikzvowel_counter_int < 16 }
{%
%Increment counter by 1 first
\int_incr:N \l_tikzvowel_counter_int
%Create vNUM coordinate
\coordinate (v\int_use:N \l_tikzvowel_counter_int )
at ( \tl_use:c { g_tikzvowel_xV\int_use:N \l_tikzvowel_counter_int _tl } ,
\tl_use:c { g_tikzvowel_yV\int_use:N \l_tikzvowel_counter_int _tl });%
%Create NUM coordinate
\coordinate ( \int_use:N \l_tikzvowel_counter_int )
at ( \tl_use:c { g_tikzvowel_xV\int_use:N \l_tikzvowel_counter_int _tl } ,
\tl_use:c { g_tikzvowel_yV\int_use:N \l_tikzvowel_counter_int _tl });%
}%
}%
%
%----------------------------------------------------------------------
% Create top labels (`Front', `Central', `Back')
%----------------------------------------------------------------------
\cs_new:Nn \cs_tikzvowel_draw_top_labels:
{%
%Top labels
\node[tikzvowel~labels,tikzvowel~top~labels] (FrontLabel) at (0, 3.65) {Front};
\node[tikzvowel~labels,tikzvowel~top~labels] (CentralLabel) at (2, 3.65) {Central};
\node[tikzvowel~labels,tikzvowel~top~labels] (BackLabel) at (4, 3.65) {Back};
}%
%
%----------------------------------------------------------------------
% Create side labels (`Close', `Close-mid', `Open-mid', `Open')
%----------------------------------------------------------------------
\cs_new:Nn \cs_tikzvowel_draw_side_labels:
{%
%Left side labels
\node[tikzvowel~labels,tikzvowel~side~labels] (CloseLabel) at (-0.65, 3) {Close};
\node[tikzvowel~labels,tikzvowel~side~labels] (ClosemidLabel) at (-0.65, 2) {Close-mid};
\node[tikzvowel~labels,tikzvowel~side~labels] (OpenmidLabel) at (-0.65, 1) {Open-mid};
\node[tikzvowel~labels,tikzvowel~side~labels] (OpenLabel) at (-0.65, 0) {Open};
}%
%
%----------------------------------------------------------------------
% Create cardinal vowel node with a label (or name)
% -argument #1 (optional) is the location of the label (if unspecified, `center' is default)
% -see TikZ for details and all available values
% -available values (typical):
% `center' [default]
% `left'
% `right'
% `above'
% `below'
% `above left'
% `above right'
% `below left'
% `below right'
% -argument #2 (required) is the vowel node label/name
% -argument #3 (required) is the vowel node location
% -see `Define the x and y coordinates of vowel nodes v1 - v16' for details
%----------------------------------------------------------------------
\DeclareDocumentCommand{\cardinalvowel}{ O{center} m m }
{%
% Error checking for #2 (vowel label/name) - is empty?
\tl_if_empty:nT {#2}
{ \PackageError{tikz-vowel:\cardinalvowel}{Label/name~for~vowel~node~is~undefined}{} }
% Error checking for #3 (vowel node location) - is empty?
\tl_if_empty:nT {#3}
{ \PackageError{tikz-vowel:\cardinalvowel}{Vowel~node~location~is~undefined}{} }
% Error checking for #2 (vowel label/name) - is blank?
\tl_if_blank:nT {#2}
{ \PackageError{tikz-vowel:\cardinalvowel}{Label/name~for~vowel~node~is~undefined}{} }
% Error checking for #3 (vowel node location) - is blank?
\tl_if_blank:nT {#3}
{ \PackageError{tikz-vowel:\cardinalvowel}{Vowel~node~location~is~undefined}{} }
% Error checking for #3 (vowel node location) - contains unwanted letters/numbers/characters?
\regex_match:nnT { [^v0-9] } { #3 }
{%
% Unexpected character(s) found - throw error
\PackageError{tikz-vowel:\cardinalvowel}
{Vowel~node~'#3'~is~invalid.~
Must~be~1-16~OR~v1-v16}
{}%
}%
% Re/set default cardinal vowel number to 0 (this is invalid, but is changed immediately)
\int_zero:N \l_tikzvowel_cardinal_vowel_number_int
% Check if #3 (vowel node location) contains 'v'
\regex_match:nnTF { [v] } { \tl_head:n {#3} }
{%
%If true - strip v to get cardinal vowel number
\int_set:Nn \l_tikzvowel_cardinal_vowel_number_int { \tl_tail:n {#3} }
}
{%
%If false - there is no v, meaning already cardiinal vowel number
\int_set:Nn \l_tikzvowel_cardinal_vowel_number_int { #3 }
}%
% Error check - is the numerical value of #3 between 1 and 16 (inclusive)?
% first, check if vowel is less than 1
\int_compare:nNnTF { \l_tikzvowel_cardinal_vowel_number_int } < { 1 }
{%
% Error! - cardinal vowel number is less than 1
\PackageError{tikz-vowel:\cardinalvowel}
{Vowel~'#2'~at~node~'#3'~(i.e.~less~than~1).~
Must~be~1-16~OR~v1-v16}
{}
}
{%
% If vowel is not less than 1, check if greater than 16
\int_compare:nNnT { \l_tikzvowel_cardinal_vowel_number_int } > { 16 }
{%
% Error! - the vowel node number is greater than 16
\PackageError{tikz-vowel:\cardinalvowel}
{Vowel~'#2'~at~node~'#3'~(i.e.~greater~than~16).~
Must~be~1-16~OR~v1-v16}
{}%
}%
}%
% Set the token list to the string value (NOT actual macros/commands) of the label/name
\tl_set:Nx \l_tikzvowel_stripped_label_tl { \tl_to_str:n {#2} }
% Replace anything matching a command ( \ NAME { ) or a closing curly bracket with nothing
% (i.e. delete macro/command-related stuff - it's not allowed for the tikz node name
% ***WARNING***
% This may not cover all commands... it may need to be updated or added to eventually
% to account for additional complicated situations
\regex_replace_all:nnN { [\\]([^\\]*?)[\{]|[\}] } {} \l_tikzvowel_stripped_label_tl
\regex_replace_all:nnN { [\\]([^\\]*?)\s+ } {} \l_tikzvowel_stripped_label_tl
% Check if vowel label/name has no location value specified
\IfNoValueTF {#1}
{%
% Vowel label/name has no location value specified
\tl_gput_right:Nx \g_tikzvowel_nodes_tl
{%
\exp_not:N \node ( \exp_not:V \l_tikzvowel_stripped_label_tl )
[vowelLetter]
at ( \tl_use:c { g_tikzvowel_xV\int_use:N \l_tikzvowel_cardinal_vowel_number_int _tl } ,
\tl_use:c { g_tikzvowel_yV\int_use:N \l_tikzvowel_cardinal_vowel_number_int _tl } )
{\exp_not:n {#2}};%
}%
}
{%
% Vowel label/name has location value specified
% check if location value is 'center'
\tl_if_eq:nnTF { #1 } { center }
{%
% Location value is 'center'
% so, NO dot
% AND place label/name at the center
\tl_gput_right:Nx \g_tikzvowel_nodes_tl
{%
\exp_not:N \node ( \exp_not:V \l_tikzvowel_stripped_label_tl )
[vowelLetter]
at ( \tl_use:c { g_tikzvowel_xV\int_use:N \l_tikzvowel_cardinal_vowel_number_int _tl } ,
\tl_use:c { g_tikzvowel_yV\int_use:N \l_tikzvowel_cardinal_vowel_number_int _tl } )
{\exp_not:n {#2}};%\exp_not:n {#2
}%
}
{%
% Location value is not 'center'
% so, need a dot at the node
% AND need to place the label/name at specified location
\tl_gput_right:Nx \g_tikzvowel_nodes_tl
{%
\exp_not:N \node ( \exp_not:V \l_tikzvowel_stripped_label_tl )
[vowelDot,
label={[vowelLabel,
#1=of~\exp_not:V \l_tikzvowel_stripped_label_tl,
anchor=mid]\exp_not:n {#2}}]
at ( \tl_use:c { g_tikzvowel_xV\int_use:N \l_tikzvowel_cardinal_vowel_number_int _tl } ,
\tl_use:c { g_tikzvowel_yV\int_use:N \l_tikzvowel_cardinal_vowel_number_int _tl } )
{};%
}%
}%
}%
}%
%----------------------------------------------------------------------
% Create (custom) vowel node at X, Y coordinates with a label (or name)
% -argument #1 (optional) is the location of the label (if unspecified, `center' is default)
% -see TikZ for details and all available values
% -available values (typical):
% `center' [default]
% `left'
% `right'
% `above'
% `below'
% `above left'
% `above right'
% `below left'
% `below right'
% -argument #2 (required) is the vowel node label/name
% -argument #3 (required) is the vowel node location defined by (X, Y) or X,Y
% -notation should be `x,y' (spaces are irrelevant)
%----------------------------------------------------------------------
\DeclareDocumentCommand{\xyvowel}{ O{center} m D(){} }
{%
% Error checking for #3 (vowel node location) - is empty?
\tl_if_empty:nT {#3}
{ \PackageError{tikz-vowel:\xyvowel}{Vowel~node~location~is~undefined}{} }
% Error checking for #3 (vowel node location) - is blank?
\tl_if_blank:nT {#3}
{ \PackageError{tikz-vowel:\xyvowel}{Vowel~node~location~is~undefined}{} }
% Error checking for #3 (vowel node location) -
% Contains unwanted letters/numbers/characters?
\regex_match:nnT { [^0-9\-.,()] } { #3 }
{%
% Unexpected character(s) found - throw error
\PackageError{tikz-vowel:\xyvowel}
{Vowel~node~'#3'~is~invalid.~
Must~be~x-axis~and~y-axis~coordinates.~
Correct~syntax~is~'(X,Y)'.~
X~and~Y~must~be~an~integer~or~decimal~value}
{}%
}%
% Split the values for X and Y, based on a comma
\regex_split:nnNF { , } { #3 } \l_tikzvowel_coordinates_seq
{%
% No , character was found - throw error.
\PackageError{tikz-vowel:\xyvowel}
{Vowel~'#2'~has~invalid~location~'#3'.~
Must~be~x-axis~and~y-axis~coordinates,~separated~by~a~comma.~
Correct~syntax~is~'(X,Y)'.~
X~and~Y~must~be~an~integer~or~decimal~value}
{}%
}%
% Error check -
% Check if less than 1 element in the sequence (this should never happen).
\int_compare:nNnTF { \seq_count:N \l_tikzvowel_coordinates_seq } < { 1 }
{%
% If less than 1, something serious occurred - throw error.
\PackageError{tikz-vowel:\xyvowel}
{Vowel~'#2'~has~invalid~location~'#3'.~
Must~be~x-axis~and~y-axis~coordinates,~separated~by~a~comma.~
Correct~syntax~is~'(X,Y)'.~
X~and~Y~must~be~an~integer~or~decimal~value}
{}%
}
{%
% Error check -
% Check if greater than 2 elements in the sequence
\int_compare:nNnTF { \seq_count:N \l_tikzvowel_coordinates_seq } > { 2 }
{%
% If greater than 2, user typed something wrong - throw error.
\PackageError{tikz-vowel:\xyvowel}
{Vowel~'#2'~has~invalid~location~'#3'.~
Must~be~x-axis~and~y-axis~coordinates,~separated~by~a~comma.~
Correct~syntax~is~'(X,Y)'.~
X~and~Y~must~be~an~integer~or~decimal~value}
{}%
}%
}%
% Call \anyvowel command.
\anyvowel [#1]
{#2}
{\seq_item:Nn \l_tikzvowel_coordinates_seq {1}}
{\seq_item:Nn \l_tikzvowel_coordinates_seq {2}}%
}%
%----------------------------------------------------------------------
% Create (custom) vowel node at X, Y coordinates with a label (or name)
% -argument #1 (optional) is the location of the label (if unspecified, `center' is default)
% -see TikZ for details and all available values
% -available values (typical):
% `center' [default]
% `left'
% `right'
% `above'
% `below'
% `above left'
% `above right'
% `below left'
% `below right'
% -argument #2 (required) is the vowel node label/name
% -argument #3 (required) is the vowel node X coordinate location
% -argument #4 (required) is the vowel node Y coordinate location
%----------------------------------------------------------------------
\DeclareDocumentCommand{\anyvowel}{ O{center} m m m }
{%
% Error checking for #2 (vowel label/name) - is empty?
\tl_if_empty:nT {#2}
{ \PackageError{tikz-vowel:\anyvowel}{Label/name~for~vowel~node~is~undefined}{} }
% Error checking for #3 (vowel node X coordinate) - is empty?
\tl_if_empty:nT {#3}
{ \PackageError{tikz-vowel:\anyvowel}{Vowel~x-axis~value~is~undefined}{} }
% Error checking for #4 (vowel node Y coordinate) - is empty?
\tl_if_empty:nT {#4}
{ \PackageError{tikz-vowel:\anyvowel}{Vowel~y-axis~value~is~undefined}{} }
% Error checking for #2 (vowel label/name) - is blank?
\tl_if_blank:nT {#2}
{ \PackageError{tikz-vowel:\anyvowel}{Label/name~for~vowel~node~is~undefined}{} }
% Error checking for #3 (vowel node X coordinate) - is blank?
\tl_if_blank:nT {#3}
{ \PackageError{tikz-vowel:\anyvowel}{Vowel~x-axis~value~is~undefined}{} }
% Error checking for #4 (vowel node X coordinate) - is blank?
\tl_if_blank:nT {#4}
{ \PackageError{tikz-vowel:\anyvowel}{Vowel~y-axis~value~is~undefined}{} }
% Error checking for #3 (vowel x-axis value) - contains unwanted letters/numbers/characters?
\regex_match:nfT {[^0-9\-\.]} { #3 }
{%
% Unexpected character(s) found - throw error
\PackageError{tikz-vowel:\anyvowel}
{Vowel~x-axis~value~'#3'~is~invalid.~
Must~be~an~integer~or~decimal}
{}%
}%
% Error checking for #4 (vowel y-axis value) - contains unwanted letters/numbers/characters?
\regex_match:nfT {[^0-9\-\.]} { #4 }
{%
% Unexpected character(s) found - throw error
\PackageError{tikz-vowel:\anyvowel}
{Vowel~x-axis~value~'#4'~is~invalid.~
Must~be~an~integer~or~decimal}
{}%
}%
% Warning check -
% Is the vowel X-axis coordinate is less than 0 (vowel chart is between 0 and 4 width)?
\fp_compare:nNnTF { #3 } < { 0 }
{%
% X-axis coordinate is less than 0 - throw warning
\PackageWarning{tikz-vowel:\anyvowel}
{Vowel~'#2'~at~X~value~'#3'~(i.e.~less~than~0).~
The~X-axis~for~the~vowel~chart~starts~at~0~(left~side)~
and~goes~to~4~(right~side).~
You~can~go~outside~this,~but~your~vowel~placement~may~be~unexpected.}
{}%
}
{%
% Warning check -
% Is the vowel X-axis coordinate is greater than 4 (vowel chart is between 0 and 4 width)?
\fp_compare:nNnT { #3 } > { 4 }
{%
% X-axis coordinate is greater than 4 - throw warning
\PackageWarning{tikz-vowel:\anyvowel}
{Vowel~'#2'~at~X~value~'#3'~(i.e.~greater~than~4).~
The~X-axis~for~the~vowel~chart~starts~at~0~(left~side)~
and~goes~to~4~(right~side).~
You~can~go~outside~this,~but~your~vowel~placement~may~be~unexpected.}
{}%
}%
}%
% Warning check -
% Is the vowel Y-axis coordinate is less than 0 (vowel chart is between 0 and 3 height)?
\fp_compare:nNnTF { #4 } < { 0 }
{%
% Y-axis coordinate is less than 0 - throw warning
\PackageWarning{tikz-vowel:\anyvowel}
{Vowel~'#2'~at~Y~value~'#4'~(i.e.~less~than~0).~
The~Y-axis~for~the~vowel~chart~starts~at~0~(bottom~side)~
and~goes~to~3~(top~side).~
You~can~go~outside~this,~but~your~vowel~placement~may~be~unexpected.}
{}%
}
{%
% Warning check -
% Is the vowel X-axis coordinate is greater than 3 (vowel chart is between 0 and 3 height)?
\fp_compare:nNnT { #4 } > { 3 }
{%
% Y-axis coordinate is greater than 3 - throw warning
\PackageWarning{tikz-vowel:\anyvowel}
{Vowel~'#2'~at~Y~value~'#4'~(i.e.~greater~than~3).~
The~Y-axis~for~the~vowel~chart~starts~at~0~(bottom~side)~
and~goes~to~3~(top~side).~
You~can~go~outside~this,~but~your~vowel~placement~may~be~unexpected.}
{}%
}%
}%
% Set the token list to the string value (NOT actual macros/commands) of the label/name
\tl_set:Nx \l_tikzvowel_stripped_label_tl { \tl_to_str:n {#2} }
% Replace anything matching a command ( \ NAME { ) or a closing curly bracket with nothing
% (i.e. delete macro/command-related stuff - it's not allowed for the tikz node name
% ***WARNING***
% This may not cover all commands... it may need to be updated or added to eventually
% to account for additional complicated situations
\regex_replace_all:nnN { [\\]([^\\]*?)[\{]|[\}] } {} \l_tikzvowel_stripped_label_tl
\regex_replace_all:nnN { [\\]([^\\]*?)\s+ } {} \l_tikzvowel_stripped_label_tl
% Check if vowel label/name has no location value specified
\IfNoValueTF {#1}
{%
% Vowel label/name has no location value specified
\tl_gput_right:Nx \g_tikzvowel_nodes_tl
{%
\exp_not:N \node ( \exp_not:V \l_tikzvowel_stripped_label_tl )
[vowelLetter]
at ( #3 , #4 )
{\exp_not:n {#2}};%
}%
}
{%
% Vowel label/name has location value specified
% check if location value is 'center'
\tl_if_eq:nnTF { #1 } { center }
{%
% Location value is 'center'
% so, NO dot
% AND place label/name at the center
\tl_gput_right:Nx \g_tikzvowel_nodes_tl
{%
\exp_not:N \node ( \exp_not:V \l_tikzvowel_stripped_label_tl )
[vowelLetter]
at ( #3 , #4 )
{\exp_not:n {#2}};%
}%
}
{%
% Location value is not 'center'
% so, need a dot at the node
% AND need to place the label/name at specified location
\tl_gput_right:Nx \g_tikzvowel_nodes_tl
{%
\exp_not:N \node ( \exp_not:V \l_tikzvowel_stripped_label_tl )
[vowelDot,
label={[vowelLabel,
#1=of~\exp_not:V \l_tikzvowel_stripped_label_tl,
anchor=mid]\exp_not:n {#2}}]
at ( #3 , #4 )
{};%
}%
}%
}%
}%
%----------------------------------------------------------------------
% Diphthong between two cardinal vowels
% -argument #1 (optional) is the bend of the line (left or right)
% -argument #2 (required) is the starting point (coordinate/node) for the line
% -argument #3 (optional) is the degree of bend in the line (0 = straight line)
% -argument #4 (required) is the ending point (coordinate/node) for the line
% -argument #5 (optional) is the label for the diphthong
%----------------------------------------------------------------------
\DeclareDocumentCommand{\cardinaldiphthong}{ O{left} m O{15} m O{} }
{%
% Error checking for #2 (cardinal vowel at diphthong starting point) - is empty?
\tl_if_empty:nT {#2}
{ \PackageError{tikz-vowel:\cardinaldiphthong}
{Cardinal~vowel~at~diphthong~starting~point~is~undefined}{} }
% Error checking for #4 (cardinal vowel at diphthong ending point) - is empty?
\tl_if_empty:nT {#4}
{ \PackageError{tikz-vowel:\cardinaldiphthong}
{Cardinal~vowel~at~diphthong~ending~point~is~undefined}{} }
% Error checking for #2 (cardinal vowel at diphthong starting point) - is blank?
\tl_if_blank:nT {#2}
{ \PackageError{tikz-vowel:\cardinaldiphthong}
{Cardinal~vowel~at~diphthong~starting~point~is~undefined}{} }
% Error checking for #4 (cardinal vowel at diphthong ending point) - is blank?
\tl_if_blank:nT {#4}
{ \PackageError{tikz-vowel:\cardinaldiphthong}
{Cardinal~vowel~at~diphthong~ending~point~is~undefined}{} }
%------------------------------------------------------------------------------------------------
% Draw a line from cardinal vowel #2 to cardinal vowel #4
% - put label #5 at the center point of the line
% If there is no label specified (or it's blank), then draw no label at the center.
\tl_if_blank:nTF {#5}
{%
\tl_gput_right:Nx \g_tikzvowel_draw_tl
{%
%\exp_not:N \node ( \exp_not:V \l_tikzvowel_stripped_label_tl )
\exp_not:N \draw[diphthongLine,
bend~#1=#3,
name~path=#2to#4]
(#2) % Cardinal vowel (start)
to
(#4);% Cardinal vowel (end)
}%
}
{% Otherwise, label is specified. Print it at center point of line.
% Set the token list to the string value (NOT actual macros/commands) of the label/name
\tl_set:Nx \l_tikzvowel_stripped_label_tl { \tl_to_str:n {#5} }
% Replace anything matching a command ( \ NAME { ) or a closing curly bracket with nothing
% (i.e. delete macro/command-related stuff - it's not allowed for the tikz node name
% ***WARNING***
% This may not cover all commands... it may need to be updated or added to eventually
% to account for additional complicated situations
\regex_replace_all:nnN { [\\]([^\\]*?)[\{]|[\}] } {} \l_tikzvowel_stripped_label_tl
\regex_replace_all:nnN { [\\]([^\\]*?)\s+ } {} \l_tikzvowel_stripped_label_tl
\tl_gput_right:Nx \g_tikzvowel_draw_tl
{%
\exp_not:N \draw[diphthongLine,
bend~#1=#3,
name~path=\exp_not:V \l_tikzvowel_stripped_label_tl]
(#2) % Cardinal vowel (start)
to~
node [diphthongLabel] {\exp_not:n {#5}}
(#4);% Cardinal vowel (end)
}%
}%
}%
%----------------------------------------------------------------------
% Diphthong from cardinal vowel to specified x,y point
% -argument #1 (optional) is the bend of the line (left or right)
% -argument #2 (required) is the starting point (coordinate/node) for the line
% -argument #3 (optional) is the degree of bend in the line (0 = straight line)
% -argument #4 (required) is the ending (X,Y) point (coordinate/node) for the line
% -argument #5 (optional) is the label for the diphthong
%----------------------------------------------------------------------
\DeclareDocumentCommand{\cardinaltoxydiphthong}{ O{left} m O{15} D(){} O{}}
{%
% Error checking for #4 (vowel node X,Y location) - is empty?
\tl_if_empty:nT {#4}
{ \PackageError{tikz-vowel:\cardinaltoxydiphthong}{Vowel~node~location~is~undefined}{} }
% Error checking for #4 (vowel node X,Y location) - is blank?
\tl_if_blank:nT {#4}
{ \PackageError{tikz-vowel:\cardinaltoxydiphthong}{Vowel~node~location~is~undefined}{} }
% Error checking for #3 (vowel node location) -
% Contains unwanted letters/numbers/characters?
\regex_match:nnT { [^0-9\-.,\s] } { #4 }
{%
% Unexpected character(s) found - throw error
\PackageError{tikz-vowel:\cardinaltoxydiphthong}
{Diphthong~node~ending~at~(#4)~is~invalid.~
Must~be~x-axis~and~y-axis~coordinates.~
Correct~syntax~is~'(X,Y)'.~
X~and~Y~must~be~an~integer~or~decimal~value}
{}%
}%
% Split the values for X and Y, based on a comma
\regex_split:nnNF { , } { #4 } \l_tikzvowel_coordinates_seq
{%
% No , character was found - throw error.
\PackageError{tikz-vowel:\cardinaltoxydiphthong}
{Diphthong~node~ending~at~(#4)~is~invalid.~
Must~be~x-axis~and~y-axis~coordinates,~separated~by~a~comma.~
Correct~syntax~is~'(X,Y)'.~
X~and~Y~must~be~an~integer~or~decimal~value}
{}%
}%
% Error check -
% Check if less than 1 element in the sequence (this should never happen).
\int_compare:nNnTF { \seq_count:N \l_tikzvowel_coordinates_seq } < { 1 }
{%
% If less than 1, something serious occurred - throw error.
\PackageError{tikz-vowel:\cardinaltoxydiphthong}
{Diphthong~node~ending~at~(#4)~is~invalid.~
Must~be~x-axis~and~y-axis~coordinates,~separated~by~a~comma.~
Correct~syntax~is~'(X,Y)'.~
X~and~Y~must~be~an~integer~or~decimal~value}
{}%
}
{%
% Error check -
% Check if greater than 2 elements in the sequence
\int_compare:nNnTF { \seq_count:N \l_tikzvowel_coordinates_seq } > { 2 }
{%
% If greater than 2, user typed something wrong - throw error.
\PackageError{tikz-vowel:\cardinaltoxydiphthong}
{Diphthong~node~ending~at~'#5'~is~invalid.~
Must~be~x-axis~and~y-axis~coordinates,~separated~by~a~comma.~
Correct~syntax~is~'(X,Y)'.~
X~and~Y~must~be~an~integer~or~decimal~value}
{}%
}%
}%
% Call \cardinaltoanydiphthong with the X, Y location specified
\cardinaltoanydiphthong [#1]
{#2}
[#3]
{\seq_item:Nn \l_tikzvowel_coordinates_seq {1}}
{\seq_item:Nn \l_tikzvowel_coordinates_seq {2}}
[#5]
}%
%----------------------------------------------------------------------
% Diphthong from cardinal vowel to specified x,y point
% -argument #1 (optional) is the bend of the line (left or right)
% -argument #2 (required) is the starting point (coordinate/node) for the line
% -argument #3 (optional) is the degree of bend in the line (0 = straight line)
% -argument #4 (required) is the ending X point (coordinate/node) for the line
% -argument #5 (required) is the ending Y point (coordinate/node) for the line
% -argument #6 (optional) is the label for the diphthong
%----------------------------------------------------------------------
\DeclareDocumentCommand{\cardinaltoanydiphthong}{ O{left} m O{15} m m O{} }
{%
% Error checking for #2 (cardinal vowel at diphthong starting point) - is empty?
\tl_if_empty:nT {#2}
{ \PackageError{tikz-vowel:\cardinaltoanydiphthong}
{Cardinal~vowel~at~diphthong~starting~point~is~undefined}{} }
% Error checking for #4 (vowel x-axis ending point) - is empty?
\tl_if_empty:nT {#4}
{ \PackageError{tikz-vowel:\cardinaltoanydiphthong}
{Diphthong~x-axis~ending~point~is~undefined}{} }
% Error checking for #5 (vowel y-axis ending point) - is empty?
\tl_if_empty:nT {#5}
{ \PackageError{tikz-vowel:\cardinaltoanydiphthong}
{Diphthong~y-axis~ending~point~is~undefined}{} }
% Error checking for #2 (cardinal vowel at diphthong starting point) - is blank?
\tl_if_blank:nT {#2}
{ \PackageError{tikz-vowel:\cardinaltoanydiphthong}
{Cardinal~vowel~at~diphthong~starting~point~is~undefined}{} }
% Error checking for #4 (vowel x-axis ending point) - is blank?
\tl_if_blank:nT {#4}
{ \PackageError{tikz-vowel:\cardinaltoanydiphthong}
{Diphthong~x-axis~ending~point~is~undefined}{} }
% Error checking for #5 (vowel y-axis ending point) - is blank?
\tl_if_blank:nT {#5}
{ \PackageError{tikz-vowel:\cardinaltoanydiphthong}
{Diphthong~y-axis~ending~point~is~undefined}{} }
%------------------------------------------------------------------------------------------------
% Draw a line from cardinal vowel #2 to node (#4 ,#5)
% - put label #6 at the center point of the line
% If there is no label specified (or it's blank), then draw no label at the center.
\tl_if_blank:nTF {#6}
{%
\tl_gput_right:Nx \g_tikzvowel_draw_tl
{%
\exp_not:N \draw[diphthongLine,
bend~#1=#3,
name~path=#2to#4#5]
(#2) % Cardinal vowel
to
(#4 ,#5);%X, Y coordinates
}%
}
{% Otherwise, label is specified. Print it at center point of line.
% Set the token list to the string value (NOT actual macros/commands) of the label/name
\tl_set:Nx \l_tikzvowel_stripped_label_tl { \tl_to_str:n {#6} }
% Replace anything matching a command ( \ NAME { ) or a closing curly bracket with nothing
% (i.e. delete macro/command-related stuff - it's not allowed for the tikz node name
% ***WARNING***
% This may not cover all commands... it may need to be updated or added to eventually
% to account for additional complicated situations
\regex_replace_all:nnN { [\\]([^\\]*?)[\{]|[\}] } {} \l_tikzvowel_stripped_label_tl
\regex_replace_all:nnN { [\\]([^\\]*?)\s+ } {} \l_tikzvowel_stripped_label_tl
\tl_gput_right:Nx \g_tikzvowel_draw_tl
{%
\exp_not:N \draw[diphthongLine,
bend~#1=#3,
name~path=\exp_not:V \l_tikzvowel_stripped_label_tl]
(#2) % Cardinal vowel
to~
node [diphthongLabel] {\exp_not:n {#6}}
(#4 ,#5);%X, Y coordinates
}%
}%
}%
%----------------------------------------------------------------------
% Diphthong from specified x,y point to cardinal vowel
% -argument #1 (optional) is the bend of the line (left or right)
% -argument #2 (required) is the starting X, Y point (coordinate/node) for the line
% -argument #3 (optional) is the degree of bend in the line (0 = straight line)
% -argument #4 (required) is the ending point (coordinate/node) for the line
% -argument #5 (optional) is the label for the diphthong
%----------------------------------------------------------------------
\DeclareDocumentCommand{\xytocardinaldiphthong}{ O{left} D(){} O{15} m O{} }
{%
% Error checking for #2 (vowel node X,Y location) - is empty?
\tl_if_empty:nT {#2}
{ \PackageError{tikz-vowel:\xytocardinaldiphthong}{Vowel~node~location~is~undefined}{} }
% Error checking for #2 (vowel node X,Y location) - is blank?
\tl_if_blank:nT {#2}
{ \PackageError{tikz-vowel:\xytocardinaldiphthong}{Vowel~node~location~is~undefined}{} }
% Error checking for #3 (vowel node location) -
% Contains unwanted letters/numbers/characters?
\regex_match:nnT { [^0-9\-.,\s] } { #2 }
{%
% Unexpected character(s) found - throw error
\PackageError{tikz-vowel:\xytocardinaldiphthong}
{Diphthong~node~ending~at~(#2)~is~invalid.~
Must~be~x-axis~and~y-axis~coordinates.~
Correct~syntax~is~'(X,Y)'.~
X~and~Y~must~be~an~integer~or~decimal~value}
{}
}
% Split the values for X and Y, based on a comma
\regex_split:nnNF { , } { #2 } \l_tikzvowel_coordinates_seq
{%
% No , character was found - throw error.
\PackageError{tikz-vowel:\xytocardinaldiphthong}
{Diphthong~node~ending~at~(#2)~is~invalid.~
Must~be~x-axis~and~y-axis~coordinates,~separated~by~a~comma.~
Correct~syntax~is~'(X,Y)'.~
X~and~Y~must~be~an~integer~or~decimal~value}
{}
}
% Error check -
% Check if less than 1 element in the sequence (this should never happen).
\int_compare:nNnTF { \seq_count:N \l_tikzvowel_coordinates_seq } < { 1 }
{%
% If less than 1, something serious occurred - throw error.
\PackageError{tikz-vowel:\xytocardinaldiphthong}
{Diphthong~node~ending~at~(#2)~is~invalid.~
Must~be~x-axis~and~y-axis~coordinates,~separated~by~a~comma.~
Correct~syntax~is~'(X,Y)'.~
X~and~Y~must~be~an~integer~or~decimal~value}
{}
}
{%
% Error check -
% Check if greater than 2 elements in the sequence
\int_compare:nNnTF { \seq_count:N \l_tikzvowel_coordinates_seq } > { 2 }
{%
% If greater than 2, user typed something wrong - throw error.
\PackageError{tikz-vowel:\xytocardinaldiphthong}
{Diphthong~node~ending~at~'#2'~is~invalid.~
Must~be~x-axis~and~y-axis~coordinates,~separated~by~a~comma.~
Correct~syntax~is~'(X,Y)'.~
X~and~Y~must~be~an~integer~or~decimal~value}
{}
}%
}%