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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
|
%GregorioTeX file.
%
% Copyright (C) 2007-2015 The Gregorio Project (see CONTRIBUTORS.md)
%
% This file is part of Gregorio.
%
% Gregorio is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Gregorio is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Gregorio. If not, see <http://www.gnu.org/licenses/>.
% this file contains definitions of spaces
\gre@debugmsg{general}{Loading gregoriotex-spaces.tex}%
\gre@declarefileversion{gregoriotex-spaces.tex}{4.1.2}% GREGORIO_VERSION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% macros for tuning penalties
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% The following macros enable users to tune penalties used in Gregorio
% macro to force a break on a new line
\def\GreForceBreak{\gre@penalty{\grenewlinepenalty}}%
% macro to prevent a line break
\def\GreNoBreak{\gre@penalty{\grenobreakpenalty}}%
%% The following macros cancel some useless penalties, and reinstates them
%% at the end of a score
\def\gre@cancelpenalties{%
\xdef\gre@hyphenpenaltysave{\the\hyphenpenalty }%
\xdef\gre@exhyphenpenaltysave{\the\exhyphenpenalty }%
\xdef\gre@doublehyphendemeritssave{\the\doublehyphendemerits }%
\xdef\gre@finalhyphendemeritssave{\the\finalhyphendemerits }%
\xdef\gre@brokenpenaltysave{\the\brokenpenalty }%
\hyphenpenalty=\grehyphenpenalty\relax %
\exhyphenpenalty=\grehyphenpenalty\relax %
\doublehyphendemerits=0\relax %
\finalhyphendemerits=0\relax %
\brokenpenalty=\grebrokenpenalty\relax %
\xdef\gre@loosenesssave{\the\looseness}%
\xdef\gre@tolerancesave{\the\tolerance}%
\xdef\gre@pretolerancesave{\the\pretolerance}%
\xdef\gre@emergencystretchsave{\the\emergencystretch}%
\xdef\gre@widowpenaltysave{\the\widowpenalty}%
\xdef\gre@clubpenaltysave{\the\clubpenalty}%
\looseness=\grelooseness %
\tolerance=\gretolerance %
\pretolerance=\grepretolerance %
\emergencystretch=\greemergencystretch %
\widowpenalty=\grewidowpenalty %
\clubpenalty=\greclubpenalty %
}%
\def\gre@restorepenalties{%
\hyphenpenalty=\gre@hyphenpenaltysave %
\exhyphenpenalty=\gre@exhyphenpenaltysave %
\doublehyphendemerits=\gre@doublehyphendemeritssave %
\finalhyphendemerits=\gre@finalhyphendemeritssave %
\brokenpenalty=\gre@brokenpenaltysave %
\looseness=\gre@loosenesssave %
\tolerance=\gre@tolerancesave %
\pretolerance=\gre@pretolerancesave %
\emergencystretch=\gre@emergencystretchsave %
\widowpenalty=\gre@widowpenaltysave %
\clubpenalty=\gre@clubpenaltysave %
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% macros for the typesetting of spaces
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Independent default distances are defined in gsp-default.tex. The distances defined here are calculated from those distances.
%%%%%%%%%%%%%%%%%
%% Global distances
%%%%%%%%%%%%%%%%%
% textlower is the height of the separation between the bottom line (which is invisible : for the notes which are very low) and the bottom of the text
\newdimen\gre@dimen@textlower\relax%
\def\gre@calculate@textlower{%
\gre@dimen@textlower=\gre@space@dimen@spacebeneathtext\relax%
%\advance\gre@dimen@textlower by \translationheight
}%
% stafflinewidth is the width of a line of staff, this can vary, for example at the first line
\newdimen\gre@dimen@stafflinewidth\relax%
\def\gre@calculate@stafflinewidth{%
\gre@dimen@stafflinewidth=\gre@dimen@linewidth\relax%
}%
% linewidth is the width of a line of a score (including the initial)
\newdimen\gre@dimen@linewidth\relax%
\def\gre@calculate@linewidth{%
\gre@dimen@linewidth=\hsize %
}%
% Messing with the staff line thickness directly is messy, so we provide the following interface to make life easier on the user:
% stafflineheight is the height of a staff line
% = 1500 * stafflinefactor
\newdimen\gre@dimen@stafflineheight\relax%
\def\gre@calculate@stafflineheight{%
\global\gre@dimen@stafflineheight=\dimexpr(1500 sp * \gre@stafflinefactor)\relax %
}%
% interstafflinespace is the space between two lines of staff
% = (30000 - (stafflineheight/gre@factor - 1500)) * gre@factor = 31500 * gre@factor - stafflineheight
\newdimen\gre@dimen@interstafflinespace\relax%
\def\gre@calculate@interstafflinespace{%
\global\gre@dimen@interstafflinespace=\dimexpr((31500sp * \gre@factor) %
- \gre@dimen@stafflineheight)\relax%
}%
% a distance to help place glyphs when the lines are not their default thickness
% = (stafflineheight/gre@factor - 1500sp)/2 * gre@factor
\newdimen\gre@dimen@stafflinediff\relax%
\def\gre@calculate@stafflinediff{%
\global\gre@dimen@stafflinediff = \dimexpr(%
( ( ( \gre@dimen@stafflineheight %
/ \gre@factor)%
- 1500sp)%
/ 2)%
* \gre@factor)\relax%
}%
% the default factor
% the stafflinefactor follows the same scale as the gre@factor, i.e. a stafflinefactor corresponds to the default staff line thickness for gre@factor 17, stafflinefactor 34 corresponds to the default staff line thickness for gre@factor 34, etc.
\xdef\gre@stafflinefactor{17}%
% flag for whether the stafflinefactor should scale with changes of the gre@factor
\newif\ifgre@scale@stafflinefactor%
\gre@scale@stafflinefactortrue
% a macro for setting the thickness of the staff lines. This changes the stafflinefactor and then adjusts the spaces that are affected by the thicker staff lines.
\def\grechangestafflinethickness#1{%
\xdef\gre@stafflinefactor{#1}%
\relax %
}%
\def\setstafflinethickness{%OBSOLETE
\gre@obsolete{\protect\setstafflinethickness}{\protect\grechangestafflinethickness}%
}%
%constantglyphraise is the space between the 0 of the gregorian fonts and the effective 0 of the TeX score
\newdimen\gre@dimen@constantglyphraise\relax%
% to calculate that, we take the bottom of the third line : it is at 200 in the fonts, and it must be at grespacelinestext + grespacebeneathtext + 2*greinterstafflinespace + 2*grestafflineheight + translationheight
\def\gre@calculate@constantglyphraise{%
\global\gre@dimen@constantglyphraise = \dimexpr((-22000 sp * \gre@factor) %
+ \gre@dimen@additionalbottomspace %
+ \gre@space@dimen@spacebeneathtext %
+ \gre@space@dimen@spacelinestext %
+ \gre@dimen@interstafflinespace %
+ \gre@dimen@interstafflinespace %
+ \gre@dimen@stafflineheight %
+ \gre@dimen@stafflineheight %
+ \gre@dimen@currenttranslationheight %
% an adjustment in the case of big lines
+ \gre@dimen@stafflinediff)\relax%
\relax %
}%
%% Here is the function to compute some more vertical spaces from the basic values
\newdimen\gre@dimen@staffheight\relax%
\def\gre@calculate@staffheight{%
\global\gre@dimen@staffheight = \dimexpr %
\gre@stafflines\gre@dimen@stafflineheight %
+ \gre@stafflines\gre@dimen@interstafflinespace %
- \gre@dimen@interstafflinespace\relax%
\relax %
}%
% A routine that simply aggregates the above global space calculating routines so we can easily update all when needed.
%% Note: It used to be that some distance calculating functions called others. Since this can create problems with circularity if one is not careful, this is no longer the case. Now all distance calculating functions simply calculate their respective distance. This means that dependent distances are not necessarily recalculated when an individual distance is recalculated. This function updates all global calculated distances and in the order needed for the dependencies.
%% Dependencies:
%% textlower: spacebeneathtext
%% linewidth: hsize
%% stafflinewidth: linewidth
%% stafflineheight: stafflinefactor & gre@factor
%% interstafflinespace: stafflineheight & gre@factor
%% stafflinediff: stafflineheight & gre@factor
%% staffheight: stafflineheight & interstafflinespace
%% constantglyphraise: gre@factor, additionalbottomspace, spacebeneathtext, spacelinestext, interstafflinespace, stafflineheight, currenttranslationheight, stafflinediff
\def\gre@computespaces{%
\gre@calculate@textlower%
\gre@calculate@linewidth%
\gre@calculate@stafflinewidth%
\gre@calculate@stafflineheight%
\gre@calculate@interstafflinespace%
\gre@calculate@stafflinediff%
\gre@calculate@staffheight%
\gre@calculate@constantglyphraise%
}%
\newskip\gre@skip@syllablefinalskip
\newskip\gre@skip@minTextDistance%
\newskip\gre@skip@minNotesDistance%
\newdimen\gre@dimen@curTextDistance%
\newdimen\gre@dimen@curNotesDistance%
\newskip\gre@skip@minShiftText%
\newskip\gre@skip@minShiftNotes%
%% @desc Macro computing the skip at the end of the syllable
%% @arg#1 0 if end of syllable, 1 if end of word
%% @arg#2 0 if next syllable is normal, 1 if it's a bar, 2 if it starts with
%% an alteration
%%
%% @uses \gre@dimen@enddifference
%% @uses \gre@skip@nextbegindifference
%%
%% Pseudo-code:
%% min_text_dist = same_word ? 0 : space_inter_words
%% if (no_txt_under_prev) :
%% tmp = cur_end_diff > 0 ? 0 : -cur_end_diff
%% min_text_dist = max(min_text_dist, tmp)
%% min_notes_dist = space_between_notes
%% if (barres sur cur ou barres sur next):
%% min_notes_dist = space_between_bars
%% % space between end of syllable and current point for previous note
%% cur_dist_notes = cur_dist_text = 0
%% if (cur_end_diff < 0):
%% cur_dist_text += -cur_end_diff
%% else:
%% cur_dist_notes += cur_end_diff
%% if (next_begin_diff < 0):
%% cur_dist_notes += -next_begin_diff
%% else:
%% cur_dist_text += next_begin_diff
%% min_shift_text = min_dist_text - cur_dist_text
%% min_shift_notes = min_dist_notes - cur_dist_notes
%% shift = max(min_shift_text, min_shift_notes)
\def\gre@calculate@syllablefinalskip#1#2{%
%% min_text_dist = prev_cur_word ? 0 : space_inter_words
\ifnum#1=1\relax %
\ifgre@in@euouae %
\ifgre@newbarspacing%
\ifnum#2=1\relax %
\gre@skip@minTextDistance=\gre@space@dimen@interwordspacetext@bars@euouae\relax%
\else %
\gre@skip@minTextDistance=\gre@space@skip@interwordspacetext@euouae\relax%
\fi %
\else%
\gre@skip@minTextDistance=\gre@space@skip@interwordspacetext@euouae\relax%
\fi%
\else %
\ifgre@newbarspacing%
\ifnum#2=1\relax %
\gre@skip@minTextDistance=\gre@space@dimen@interwordspacetext@bars\relax%
\else %
\gre@skip@minTextDistance=\gre@space@skip@interwordspacetext\relax%
\fi %
\else%
\gre@skip@minTextDistance=\gre@space@skip@interwordspacetext\relax%
\fi%
\fi %
\else %
\gre@skip@minTextDistance=0pt\relax%
\fi %
\gre@debugmsg{syllablespacing}{ minTextDistance = \the\gre@skip@minTextDistance}%
% setting minNotesDistance (quite simple)
\ifcase#2\relax %
\ifnum#1=1\relax %
\ifgre@in@euouae %
\gre@skip@minNotesDistance=\gre@space@skip@interwordspacenotes@euouae\relax%
\else %
\gre@skip@minNotesDistance=\gre@space@skip@interwordspacenotes\relax%
\fi %
\else %
\gre@skip@minNotesDistance=\gre@space@dimen@intersyllablespacenotes\relax%
\fi %
\ifnum\gre@count@shiftaftermora>3\relax %
\ifgre@thisendswithmora %
% last syllable ends by a punctum mora, we want to ignore it.
% this sets the distance to shift into \gre@skip@temp@four:
\gre@get@unkern@aftermora{1}%
\advance\gre@skip@minNotesDistance by \gre@skip@punctummorashift %
\fi %
\fi %
\or %
\ifgre@newbarspacing %
\gre@skip@minNotesDistance=0pt\relax%
\else %
\gre@skip@minNotesDistance=\gre@space@skip@notebarspace\relax%
\fi %
\or %
\ifnum#1=1\relax %
\gre@skip@minNotesDistance=\gre@space@skip@interwordspacenotes@alteration\relax %
\else %
\gre@skip@minNotesDistance=\gre@space@dimen@intersyllablespacenotes@alteration\relax%
\fi %
\fi %
\gre@debugmsg{syllablespacing}{ minNotesDistance = \the\gre@skip@minNotesDistance}%
% determining current distance between notes and
% next notes, and current distance between text and next text
\gre@dimen@curTextDistance=0pt\relax%
\gre@dimen@curNotesDistance=0pt\relax%
%% cur_dist_notes = cur_dist_text = 0
%% if (cur_end_diff < 0):
%% cur_dist_notes += -cur_end_diff
%% else:
%% cur_dist_text += cur_end_diff
%% if (next_begin_diff < 0):
%% cur_dist_notes += -next_begin_diff
%% else:
%% cur_dist_text += next_begin_diff
\gre@debugmsg{syllablespacing}{ enddifference = \the\gre@dimen@enddifference}%
\gre@debugmsg{syllablespacing}{ nextbegindifference = \the\gre@skip@nextbegindifference}%
\ifdim\gre@dimen@enddifference < 0 pt\relax%
\gre@dimen@curNotesDistance = -\gre@dimen@enddifference\relax%
\else %
\gre@dimen@curTextDistance = \gre@dimen@enddifference\relax%
\fi %
\ifdim\gre@skip@nextbegindifference < 0 pt\relax%
\advance\gre@dimen@curNotesDistance by -\gre@skip@nextbegindifference\relax%
\else %
\advance\gre@dimen@curTextDistance by \gre@skip@nextbegindifference\relax%
\fi %
\gre@debugmsg{syllablespacing}{ curNotesDistance = \the\gre@dimen@curNotesDistance}%
\gre@debugmsg{syllablespacing}{ curTextDistance = \the\gre@dimen@curTextDistance}%
%% min_shift_text = min_dist_text - cur_dist_text
%% min_shift_notes = min_dist_notes - cur_dist_notes
%% shift = max(min_shift_text, min_shift_notes)
\gre@skip@minShiftText = \glueexpr(\gre@skip@minTextDistance - \gre@dimen@curTextDistance)\relax %
\gre@skip@minShiftNotes = \glueexpr(\gre@skip@minNotesDistance - \gre@dimen@curNotesDistance)\relax %
\gre@debugmsg{syllablespacing}{ minShiftNotes = \the\gre@skip@minShiftNotes}%
\gre@debugmsg{syllablespacing}{ minShiftText = \the\gre@skip@minShiftText}%
\ifdim\gre@skip@minShiftNotes < \gre@skip@minShiftText %
\global\gre@skip@syllablefinalskip = \gre@skip@minShiftText %
\else %
\global\gre@skip@syllablefinalskip = \gre@skip@minShiftNotes %
\fi %
\ifgre@showhyphenafterthissyllable %
\gre@debugmsg{syllablespacing}{ add intersyllablespacestretchhyphen (\gre@space@skip@intersyllablespacestretchhyphen)}%
\advance\gre@skip@syllablefinalskip by \gre@space@skip@intersyllablespacestretchhyphen\relax%
\fi %
\gre@debugmsg{syllablespacing}{ syllablefinalskip = \the\gre@skip@syllablefinalskip}%
\relax %
}
% dimen keeping the shift computed with next function
\newdimen\gre@dimen@bolshift
% dimen which is used to add a bit extra to the previous one in the case where the first glyph is a flat or a natural
\newdimen\gre@dimen@bolextra
%% @desc Macro used in \GreSyllable. Sets \gre@skip@bolshift to the left kern that
%% should appear at the beginning of a line in case of a linebreak.
%% The goal of this left kern is to have all lines aligned on notes. See
%% TODO for details.
%%
%% @arg#1 \gre@dimen@begindifference of the first syllable of the line
\def\gre@calculate@bolshift#1{%
\gre@skip@temp@three = 0pt\relax%
% bolextra is the space taken up by a leading alteration (it's 0 if there is no leading alteration)
% it's allowed to invade spaceafterlineclef, so long as it leaves at least beforealterationspace between itself and the clef
% and minimalspaceatlinebeginning between the lyrics and the beginning of the line
\gre@skip@temp@one = \glueexpr(\gre@space@skip@spaceafterlineclef-\gre@space@dimen@beforealterationspace)\relax%
\ifdim\gre@dimen@bolextra>\gre@skip@temp@one\relax%
\global\advance\gre@skip@temp@three by \gre@skip@temp@one\relax%
\else%
\global\advance\gre@skip@temp@three by \gre@dimen@bolextra\relax%
\fi%
\ifdim#1>0pt\relax%
% no additional shift is needed if the notes start before the text
\global\gre@dimen@bolshift = \gre@skip@temp@three\relax%
\else%
% as the \gre@dimen@bolshift is computed from skips, we compute it in
% a skip temp registry, and then "cast" it into a dimen
% basic value for bolshift needs to incorporate -begindifference
\advance\gre@skip@temp@three by -#1\relax%
% we don't want to kern more than clefwidth + spaceafterlineclef - minimalspaceatlinebeginning
% violating this would mean that either the notes are closer than (clefwidth + spaceafterlineclef)
% or that the lyrics are closer than minimalspaceatlinebeginning
\gre@skip@temp@one = \glueexpr(\gre@dimen@clefwidth %
+ \gre@space@skip@spaceafterlineclef %
- \gre@space@dimen@minimalspaceatlinebeginning)\relax %
\ifdim\gre@skip@temp@three < \gre@skip@temp@one %
\global\gre@dimen@bolshift = \dimexpr\gre@skip@temp@three\relax %
\else%
\global\gre@dimen@bolshift = \dimexpr\gre@skip@temp@one\relax %
\fi %
\fi%
\gre@debugmsg{bolshift}{ bolshift = \the\gre@dimen@bolshift}%
\relax %
}
% dimen keeping the shift computed with next function
\newdimen\gre@dimen@eolshift
\newcount\gre@count@protrusion@hyphen@eol %
% protrusion for hyphens inerted by Lua
\gre@count@protrusion@hyphen@eol = 50\relax
\def\gresethyphenprotrusion#1{%
\gre@count@protrusion@hyphen@eol = #1\relax %
\relax %
}
%% @desc Macro used in \GreSyllable. Sets \gre@dimen@eolshift to the right kern
%% that should appear before an end of line. When active this prevents
%% text from going under the custos.
%%
%% @arg#1 The \gre@dimen@enddifference of the corresponding syllable
\def\gre@calculate@eolshift#1{%
\gre@skip@temp@two=0pt\relax%
% we only need a shift if the lyrics are longer than the notes
\gre@debugmsg{eolshift}{eolshift called with enddifference: \the #1}%
\ifdim#1 <0pt\relax%
% we only need to shift if there is a custos being printed
\ifgre@blockeolcustos%
\gre@dimen@eolshift=0pt\relax%
\else%
% The basic value for the eol shift is -enddifference
\gre@skip@temp@two=-#1\relax%
% if there is a possible hyphen (added afterwards in lua), we keep some room for it
\ifgre@possibleluahyphenafterthissyllable %
\setbox\gre@box@temp@width=\hbox{\GreHyph}%
\advance\gre@skip@temp@two by -\dimexpr(\wd\gre@box@temp@width * ((100 - \gre@count@protrusion@hyphen@eol) / 100))\relax%
\gre@debugmsg{eolshift}{adjusted enddifference for protrusion: \the\gre@skip@temp@two}%
\fi %
% The maximum value is wd(custos) + spacebeforeeolcustos
% Were the eolshift larger than this the lyrics would stick out
% into the margin
\setbox\gre@box@temp@width=\hbox{\gre@pickcustos{\gre@pitch@g}}%
\gre@skip@temp@three = \glueexpr(\wd\gre@box@temp@width+\gre@space@skip@spacebeforeeolcustos)\relax%
\gre@debugmsg{eolshift}{custos + space before custos = \the\gre@skip@temp@three}%
% pick the smaller of the two values calculated above
\ifdim\gre@skip@temp@two>\gre@skip@temp@three%
\gre@debugmsg{eolshift}{imposing limit}%
\global\gre@dimen@eolshift = \gre@skip@temp@three%
\else%
\global\gre@dimen@eolshift = \gre@skip@temp@two%
\fi%
\fi %
\else%
\global\gre@dimen@eolshift=0pt\relax%
\fi %
\gre@debugmsg{eolshift}{eolshift: \the\gre@dimen@eolshift}%
\relax %
}
%%%%%%%%%%%%%%%%%%%
%% Local Distances (computed as needed)
%%%%%%%%%%%%%%%%%%%
% glyphraisevalue is the value of which we must raise one glyph (that will vary with every glyph)
\newdimen\gre@dimen@glyphraisevalue\relax%
\newif\ifgre@useledgerlineheuristic%
\gre@useledgerlineheuristictrue%
\def\gresetledgerlineheuristic#1{%
\IfStrEqCase{#1}{%
{enable}%
{\gre@useledgerlineheuristictrue}%
{disable}%
{\gre@useledgerlineheuristicfalse}%
}[% all other cases
\gre@error{Unrecognized option "#1" in \protect\gresetledgerlineheuristic\MessageBreak Possible options are: 'enable' and 'disable'}%
]%
}%
% for backwards compatibility, we set these to true by default, and the
% system will set them appropriately if the heuristics determine a ledger
% line probably doesn't exist at that point
\newif\ifgre@ledgerline@above%
\newif\ifgre@ledgerline@below%
\def\GreSupposeHighLedgerLine{%
\ifgre@useledgerlineheuristic\gre@ledgerline@abovetrue\fi %
}%
\def\GreSupposeLowLedgerLine{%
\ifgre@useledgerlineheuristic\gre@ledgerline@belowtrue\fi %
}%
\def\gre@resetledgerlineheuristics{%
\gre@ledgerline@abovetrue\gre@ledgerline@belowtrue %
}%
\def\gre@prephepisemaledgerlineheuristics{%
\ifgre@useledgerlineheuristic %
\gre@ledgerline@abovefalse\gre@ledgerline@belowfalse %
\else %
\gre@ledgerline@abovetrue\gre@ledgerline@belowtrue %
\fi %
}%
% a very useful macro : it determines the good height of a glyph : the argument is the "number" where the glyph should be : 4 for the first line, 6 for the second, etc.
% the second argument is for the cases of signs: for example if the note is on a line, the punctummora will be above, and the auctus duplex beneath. the possible values are:
%% 0: no modification
%% 1: puts the value on the interline just above if it is on a line
%% 2: puts the value on the interline just beneath if it is on a line
%% 3: case of the vertical episema, which is not placed at the same place if the corresponding note is on a line or not
%% 4: case of the punctum mora, for the same reason
%% 5: case of the horizontal episema under a note, that must be placed a bit lower if the note is on a line
%% 6: case of the signs above (accentus, etc.)
%% 8: case of the punctum mora of the first note of a podatus or the 2nd note of a porrectus, etc.
%% 9: case of the horizontal episema, that must be placed a bit lower if the note is on a line
%% 10: low choral sign not below the note
%% 11: high choral sign
%% 12: low choral sign below the note
%% 13: brace above the bars
%% 14: punctum mora in a space with a note on the line below it
%% 15: over slur
%% 16: under slur
% #3, for horizontal episemata, is the interline position:
%% 0: auto
%% 1: middle
%% 2: low in space above note
%% 3: high in space above note
%% 4: low in space below note
%% 5: high in space below note
\def\gre@calculate@glyphraisevalue#1#2#3{%
\global\gre@isonalinefalse%
\ifcase#1%
% the first two cases are special cases for episemae on the lowest note
\or\gre@count@temp@three=\number 0%
\or\gre@count@temp@three=\number 1%
\or\gre@count@temp@three=\number 2%
\or\gre@count@temp@three=\number 3%
\ifgre@ledgerline@below %
\ifnum#2=3\relax %
\else %
% if it is a vertical episema, we don't care if it is on a line or
% not... which may cause some problems...
\global\gre@isonalinetrue %
\fi %
\fi %
\or\gre@count@temp@three=\number 4%
\or\gre@count@temp@three=\number 5%
\global\gre@isonalinetrue%
\or\gre@count@temp@three=\number 6%
\or\gre@count@temp@three=\number 7%
\global\gre@isonalinetrue%
\or\gre@count@temp@three=\number 8%
\or\gre@count@temp@three=\number 9%
\ifgre@haslinethree %
\global\gre@isonalinetrue%
\else %
\ifgre@ledgerline@above %
\global\gre@isonalinetrue%
\fi %
\fi %
\or\gre@count@temp@three=\number 10%
\or\gre@count@temp@three=\number 11%
\ifgre@haslinefour %
\global\gre@isonalinetrue%
\else %
\ifgre@haslinethree %
\ifgre@ledgerline@above %
\global\gre@isonalinetrue%
\fi %
\fi %
\fi %
\or\gre@count@temp@three=\number 12%
\or\gre@count@temp@three=\number 13%
\ifgre@haslinefive %
\global\gre@isonalinetrue%
\else %
\ifgre@haslinefour %
\ifgre@ledgerline@above %
\global\gre@isonalinetrue%
\fi %
\fi %
\fi %
\or\gre@count@temp@three=\number 14%
\or\gre@count@temp@three=\number 15%
\ifgre@haslinefive %
\ifgre@ledgerline@above %
\global\gre@isonalinetrue%
\fi %
\fi %
\or\gre@count@temp@three=\number 16%
\or\gre@count@temp@three=\number 17%
\or\gre@count@temp@three=\number 18%
\or\gre@count@temp@three=\number 19%
\or\gre@count@temp@three=\number 20%
\fi%
% if there is not line... we don't consider notes are on lines
\ifgre@showlines\else %
\global\gre@isonalinefalse %
\fi %
% if the note is on a line, we change its height if necessary
\ifgre@isonaline%
\ifcase#2 %
\or% 1
\global\advance\gre@count@temp@three by 1%
\or% 2
\global\advance\gre@count@temp@three by -1%
\or% 3
\global\advance\gre@count@temp@three by -1%
\or% 4
\global\advance\gre@count@temp@three by 1%
\or% 5
\global\advance\gre@count@temp@three by -1%
\or\or\or% 8
\global\advance\gre@count@temp@three by -1%
\or% 9
\global\advance\gre@count@temp@three by 1%
\or% 10
\global\advance\gre@count@temp@three by 1%
\or% 11
\global\advance\gre@count@temp@three by 1%
\or% 12
\global\advance\gre@count@temp@three by -1%
\fi%
\fi%
\global\advance\gre@count@temp@three by -8 %
\global\gre@dimen@glyphraisevalue = \dimexpr(15750 sp * \gre@factor * \gre@count@temp@three)\relax %
\ifcase#2 %
\or\or\or%3: if it is a vertical episema on a line, we shift it a bit higher, so that it's more beautiful
\ifgre@isonaline%
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@vepisemahighshift\relax %
\else % if it is not on a line, we shift it a bit lower
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@vepisemalowshift\relax %
\fi %
\or% 4: if it is a punctum mora on a line, we shift it a bit lower, for the same reason
\ifgre@isonaline%
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@linepunctummorashift\relax %
\else %
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@spacepunctummorashift\relax %
\fi%
\or% 5: if it is a horizontal episema under a note which is on a line, we shift it lower
\ifcase#3\relax % 0 - auto
\ifgre@isonaline% if it is under a note between two lines, we shift it higher
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemahighshift\relax %
\else %
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemalowshift\relax %
\fi %
\or % 1 - middle
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@hepisemamiddleshift\relax %
\or % 2 - over-low
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemalowshift\relax %
\or % 3 - over-high
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemahighshift\relax %
\or % 4 - under-low
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemalowshift\relax %
\or % 5 - under-high
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemahighshift\relax %
\fi %
\or% 6: if it is a sign, we put it at an arbitrary height
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@raresignshift\relax %
\or\or% 8: if it is a punctum mora on a line, we shift it a bit lower, for the same reason
\ifgre@isonaline%
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@lineporrectuspunctummorashift\relax %
\else %
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@spaceporrectuspunctummorashift\relax %
\fi %
\or% 9: if it is an horizontal episema not on a line, we put it a bit lower
\ifcase#3\relax % 0 - auto
\ifgre@isonaline%
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemalowshift\relax %
\else %
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemahighshift\relax %
\fi %
\or % 1 - middle
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@hepisemamiddleshift\relax %
\or % 2 - over-low
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemalowshift\relax %
\or % 3 - over-high
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overhepisemahighshift\relax %
\or % 4 - under-low
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemalowshift\relax %
\or % 5 - under-high
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underhepisemahighshift\relax %
\fi %
\or% 10: low choral sign that is not lower than the note
\global\advance\gre@dimen@glyphraisevalue by -\gre@space@dimen@choralsigndownshift\relax%
\or% 11: high choral sign
\ifgre@isonaline%
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@choralsignupshift\relax%
\else %
\global\advance\gre@dimen@glyphraisevalue by -\gre@space@dimen@choralsigndownshift\relax%
\fi %
\or% 12: low choral sign that is lower than the note
\ifgre@isonaline%
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@choralsignupshift\relax%
\else %
\global\advance\gre@dimen@glyphraisevalue by -\gre@space@dimen@choralsigndownshift\relax%
\fi %
\or% 13: if it is the brace above the bars, we shift it to a user-defined value
\global\advance\gre@dimen@glyphraisevalue by -\gre@space@dimen@braceshift\relax%
\or% 14: raise the punctum mora in a space a bit higher than case 4
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@spaceamonepespunctummorashift\relax%
\or% 15: over slur
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@overslurshift\relax%
\or% 16: under slur
\global\advance\gre@dimen@glyphraisevalue by \gre@space@dimen@underslurshift\relax%
\fi%
\global\advance\gre@dimen@glyphraisevalue by \the\gre@dimen@constantglyphraise\relax%
}%
% two dimensions for the additionalspaces
\newdimen\gre@dimen@additionalbottomspace\relax%
% the one taken into account to adjust space between lines
\newdimen\gre@dimen@additionaltopspace\relax%
% the one taken into account for above lines text height
\newdimen\gre@dimen@additionaltopspacealt\relax%
\newcount\gre@space@count@additionaltopspacethreshold\relax%
\gre@space@count@additionaltopspacethreshold=2
\newcount\gre@space@count@additionaltopspacealtthreshold\relax%
\gre@space@count@additionaltopspacethreshold=0
% #1 is the high height
% #2 is the low height
% #3 is 1 if there is a translation somewhere
% #4 is if 1 if we have space above the staff
\def\gre@calculate@additionalspaces#1#2#3#4{%
\gre@debugmsg{lineheight}{gre@calculate@additional@spaces called with #1 #2 #3 #4}%
\gre@count@temp@one=\numexpr(#1 - \gre@pitch@adjust@top - \gre@space@count@additionaltopspacethreshold)\relax %
\ifnum\gre@count@temp@one>0\relax %
\global\gre@dimen@additionaltopspace=\dimexpr(15750 sp * \gre@count@temp@one * \gre@factor)\relax %
\else %
\global\gre@dimen@additionaltopspace=0 sp%
\fi %
\gre@count@temp@one=\numexpr(#1 - \gre@pitch@adjust@top - \gre@space@count@additionaltopspacealtthreshold)\relax %
\ifnum\gre@count@temp@one>0\relax %
\global\gre@dimen@additionaltopspacealt=\dimexpr(15750 sp * \gre@count@temp@one * \gre@factor)\relax %
\else %
\global\gre@dimen@additionaltopspacealt=0 sp%
\fi %
\gre@count@temp@one=\numexpr((#2 - \gre@pitch@adjust@bottom) * -1)\relax %
\ifnum\gre@count@temp@one>0\relax %
\global\gre@dimen@additionalbottomspace=\dimexpr(15750 sp * \gre@count@temp@one * \gre@factor)\relax %
\else %
\global\gre@dimen@additionalbottomspace=0 sp%
\fi %
\ifnum#3 = 1\relax %
\gre@addtranslationspace %
\else %
\gre@removetranslationspace %
\fi %
\ifnum#4 = 1\relax %
\gre@addspaceabove %
\else %
\gre@removespaceabove %
\fi %
\gre@generatelines %
\gre@calculate@constantglyphraise %
\relax %
}%
%% macro that typesets the text of the syllable, and sets textaligncenter to the middle of the middle letters, it is needed because we align the note (often the middle of the note) with the middle of the middle letters
%% third argument is 0 if it's the current syllable, 1 if it's the alignment of the following one
%% warning: gretextaligncenter is the width from the beginning of the letters to the middle of the middle letters
%% warning: value is approximative when a ligature appears
\newdimen\gre@dimen@textaligncenter\relax%
\def\gre@calculate@textaligncenter#1#2#3{%
\ifnum#3=0\relax%
\gre@widthof{\gre@fixedtextformat{#1#2}}%
\else %
\gre@widthof{\gre@fixednexttextformat{#1#2}}%
\fi %
\global\gre@dimen@textaligncenter=\the\gre@dimen@temp@three %
\ifnum#3=0\relax%
\gre@widthof{\gre@fixedtextformat{#2}}%
\else %
\gre@widthof{\gre@fixednexttextformat{#2}}%
\fi %
\divide\gre@dimen@temp@three by 2 %
\global\advance\gre@dimen@textaligncenter by -\the\gre@dimen@temp@three%
\relax%
}%
% a dimen that will contain the difference between the end of the text and the end of the notes for the previous syllable (if we are in the same word) : positive if notes go further than text. We will use it for space adjustment between syllables of the same word
\newdimen\gre@dimen@enddifference\relax%
% a dimen that will contain the enddifference of the previous glyph
\newdimen\gre@dimen@previousenddifference\relax%
% macro to set enddifference (defined above) to \wd\gre@box@syllablenotes - (\wd\gre@box@syllabletext - textaligncenter) - notesaligncenter
% enddifference will be positive if text go further than the notes, and negative in the other case
% arguments are :
% #1: \wd\gre@box@syllablenotes : the total width of the notes
% #2: \wd\gre@box@syllabletext : the total width of the text
% #3: textaligncenter (defined above)
% #4: notesaligncenter (defined above too)
% #5: if we have to set previousenddifference or not
\def\gre@calculate@enddifference#1#2#3#4#5{%
\ifcase#5\or %
\global\gre@dimen@previousenddifference=\the\gre@dimen@enddifference\relax%
\fi %
\global\gre@dimen@enddifference=\dimexpr(#1 - #2 + #3 - #4)\relax%
\relax%
}%
% temporary value for space for the translation, beneath the text
\newdimen\gre@dimen@currenttranslationheight\relax%
% macro to tell gregorio to set space for the translation
\def\gre@addtranslationspace{%
\gre@style@translation%
\global\gre@dimen@currenttranslationheight=\gre@space@dimen@translationheight\relax%
\global\gre@dimen@textlower=\dimexpr(\gre@space@dimen@spacebeneathtext %
+ \gre@space@dimen@translationheight)\relax%
\gre@generatelines %
\gre@calculate@constantglyphraise %
\endgre@style@translation%
\ifx\gre@empty@translationformat\gretranslationformat% OBSOLETE
\else% OBSOLETE
\gre@obsolete{\protect\gretranslationformat}{\protect\grechangestyle{translation}}% OBSOLETE
\fi% OBSOLETE
\relax %
}%
\def\gre@removetranslationspace{%
\global\gre@dimen@currenttranslationheight=0 sp%
\global\gre@dimen@textlower=\gre@space@dimen@spacebeneathtext\relax%
\gre@generatelines %
\gre@calculate@constantglyphraise %
\relax %
}%
%nextbegindifference is the begindifference of the next syllable
\newskip\gre@skip@nextbegindifference\relax%
% macro to set nextbegindifference
%% 1 : the first letters of the next syllable
%% 2 : the middle letters of the next syllable
%% 3 : the end letters of the next syllable
%% 4 : the type of notes alignment
\def\gre@calculate@nextbegindifference#1#2#3#4{%
\ifnum\gre@lastoflinecount=1\relax %
\global\gre@skip@nextbegindifference=0pt\relax%
\else %
%to prevent the pollution of the normal values, we stock them into a temp value
\gre@dimen@temp@two=\gre@dimen@textaligncenter\relax%
\gre@calculate@textaligncenter{#1}{#2}{1}%
\global\gre@skip@nextbegindifference=-\gre@dimen@textaligncenter\relax%
\global\gre@dimen@textaligncenter=\gre@dimen@temp@two %
\gre@dimen@temp@two=\gre@dimen@notesaligncenter\relax%
\gre@calculate@nextnotesaligncenter{#4}% idem
\global\advance\gre@skip@nextbegindifference by \the\gre@dimen@notesaligncenter\relax%
\global\gre@dimen@notesaligncenter=\gre@dimen@temp@two %
\fi %
\relax %
}%
%The distance from the baseline of the line to the baseline of the annotations
\newdimen\gre@dimen@annotationtrueraise\relax%
% When text is placed in the annotation boxes these dimensions are initialized with values based on the contents and the user parameters
%This function sets the true raises of the two lines above the initial (it has to be called just as the boxes are placed in order to make sure that the values are all correct)
\def\gre@calculate@annotationtrueraise{%
\gre@debugmsg{annotation}{Calculating the raise.}%
\global\advance\gre@dimen@annotationtrueraise by %
\dimexpr(\gre@dimen@staffheight %
+ \gre@space@dimen@spacebeneathtext %
+ \gre@dimen@currenttranslationheight %
+ \gre@space@dimen@spacelinestext %
+ \gre@dimen@additionalbottomspace)\relax%
\gre@style@annotation%
\global\advance\gre@dimen@annotationtrueraise by \gre@space@dimen@annotationraise\relax%
\gre@debugmsg{annnotation}{Added user raise.}%
\endgre@style@annotation%
\relax %
}%
%The distance from the baseline of the line to the baseline of the commentary
\newdimen\gre@dimen@commentarytrueraise\relax%
%This function sets the true raises of the commentary (it has to be called just as the boxes are placed in order to make sure that the values are all correct)
\def\gre@calculate@commentarytrueraise{%
\gre@style@commentary%
\gre@debugmsg{commentary}{Calculating the raise.}%
\global\advance\gre@dimen@commentarytrueraise by %
\dimexpr(\gre@dimen@staffheight %
+ \gre@space@dimen@spacebeneathtext %
+ \gre@dimen@currenttranslationheight %
+ \gre@space@dimen@spacelinestext %
+ \gre@dimen@additionalbottomspace %
+ \gre@space@dimen@commentaryraise)\relax%
\endgre@style@commentary%
}%
% spaces for new bar positioning algorithm
\newskip\gre@skip@bar@requirement% amount of space required by bar (including skips before and after)
\newskip\gre@skip@bar@allocation% amount of space allocated to the bar
\newdimen\gre@dimen@bar@shift% displacement from center of the bar’s position
\newskip\gre@skip@text@requirement% amount of space required by the text (including skips before and after)
\newskip\gre@skip@text@allocation% amount of space allocated to the text
\newdimen\gre@dimen@text@shift% displacement from center of the text’s position
\newdimen\gre@dimen@adjustedpreviousenddifference% previousenddifference adjusted to account for the presence of a punctum mora at the end of the pervious syllable
\newskip\gre@skip@punctummorashift% displacement of whole syllable to account for the presence of a punctum mora at the end of the previous syllable
%
% New bar spacing algorithm
%
%In the new algorithm the bar and the text are set independently of each other based purely on the positions of the corresponding element in the previous and next syllable
% #1 is #4 from \GreBarSyllable (1 if bar is end of word, 0 if not)
% #2 is #7 from \GreBarSyllable (alignment type of first next glyph)
\def\gre@calculate@barposition#1#2{%
% we start by finding the distance between the text and notes of the previous and the next syllable (as if this syllable didn't exist, for the moment)
\gre@debugmsg{barspacing}{calculate available space}%
% first, recomputing \gre@dimen@previousenddifference into \gre@dimen@adjustedpreviousenddifference
% taking into account the punctum mora shift
\gre@dimen@adjustedpreviousenddifference=\gre@dimen@previousenddifference %
% gre@skip@punctummorashift is 0 or the punctum mora shift
\gre@skip@punctummorashift=0pt\relax %
\ifgre@lastendswithmora %
\ifcase\gre@count@shiftaftermora\or\or %
\ifdim\wd\gre@box@syllabletext=0pt\relax %
% punctum mora adjustment should occur only for bars with no text
\gre@get@unkern@aftermora{2}%
\advance\gre@dimen@adjustedpreviousenddifference by \gre@skip@punctummorashift %
\fi %
\or %
% punctum mora adjustment only before bars
\gre@get@unkern@aftermora{2}%
\advance\gre@dimen@adjustedpreviousenddifference by \gre@skip@punctummorashift %
\or\or %
% punctum mora adjustment always occurs
\gre@get@unkern@aftermora{2}%
\advance\gre@dimen@adjustedpreviousenddifference by \gre@skip@punctummorashift %
\fi %
\fi %
% now something a bit tricky: as we changed previousenddifference,
% we must kern of the difference we created, but no more than
% the end of the text:
\ifdim\gre@skip@punctummorashift=0pt\else %
\gre@debugmsg{barspacing}{adjustment for punctum mora: \the\gre@skip@punctummorashift}%
\gre@debugmsg{barspacing}{adjusted previous enddifference (for punctum mora): \the\gre@dimen@adjustedpreviousenddifference}%
\ifdim -\gre@skip@punctummorashift < \gre@dimen@previousenddifference %
\gre@debugmsg{barspacing}{kern \the\gre@skip@punctummorashift for punctum mora adjustment}%
\kern\gre@skip@punctummorashift %
\else %
\ifdim\gre@dimen@previousenddifference > 0pt\relax %
\gre@debugmsg{barspacing}{kern \the\gre@dimen@previousenddifference for punctum mora adjustment}%
\kern-\gre@dimen@previousenddifference %
\fi %
\fi %
\fi %
\ifdim\gre@dimen@adjustedpreviousenddifference > 0pt\relax%
% the notes ended after the text in the previous syllable
\gre@skip@text@allocation = \gre@dimen@adjustedpreviousenddifference\relax%
\gre@skip@bar@allocation = 0pt\relax%
\else%
% the text ended after the notes in the previous syllable
\gre@skip@text@allocation = 0pt\relax%
\gre@skip@bar@allocation = -\gre@dimen@adjustedpreviousenddifference\relax%
\fi%
\ifdim\gre@skip@nextbegindifference > 0pt\relax%
% the text began after the notes in the next syllable
\advance\gre@skip@text@allocation by \gre@skip@nextbegindifference\relax%
\advance\gre@skip@bar@allocation by 0pt\relax%
\else%
% the notes begin after the text in the next syllable
\advance\gre@skip@text@allocation by 0pt\relax%
\advance\gre@skip@bar@allocation by -\gre@skip@nextbegindifference\relax%
\fi%
\gre@debugmsg{barspacing}{space available to text: \the\gre@skip@text@allocation}%
\gre@debugmsg{barspacing}{spacing available to notes: \the\gre@skip@bar@allocation}%
% now we need to check these widths against the width the current syllable needs for each element and increase them as necessary
% if they aren't wide enough, then we need to increase *both* widths
\gre@debugmsg{barspacing}{calculate required widths}%
% first we check the text width
% we have to account for the spacing around the text as well as the text itself
\ifdim\wd\gre@box@syllabletext > 0pt\relax%
% first we account for the spacing which is needed after the previous syllable text (by using the minTextDistance left over from the previous syllablefinalskip calculation)
\gre@debugmsg{barspacing}{text width: \the\wd\gre@box@syllabletext}%
\gre@debugmsg{barspacing}{previous syllable skip after text: \the\gre@skip@minTextDistance}%
\gre@skip@text@requirement = \glueexpr\wd\gre@box@syllabletext + \gre@skip@minTextDistance\relax%
%now we need to account for the spacing which goes after this syllable (if there is text to this syllable)
%this calculation is similar to what is done in \gre@calculate@syllablefinalskip, but is only for the text, so we'll use \gre@skip@syllablefinalskip to hold this value for now
\ifnum#1=1\relax %
\ifgre@in@euouae %
\gre@skip@syllablefinalskip=\gre@space@dimen@interwordspacetext@bars@euouae\relax%
\else %
\gre@skip@syllablefinalskip=\gre@space@dimen@interwordspacetext@bars\relax%
\fi %
\else %
\gre@skip@syllablefinalskip=0pt\relax%
\fi %
\gre@debugmsg{barspacing}{this syllable skip after text: \the\gre@skip@syllablefinalskip}%
\advance\gre@skip@text@requirement by \gre@skip@syllablefinalskip\relax%
\else%
\ifnum#1=1\relax%
\ifgre@in@euouae%
\gre@skip@text@requirement=\gre@space@dimen@interwordspacetext@bars@notext@euouae\relax%
\else%
\gre@skip@text@requirement=\gre@space@dimen@interwordspacetext@bars@notext\relax%
\fi%
\else%
\gre@skip@text@requirement=0pt\relax%
\fi%
\fi%
\ifdim\gre@skip@text@allocation < \gre@skip@text@requirement\relax%
\advance\gre@skip@bar@allocation by \glueexpr(\gre@skip@text@requirement - \gre@skip@text@allocation)\relax%
\gre@skip@text@allocation = \gre@skip@text@requirement\relax%
\fi%
\gre@debugmsg{barspacing}{space required by text: \the\gre@skip@text@requirement}%
\gre@debugmsg{barspacing}{allocated text space: \the\gre@skip@text@allocation}%
\gre@debugmsg{barspacing}{allocated notes space: \the\gre@skip@bar@allocation}%
% now we check the bar width
\gre@debugmsg{barspacing}{bar width: \the\wd\gre@box@syllablenotes}%
\gre@skip@bar@requirement = \wd\gre@box@syllablenotes\relax%
\ifdim\gre@skip@bar@allocation < \gre@skip@bar@requirement\relax%
\advance\gre@skip@text@allocation by \glueexpr(\gre@skip@bar@requirement - \gre@skip@bar@allocation)\relax%
\gre@skip@bar@allocation = \gre@skip@bar@requirement\relax%
\fi%
\gre@debugmsg{barspacing}{required space for notes: \the\gre@skip@bar@requirement}%
\gre@debugmsg{barspacing}{allocated text space: \the\gre@skip@text@allocation}%
\gre@debugmsg{barspacing}{allocated notes space: \the\gre@skip@bar@allocation}%
% our final position calculation is to make sure that the centers of the text and the bar are not too far from each other
% this isn't really the begindifference (it doesn't account for the width of the text and the bar), but it's close enough that we'll use that register for this calculation
% to be consistent with the normal begin difference, this value should take us from the middle of the notes to the middle of the text.
\gre@dimen@begindifference=\dimexpr(-\gre@skip@bar@allocation/2% going to the left by the bar@allocation/2 (an always positive value, so we lead with a minus sign to go left)
-\gre@dimen@adjustedpreviousenddifference% moving from the end of the notes in the previous syllable to the end of the text there (opposite the sense of enddifference so we lead with a minus sign)
+\gre@skip@text@allocation/2)\relax% going to the right by the text@allocation/2 (an always positive value, so lead with positive to go right)
\gre@debugmsg{barspacing}{new begindifference approximation: \the\gre@dimen@begindifference}%
% in order to avoid code duplication, we check whether or not there is a bar line now and set temp variables to the appropriate offset limits. We’ll then use those temp variables in the code below.
\ifdim\wd\gre@box@syllablenotes = 0pt\relax%
\gre@debugmsg{barspacing}{no bar offset limits}%
\gre@dimen@temp@three=\gre@space@dimen@maxbaroffsettextleft@nobar\relax%
\gre@dimen@temp@two=\gre@space@dimen@maxbaroffsettextright@nobar\relax%
\else%
\gre@debugmsg{barspacing}{normal offset limits}%
\gre@dimen@temp@three=\gre@space@dimen@maxbaroffsettextleft\relax%
\gre@dimen@temp@two=\gre@space@dimen@maxbaroffsettextright\relax%
\fi%
% in the event that the bar is occurring at the end of the line, we use different offset limits
% for now this only works for explicit end of lines which occur in the same syllable as the bar line (e.g. `test(::z)`)
\ifnum\gre@newlinearg=-1\relax\else%
\gre@debugmsg{barspacing}{end of line override on offset limits}%
\gre@dimen@temp@three=\gre@space@dimen@maxbaroffsettextleft@eol\relax%
\gre@dimen@temp@two=\gre@space@dimen@maxbaroffsettextright@eol\relax%
\fi%
\gre@debugmsg{barspacing}{left offset limit: \the\gre@dimen@temp@three}%
\gre@debugmsg{barspacing}{right offset limit: \the\gre@dimen@temp@two}%
% All this worry about shifts is superfluous if the text isn’t present,
% so now we check for that and set them to 0 if it is missing
\ifdim\wd\gre@box@syllabletext = 0pt\relax%
\gre@debugmsg{barspacing}{no text, shifts set to 0}%
\gre@dimen@text@shift = 0pt\relax%
\gre@dimen@bar@shift = 0pt\relax%
\else%
\ifdim\gre@dimen@begindifference > \gre@dimen@temp@two\relax%
%the two elements are too far apart and the text is to the right of the bar
\gre@debugmsg{barspacing}{shifts for text right of bar}%
% first we shift text to the left so that it has the correct offset
\gre@dimen@bar@shift = 0pt\relax%
\gre@dimen@text@shift = \dimexpr(0pt - (\gre@dimen@begindifference - \gre@dimen@temp@two))\relax%
% is the text too far to the left?
\ifdim-\gre@dimen@text@shift > \dimexpr(\gre@skip@text@allocation/2-\gre@skip@text@requirement/2)\relax%
% it is, so push both bar and text right to prevent a collision
\gre@debugmsg{barspacing}{text collision detected}%
\gre@dimen@bar@shift = \dimexpr(-\gre@dimen@text@shift-(\gre@skip@text@allocation/2-\gre@skip@text@requirement/2))\relax %
\gre@dimen@text@shift = \dimexpr(0pt - (\gre@skip@text@allocation/2 - \gre@skip@text@requirement/2))\relax %
% is the bar too far to the right?
% \gre@dimen@temp@one is excess shift
\gre@dimen@temp@one = \dimexpr\gre@dimen@bar@shift - (\gre@skip@bar@allocation/2 - \gre@skip@bar@requirement/2)\relax%
\ifdim\gre@dimen@temp@one>0pt\relax %
\gre@debugmsg{barspacing}{bar collision detected}%
% it is, so allocate more space to prevent the collision
\advance\gre@skip@bar@allocation by \gre@dimen@temp@one\relax %
% since the additional allocation will be split evenly on both sides of the bar, we also need to shift both elements left so that all of it will appear on the right hand side
\advance\gre@dimen@bar@shift by -0.5\gre@dimen@temp@one\relax%
\advance\gre@dimen@text@shift by -0.5\gre@dimen@temp@one\relax%
\fi %
\fi%
\else\ifdim-\gre@dimen@begindifference > \gre@dimen@temp@three\relax%
%the two elements are too far apart and the text is to the left of the bar
\gre@debugmsg{barspacing}{shifts for text to left of bar}%
% first we shift text to the right so that it has the correct offset
\gre@dimen@bar@shift = 0pt\relax %
\gre@dimen@text@shift = \dimexpr((-\gre@dimen@begindifference) - \gre@dimen@temp@three)\relax %
% is the text too far to the right?
\ifdim\gre@dimen@text@shift > \dimexpr(\gre@skip@text@allocation/2-\gre@skip@text@requirement/2)\relax %
\gre@debugmsg{barspacing}{text collision detected}%
% it is so push both bar and text left to prevent a collision
\gre@dimen@bar@shift = \dimexpr(-\gre@dimen@text@shift+\gre@skip@text@allocation/2-\gre@skip@text@requirement/2)\relax %
\gre@dimen@text@shift = \dimexpr(\gre@skip@text@allocation/2-\gre@skip@text@requirement/2)\relax %
% is the bar too far to the left?
% gre@dimen@temp@one is the excess of bar@shift:
\gre@dimen@temp@one=\dimexpr(-\gre@dimen@bar@shift -(\gre@skip@bar@allocation/2-\gre@skip@bar@requirement/2))\relax %
\ifdim\gre@dimen@temp@one>0pt\relax %
\gre@debugmsg{barspacing}{bar collision detected}%
% it is, so allocate more space to prevent the collision
\advance\gre@skip@bar@allocation by \gre@dimen@temp@one\relax %
% since the allocation will be split evenly on either side of the bar, we also need to shift both bar an text right by half of the increase so all of it appears on the left side
\advance\gre@dimen@bar@shift by 0.5\gre@dimen@temp@one\relax%
\advance\gre@dimen@text@shift by 0.5\gre@dimen@temp@one\relax%
\fi %
\fi %
\else%
%the two elements are sufficiently close together
\gre@debugmsg{barspacing}{zero shifts}%
\gre@dimen@text@shift = 0pt\relax%
\gre@dimen@bar@shift = 0pt\relax%
\fi\fi%
\fi%
\gre@debugmsg{barspacing}{text shift: \the\gre@dimen@text@shift}%
\gre@debugmsg{barspacing}{bar shift: \the\gre@dimen@bar@shift}%
%at this point we're going to correct the values of enddifference and begindifference so that they are right for calculations which reference them in the next syllable
\gre@debugmsg{barspacing}{bar width: \the\wd\gre@box@syllablenotes}%
\gre@debugmsg{barspacing}{text width: \the\wd\gre@box@syllabletext}%
\gre@debugmsg{barspacing}{Correcting begindifference}%
%same as before but now we need to account for the widths of the elements and the shifts
\gre@dimen@begindifference = \dimexpr(\wd\gre@box@syllablenotes/2% go right to the middle of the bar syllable (width is always positive so lead with plus to go right)
-\gre@dimen@bar@shift% go from actual middle of bar to nominal middle of bar (bar@shift represents going the other way, so lead with minus)
+\gre@dimen@begindifference% go from nominal middle of bar line to nominal middle of text (this is what begindifference currently holds, so lead with positive)
+\gre@dimen@text@shift% go from nominal middle of text to actual middle of text (text@shift represents this move, so lead with positive)
-\wd\gre@box@syllabletext/2)\relax% go left from middle to beginning of text (width is always positive, so lead with negative to go left
\gre@debugmsg{barspacing}{begindifference: \the\gre@dimen@begindifference}%
\gre@debugmsg{barspacing}{Correcting enddifference}%
\gre@dimen@enddifference = \dimexpr-\wd\gre@box@syllabletext% go from end of text to beginning of text (width is always positive, so lead with negative to go left)
-\gre@dimen@begindifference% go from beginning of text to beginning of notes (opposite sense of begindifference so lead with negative)
+\wd\gre@box@syllablenotes\relax% go from beginning of notes to end of notes (width is always positive so lead with positive to go right
\gre@debugmsg{barspacing}{enddifference: \the\gre@dimen@enddifference}%
%we also need to correct syllablefinalskip to make sure it’s accurate because it depends on enddifference
\gre@debugmsg{barspacing}{Correcting syllablefinalskip}%
\gre@calculate@syllablefinalskip{#1}{\gre@count@temp@one}%
\gre@debugmsg{barspacing}{syllablefinalskip: \the\gre@skip@syllablefinalskip}%
}%
%%%%%%%%%%%%%%%%%%%
%% other spaces calculated elsewhere
%%%%%%%%%%%%%%%%%%%
% These distances don't have independent functions which calculate their value, generally because their calculation is distributed over multiple events.
% begindifference is the difference between the beginning of the text and the beginning of the notes. Warning : it can be negative.
\newdimen\gre@dimen@begindifference\relax%
% the width of the clef
\newdimen\gre@dimen@clefwidth\relax%
% the width of the last glyph
\newdimen\gre@dimen@lastglyphwidth\relax%
% notes align center is the point of alignment for the notes
\newdimen\gre@dimen@notesaligncenter\relax%
%this dimension is the additional space that we have to add to the localleftbox sometimes. For now it is used only for the initials on two lines
\newdimen\gre@dimen@additionalleftspace\relax%
% the calculated width of the initial (may be actual width of letter or be forced wider under certain conditions)
\newdimen\gre@dimen@initialwidth\relax%
\gre@dimen@initialwidth= 0 pt\relax%
\newdimen\gre@dimen@currentabovelinestextheight\relax%
\gre@dimen@currentabovelinestextheight = 0pt\relax%
%% TODO: perhaps create a pair of functions which “reserve” and “release” the temporary registers in order to keep track of which ones are in use when. There would also need to be a list of the registers currently in use. The reserve function would then check the list to make sure the requested register isn’t already in use, throwing an error if it is and adding its name to the list if it isn’t. It might also provide for an alias (via \let). The release function would simply remove the register from the list of those in use.
% Register allocation is an inherently global process in TeX. Below are the registers used within calculations on a temporary basis.
\newdimen\gre@dimen@temp@one%
\newdimen\gre@dimen@temp@two%
\newdimen\gre@dimen@temp@three%
\newdimen\gre@dimen@temp@four%
\newdimen\gre@dimen@temp@five%
\newskip\gre@skip@temp@one%
\newskip\gre@skip@temp@two %
\newskip\gre@skip@temp@three%
\newskip\gre@skip@temp@four%
\newcount\gre@count@temp@one%
\newcount\gre@count@temp@two%
\newcount\gre@count@temp@three%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% dimension changing macros
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This macro creates one dim (#1), setting its value to #2 and sets whether it should scale when the \gre@factor changes (#3, scalable or fixed). Checks that #1 can accept the kind of distance given in #2.
%% Note: the distances created by this function are stored as strings, not skip or dimension registers. This allows the user to specify a distance in em or ex units even though the font parameters may not be the same at the time the distance is specified and the time the distance is used.
\newif\ifgre@checklength%
\def\grecreatedim#1#2#3{%
\gre@dimension{#1}{#2}%
\csname newif\expandafter\endcsname\csname ifgre@scale@#1\endcsname%
\IfStrEqCase{#3}{%
{1}%
{\gre@obsolete{A numerical (1) last argument for \protect\grecreatedim}{'scalable'}}%
{0}%
{\gre@obsolete{A numerical (0) last argument for \protect\grecreatedim}{'fixed'}}%
{scalable}%
{\grescaledim{#1}{true}}%
{fixed}%
{\grescaledim{#1}{false}}%
}[% all other cases
\gre@error{Unrecognized option "#3" for \protect\grecreatedim\MessageBreak Possible options are: 'scalable' and 'fixed'}%
]%
}%
\def\gresetdim{%OBSOLETE
\gre@obsolete{\protect\gresetdim}{\protect\grecreatedim}%
}%
% a macro for changing a dimension. Unlike \grecreatedim, this function won’t create a new distance, just change an existing one.
\def\grechangedim#1#2#3{%
\gre@rubberpermit{#1}%
% figure out our prefix
\ifgre@rubber%
\gre@debugmsg{spacing}{Changing a skip.}%
\def\gre@prefix{skip}%
\else%
\gre@debugmsg{spacing}{Changing a dimen.}%
\def\gre@prefix{dimen}%
\fi%
\ifcsname gre@space@\gre@prefix @#1\endcsname%
\gre@debugmsg{spacing}{It does exist.}%
\gre@dimension{#1}{#2}%
\IfStrEqCase{#3}{%
{1}%
{\gre@obsolete{A numerical (1) last argument for \protect\grechangedim}{'scalable'}}%
{0}%
{\gre@obsolete{A numerical (0) last argument for \protect\grechangedim}{'fixed'}}%
{scalable}%
{\grescaledim{#1}{true}}%
{fixed}%
{\grescaledim{#1}{false}}%
% all other cases
}[\gre@error{Unrecognized option "#3" for \protect\grechangedim\MessageBreak Possible options are: 'scalable' and 'fixed'}]%
\else%
\IfStrEqCase{#1}{% DEPRECATED
{spacearoundsmallbars}% DEPRECATED
{% DEPRECATED
\gre@deprecated{spacearoundsmallbars}{bar@virgula or bar@minima}% DEPRECATED
\grechangedim{bar@virgula}{#2}{#3}% DEPRECATED
\grechangedim{bar@minima}{#2}{#3}% DEPRECATED
}% DEPRECATED
{spacearoundminor}% DEPRECATED
{% DEPRECATED
\gre@deprecated{spacearoundminor}{bar@minor}% DEPRECATED
\grechangedim{bar@minor}{#2}{#3}% DEPRECATED
}% DEPRECATED
{spacearoundmaior}% DEPRECATED
{% DEPRECATED
\gre@deprecated{spacearoundmaior}{bar@maior}% DEPRECATED
\grechangedim{bar@maior}{#2}{#3}% DEPRECATED
}% DEPRECATED
{spacearoundfinalis}% DEPRECATED
{% DEPRECATED
\gre@deprecated{spacearoundfinalis}{bar@finalis}% DEPRECATED
\grechangedim{bar@finalis}{#2}{#3}% DEPRECATED
}% DEPRECATED
{spacebeforefinalfinalis}% DEPRECATED
{% DEPRECATED
\gre@deprecated{spacebeforfinalfinalis}{bar@finalfinalis}% DEPRECATED
\grechangedim{bar@finalfinalis}{#2}{#3}% DEPRECATED
}% DEPRECATED
}[% DEPRECATED
\gre@error{#1 is not a recognized distance.}% keep this line
]% DEPRECATED
\fi%
}%
\def\grechangecount#1#2{%
\expandafter\csname gre@space@count@#1\endcsname=#2%
\relax %
}
% The common internals for \grecreatedim and \grechangedim.
\def\gre@dimension#1#2{%
\gre@checklengthfalse%
%check if #2 is a rubber length (contains plus and/or minus)
\IfSubStr{#2}{plus}{\gre@checklengthtrue}{\relax}%
\IfSubStr{#2}{minus}{\gre@checklengthtrue}{\relax}%
%if #1 is one of the distances which cannot be rubber.
\gre@rubberpermit{#1}%
% do we try to assign a rubber to one where it's not permitted?
\ifgre@rubber%
\def\gre@prefix{skip}%
\else%
\ifgre@checklength%
\gre@error{#1 cannot be a rubber length.}%
\else%
\def\gre@prefix{dimen}%
\fi%
\fi%
% special check for bar@rubber
\IfStrEq*{#1}{bar@rubber}%
{%
\gre@skip@temp@one = #2\relax%
\ifdim\gre@skip@temp@one=0pt\relax\else%
\gre@error{bar@rubber cannot have a non-zero base}%
\fi%
}{}%
\expandafter\edef\csname gre@space@\gre@prefix @#1\endcsname{#2}%
\relax %
}
%a macro to use if all you want to do is turn on or off the scaling for a particular distance
\def\grescaledim#1#2{%
\IfStrEqCase{#2}{%
{true}%
{\csname gre@scale@#1true\endcsname}%
{yes}%
{\grescaledim{true}}%
{on}%
{\grescaledim{true}}%
{scalable}%
{\grescaledim{true}}%
}[% all other cases
\csname gre@scale@#1false\endcsname%
]%
}
\def\grenoscaledim#1{%OBSOLETE
\gre@obsolete{\protect\grenoscaledim}{\protect\grescaledim{...}{no}}%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% space configuration loading
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\GreLoadSpaceConf#1{%OBSOLETE
\gre@obsolete{\protect\GreLoadSpaceConf}{\protect\greloadspaceconf}%
}%
\newcount\greconffactor%
\def\greloadspaceconf#1{%
\input gsp-#1.tex\relax %
\ifnum\greconffactor=0\relax%
\gre@error{gsp-#1.tex does not have an assigned staff size.\MessageBreak Please edit it to define \protect\greconffactor}%
\fi %
\ifnum\the\gre@factor=\greconffactor\else %If the space configuration file is designed for a \gre@factor other than the current one, then we need to rescale the distances.
\gre@changedimenfactor{\greconffactor}{\gre@factor} %
\fi%
\greconffactor=0%
\relax %
}%
% For everything to work fine the default configuration has to loaded after the gregoriotex package is completely loaded (so that all functions are well defined). As a result you'll find that as the last line in gregoriotex-main.tex
%%%%%%%%%%%%%%
%% Rescaling dimensions (for when \gre@factor changes)
%%%%%%%%%%%%%%
% This function checks to see if the length is one of the ones which cannot be a rubber length. The assumption is that any length not listed here is allowed to be rubber.
\newif\ifgre@rubber%
\def\gre@rubberpermit#1{%
% is length one that cannot be rubber?
\IfStrEqCase*{#1}{%
{additionallineswidth}{\gre@rubberfalse}%
{additionalcustoslineswidth}{\gre@rubberfalse}%
{zerowidthspace}{\gre@rubberfalse}%
{maximumspacewithoutdash}{\gre@rubberfalse}%
{afterinitialshift}{\gre@rubberfalse}%
{beforeinitialshift}{\gre@rubberfalse}%
{minimalspaceatlinebeginning}{\gre@rubberfalse}%
{manualinitialwidth}{\gre@rubberfalse}%
{annotationseparation}{\gre@rubberfalse}%
{intersyllablespacenotes}{\gre@rubberfalse}%
{intersyllablespacenotes@alteration}{\gre@rubberfalse}%
{annotationraise}{\gre@rubberfalse}%
{commentaryseparation}{\gre@rubberfalse}%
{commentaryraise}{\gre@rubberfalse}%
{noclefspace}{\gre@rubberfalse}%
{clivisalignmentmin}{\gre@rubberfalse}%
{choralsigndownshift}{\gre@rubberfalse}%
{choralsignupshift}{\gre@rubberfalse}%
{translationheight}{\gre@rubberfalse}%
{spacelinestext}{\gre@rubberfalse}%
{spacebeneathtext}{\gre@rubberfalse}%
{abovelinestextraise}{\gre@rubberfalse}%
{abovelinestextheight}{\gre@rubberfalse}%
{braceshift}{\gre@rubberfalse}%
{curlybraceaccentusshift}{\gre@rubberfalse}%
{initialraise}{\gre@rubberfalse}%
{beforealterationspace}{\gre@rubberfalse}%
{alterationspace}{\gre@rubberfalse}%
{overslurshift}{\gre@rubberfalse}%
{underslurshift}{\gre@rubberfalse}%
{maxbaroffsettextleft}{\gre@rubberfalse}%
{maxbaroffsettextright}{\gre@rubberfalse}%
{maxbaroffsettextleft@nobar}{\gre@rubberfalse}%
{maxbaroffsettextright@nobar}{\gre@rubberfalse}%
{maxbaroffsettextleft@eol}{\gre@rubberfalse}%
{maxbaroffsettextright@eol}{\gre@rubberfalse}%
{interwordspacetext@bars@euouae}{\gre@rubberfalse}%
{interwordspacetext@bars}{\gre@rubberfalse}%
{interwordspacetext@bars@notext@euouae}{\gre@rubberfalse}%
{interwordspacetext@bars@notext}{\gre@rubberfalse}%
{overhepisemalowshift}{\gre@rubberfalse}%
{overhepisemahighshift}{\gre@rubberfalse}%
{underhepisemalowshift}{\gre@rubberfalse}%
{underhepisemahighshift}{\gre@rubberfalse}%
{hepisemamiddleshift}{\gre@rubberfalse}%
{vepisemalowshift}{\gre@rubberfalse}%
{vepisemahighshift}{\gre@rubberfalse}%
{linepunctummorashift}{\gre@rubberfalse}%
{spacepunctummorashift}{\gre@rubberfalse}%
{spaceamonepespunctummorashift}{\gre@rubberfalse}%
{lineporrectuspunctummorashift}{\gre@rubberfalse}%
{spaceporrectuspunctummorashift}{\gre@rubberfalse}%
{raresignshift}{\gre@rubberfalse}%
{divisiofinalissep}{\gre@rubberfalse}%
}[\gre@rubbertrue]%
}%
%% an aux function adapting the value #1 from the factor #2 to the factor #3
\def\gre@changeonedimenfactor#1#2#3{%
% Math
\gre@rubberpermit{#1}%
\ifgre@rubber%
% if we have a rubber allowed length we create a temporary skip
\let\gre@scaledist\gre@skip@temp@one%
\edef\gre@convert{\csname gre@space@skip@#1\endcsname}%
\gre@scaledist=\glueexpr(\gre@convert * \number#3 / \number#2)\relax %
\else%
% otherwise we create a temporary dimen
\let\gre@scaledist\gre@dimen@temp@one%
\edef\gre@convert{\csname gre@space@dimen@#1\endcsname}%
\gre@scaledist=\dimexpr(\gre@convert * \number#3 / \number#2)\relax %
\fi%
\gre@consistentunits{\gre@convert}{\gre@scaledist}%
\gre@dimension{#1}{\gre@stringdist}%
\relax %
}%
% This function converts a distance to the units indicated in #1 and returns it as a string.
\def\gre@convertto#1#2{%
\gre@debugmsg{general}{convertto (#1) (#2)}%
% \p@ is equal to 1pt and is used here for a more accurate computation
\edef\gre@converted{\gre@strip@pt\dimexpr#2*\p@/\dimexpr 1#1\relax\relax #1}%
\gre@debugmsg{general}{converted value is \gre@converted}%
}%
% This function takes a distance (#2) and formats it as a string so that its units conform to the pattern set by a string representation of a distance (#1)
\newif\ifgre@stretch%
\newif\ifgre@shrink%
\def\gre@consistentunits#1#2{%
\gre@stretchfalse%
\gre@shrinkfalse%
\IfSubStr{#1}{plus}{\gre@stretchtrue}{\relax}%
\IfSubStr{#1}{minus}{\gre@shrinktrue}{\relax}%
\ifgre@stretch%
\ifgre@shrink%
%rubber with both stretch and shrink
\StrBefore{#1}{plus}[\gre@baseunit]%
\StrBetween{#1}{plus}{minus}[\gre@stretchunit]%
\StrBehind{#1}{minus}[\gre@shrinkunit]%
\else%
%rubber with stretch only
\StrBefore{#1}{plus}[\gre@baseunit]%
\StrBehind{#1}{plus}[\gre@stretchunit]%
\def\gre@shrinkunit{\relax}%
\fi%
\else%
\ifgre@shrink%
%rubber with shrink only
\StrBefore{#1}{minus}[\gre@baseunit]%
\def\gre@stretchunit{\relax}%
\StrBehind{#1}{minus}[\gre@shrinkunit]%
\else%
%non-rubber
\def\gre@baseunit{#1}%
\def\gre@stretchunit{\relax}%
\def\gre@shrinkunit{\relax}%
\fi%
\fi%
\StrDel{\gre@baseunit}{ }[\gre@baseunit]%
\StrRight{\gre@baseunit}{2}[\gre@baseunit]%
\StrDel{\gre@stretchunit}{ }[\gre@stretchunit]%
\StrRight{\gre@stretchunit}{2}[\gre@stretchunit]%
\StrDel{\gre@shrinkunit}{ }[\gre@shrinkunit]%
\StrRight{\gre@shrinkunit}{2}[\gre@shrinkunit]%
\gre@convertto{\gre@baseunit}{\dimexpr#2\relax}%
\edef\gre@stringdist{\gre@converted}%
\if\relax\gre@stretchunit\else%
\gre@convertto{\gre@stretchunit}{\gluestretch#2}%
\edef\gre@stringdist{\gre@stringdist plus \gre@converted}%
\fi%
\if\relax\gre@shrinkunit\else%
\gre@convertto{\gre@shrinkunit}{\glueshrink#2}%
\edef\gre@stringdist{\gre@stringdist minus \gre@converted}%
\fi%
}%
%% this function changes all the values of the spaces (vertical and horizontal) from one factor to another
%% simply by dividing them by the old factor, and multiplying them by the new one.
% #1 is the old gre@factor, #2 is the new one
\def\gre@changedimenfactor#1#2{%
\ifgre@scale@additionallineswidth%
\gre@changeonedimenfactor{additionallineswidth}{#1}{#2}%
\fi%
\ifgre@scale@additionalcustoslineswidth%
\gre@changeonedimenfactor{additionalcustoslineswidth}{#1}{#2}%
\fi%
\ifgre@scale@zerowidthspace%
\gre@changeonedimenfactor{zerowidthspace}{#1}{#2}%
\fi%
\ifgre@scale@interglyphspace%
\gre@changeonedimenfactor{interglyphspace}{#1}{#2}%
\fi%
\ifgre@scale@alterationspace%
\gre@changeonedimenfactor{alterationspace}{#1}{#2}%
\fi%
\ifgre@scale@clefflatspace%
\gre@changeonedimenfactor{clefflatspace}{#1}{#2}%
\fi%
\ifgre@scale@beforelowchoralsignspace%
\gre@changeonedimenfactor{beforelowchoralsignspace}{#1}{#2}%
\fi%
\ifgre@scale@beforealterationspace%
\gre@changeonedimenfactor{beforealterationspace}{#1}{#2}%
\fi%
\ifgre@scale@halfspace%
\gre@changeonedimenfactor{halfspace}{#1}{#2}%
\fi%
\ifgre@scale@interelementspace%
\gre@changeonedimenfactor{interelementspace}{#1}{#2}%
\fi%
\ifgre@scale@largerspace%
\gre@changeonedimenfactor{largerspace}{#1}{#2}%
\fi%
\ifgre@scale@nabcinterelementspace%
\gre@changeonedimenfactor{nabcinterelementspace}{#1}{#2}%
\fi%
\ifgre@scale@nabclargerspace%
\gre@changeonedimenfactor{nabclargerspace}{#1}{#2}%
\fi%
\ifgre@scale@glyphspace%
\gre@changeonedimenfactor{glyphspace}{#1}{#2}%
\fi%
\ifgre@scale@spacebeforeinlinecustos%
\gre@changeonedimenfactor{spacebeforeinlinecustos}{#1}{#2}%
\fi%
\ifgre@scale@spacebeforeeolcustos%
\gre@changeonedimenfactor{spacebeforeeolcustos}{#1}{#2}%
\fi%
\ifgre@scale@spacebeforesigns%
\gre@changeonedimenfactor{spacebeforesigns}{#1}{#2}%
\fi%
\ifgre@scale@spaceaftersigns%
\gre@changeonedimenfactor{spaceaftersigns}{#1}{#2}%
\fi%
\ifgre@scale@spaceafterlineclef%
\gre@changeonedimenfactor{spaceafterlineclef}{#1}{#2}%
\fi%
\ifgre@scale@interwordspacenotes%
\gre@changeonedimenfactor{interwordspacenotes}{#1}{#2}%
\fi%
\ifgre@scale@intersyllablespacenotes%
\gre@changeonedimenfactor{intersyllablespacenotes}{#1}{#2}%
\fi%
\ifgre@scale@interwordspacenotes@alteration%
\gre@changeonedimenfactor{interwordspacenotes@alteration}{#1}{#2}%
\fi%
\ifgre@scale@intersyllablespacenotes@alteration%
\gre@changeonedimenfactor{intersyllablespacenotes@alteration}{#1}{#2}%
\fi%
\ifgre@scale@intersyllablespacestretchhyphen%
\gre@changeonedimenfactor{intersyllablespacestretchhyphen}{#1}{#2}%
\fi%
\ifgre@scale@interwordspacetext%
\gre@changeonedimenfactor{interwordspacetext}{#1}{#2}%
\fi%
\ifgre@scale@interwordspacetext@bars%
\gre@changeonedimenfactor{interwordspacetext@bars}{#1}{#2}%
\fi%
\ifgre@scale@interwordspacetext@bars@notext%
\gre@changeonedimenfactor{interwordspacetext@bars@notext}{#1}{#2}%
\fi%
\ifgre@scale@interwordspacenotes@euouae%
\gre@changeonedimenfactor{interwordspacenotes@euouae}{#1}{#2}%
\fi%
\ifgre@scale@interwordspacetext@euouae%
\gre@changeonedimenfactor{interwordspacetext@euouae}{#1}{#2}%
\fi%
\ifgre@scale@interwordspacetext@bars@euouae%
\gre@changeonedimenfactor{interwordspacetext@bars@euouae}{#1}{#2}%
\fi%
\ifgre@scale@interwordspacetext@bars@notext@euouae%
\gre@changeonedimenfactor{interwordspacetext@bars@notext@euouae}{#1}{#2}%
\fi%
\ifgre@scale@bitrivirspace%
\gre@changeonedimenfactor{bitrivirspace}{#1}{#2}%
\fi%
\ifgre@scale@bitristrospace%
\gre@changeonedimenfactor{bitristrospace}{#1}{#2}%
\fi%
\ifgre@scale@punctuminclinatumshift%
\gre@changeonedimenfactor{punctuminclinatumshift}{#1}{#2}%
\fi%
\ifgre@scale@ascendingpunctuminclinatumshift%
\gre@changeonedimenfactor{ascendingpunctuminclinatumshift}{#1}{#2}%
\fi%
\ifgre@scale@beforepunctainclinatashift%
\gre@changeonedimenfactor{beforepunctainclinatashift}{#1}{#2}%
\fi%
\ifgre@scale@punctuminclinatumanddebilisshift%
\gre@changeonedimenfactor{punctuminclinatumanddebilisshift}{#1}{#2}%
\fi%
\ifgre@scale@ascendingpunctuminclinatumanddebilisshift%
\gre@changeonedimenfactor{ascendingpunctuminclinatumanddebilisshift}{#1}{#2}%
\fi%
\ifgre@scale@punctuminclinatumdebilisshift%
\gre@changeonedimenfactor{punctuminclinatumdebilisshift}{#1}{#2}%
\fi%
\ifgre@scale@punctuminclinatumbigshift%
\gre@changeonedimenfactor{punctuminclinatumbigshift}{#1}{#2}%
\fi%
\ifgre@scale@ascendingpunctuminclinatumbigshift%
\gre@changeonedimenfactor{ascendingpunctuminclinatumbigshift}{#1}{#2}%
\fi%
\ifgre@scale@punctuminclinatummaxshift%
\gre@changeonedimenfactor{punctuminclinatummaxshift}{#1}{#2}%
\fi%
\ifgre@scale@ascendingpunctuminclinatummaxshift%
\gre@changeonedimenfactor{ascendingpunctuminclinatummaxshift}{#1}{#2}%
\fi%
\ifgre@scale@descendinginclinatumtonobarshift%
\gre@changeonedimenfactor{descendinginclinatumtonobarshift}{#1}{#2}%
\fi%
\ifgre@scale@descendinginclinatumtonobarbigshift%
\gre@changeonedimenfactor{descendinginclinatumtonobarbigshift}{#1}{#2}%
\fi%
\ifgre@scale@descendinginclinatumtonobarmaxshift%
\gre@changeonedimenfactor{descendinginclinatumtonobarmaxshift}{#1}{#2}%
\fi%
\ifgre@scale@ascendinginclinatumtonobarshift%
\gre@changeonedimenfactor{ascendinginclinatumtonobarshift}{#1}{#2}%
\fi%
\ifgre@scale@ascendinginclinatumtonobarbigshift%
\gre@changeonedimenfactor{ascendinginclinatumtonobarbigshift}{#1}{#2}%
\fi%
\ifgre@scale@ascendinginclinatumtonobarmaxshift%
\gre@changeonedimenfactor{ascendinginclinatumtonobarmaxshift}{#1}{#2}%
\fi%
\ifgre@scale@bar@virgula%
\gre@changeonedimenfactor{bar@virgula}{#1}{#2}%
\fi%
\ifgre@scale@bar@minima%
\gre@changeonedimenfactor{bar@minima}{#1}{#2}%
\fi%
\ifgre@scale@bar@minor%
\gre@changeonedimenfactor{bar@minor}{#1}{#2}%
\fi%
\ifgre@scale@bar@minor%
\gre@changeonedimenfactor{bar@dominican}{#1}{#2}%
\fi%
\ifgre@scale@bar@maior%
\gre@changeonedimenfactor{bar@maior}{#1}{#2}%
\fi%
\ifgre@scale@bar@finalis%
\gre@changeonedimenfactor{bar@finalis}{#1}{#2}%
\fi%
\ifgre@scale@bar@finalfinalis%
\gre@changeonedimenfactor{bar@finalfinalis}{#1}{#2}%
\fi%
\ifgre@scale@bar@virgula@standalone@text%
\gre@changeonedimenfactor{bar@virgula@standalone@text}{#1}{#2}%
\fi%
\ifgre@scale@bar@minima@standalone@text%
\gre@changeonedimenfactor{bar@minima@standalone@text}{#1}{#2}%
\fi%
\ifgre@scale@bar@minor@standalone@text%
\gre@changeonedimenfactor{bar@minor@standalone@text}{#1}{#2}%
\fi%
\ifgre@scale@bar@minor@standalone@text%
\gre@changeonedimenfactor{bar@dominican@standalone@text}{#1}{#2}%
\fi%
\ifgre@scale@bar@maior@standalone@text%
\gre@changeonedimenfactor{bar@maior@standalone@text}{#1}{#2}%
\fi%
\ifgre@scale@bar@finalis@standalone@text%
\gre@changeonedimenfactor{bar@finalis@standalone@text}{#1}{#2}%
\fi%
\ifgre@scale@bar@virgula@standalone@notext%
\gre@changeonedimenfactor{bar@virgula@standalone@notext}{#1}{#2}%
\fi%
\ifgre@scale@bar@minima@standalone@notext%
\gre@changeonedimenfactor{bar@minima@standalone@notext}{#1}{#2}%
\fi%
\ifgre@scale@bar@minor@standalone@notext%
\gre@changeonedimenfactor{bar@minor@standalone@notext}{#1}{#2}%
\fi%
\ifgre@scale@bar@minor@standalone@notext%
\gre@changeonedimenfactor{bar@dominican@standalone@notext}{#1}{#2}%
\fi%
\ifgre@scale@bar@maior@standalone@notext%
\gre@changeonedimenfactor{bar@maior@standalone@notext}{#1}{#2}%
\fi%
\ifgre@scale@bar@finalis@standalone@notext%
\gre@changeonedimenfactor{bar@finalis@standalone@notext}{#1}{#2}%
\fi%
\ifgre@scale@spacearoundclefbars%
\gre@changeonedimenfactor{spacearoundclefbars}{#1}{#2}%
\fi%
\ifgre@scale@textbartextspace%
\gre@changeonedimenfactor{textbartextspace}{#1}{#2}%
\fi%
\ifgre@scale@notebarspace%
\gre@changeonedimenfactor{notebarspace}{#1}{#2}%
\fi%
\ifgre@scale@maximumspacewithoutdash%
\gre@changeonedimenfactor{maximumspacewithoutdash}{#1}{#2}%
\fi%
\ifgre@scale@afterclefnospace%
\gre@changeonedimenfactor{afterclefnospace}{#1}{#2}%
\fi%
\ifgre@scale@afterinitialshift%
\gre@changeonedimenfactor{afterinitialshift}{#1}{#2}%
\fi%
\ifgre@scale@beforeinitialshift%
\gre@changeonedimenfactor{beforeinitialshift}{#1}{#2}%
\fi%
\ifgre@scale@minimalspaceatlinebeginning%
\gre@changeonedimenfactor{minimalspaceatlinebeginning}{#1}{#2}%
\fi%
\ifgre@scale@manualinitialwidth%
\gre@changeonedimenfactor{manualinitialwidth}{#1}{#2}%
\fi%
\ifgre@scale@annotationseparation%
\gre@changeonedimenfactor{annotationseparation}{#1}{#2}%
\fi%
\ifgre@scale@annotationraise%
\gre@changeonedimenfactor{annotationraise}{#1}{#2}%
\fi%
\ifgre@scale@noclefspace%
\gre@changeonedimenfactor{noclefspace}{#1}{#2}%
\fi%
\ifgre@scale@clefchangespace%
\gre@changeonedimenfactor{clefchangespace}{#1}{#2}%
\fi%
\ifgre@scale@clivisalignmentmin%
\gre@changeonedimenfactor{clivisalignmentmin}{#1}{#2}%
\fi%
\ifgre@scale@choralsigndownshift%
\gre@changeonedimenfactor{choralsigndownshift}{#1}{#2}%
\fi%
\ifgre@scale@choralsignupshift%
\gre@changeonedimenfactor{choralsignupshift}{#1}{#2}%
\fi%
\ifgre@scale@translationheight%
\gre@changeonedimenfactor{translationheight}{#1}{#2}%
\fi%
\ifgre@scale@spaceabovelines%
\gre@changeonedimenfactor{spaceabovelines}{#1}{#2}%
\fi%
\ifgre@scale@spacelinestext%
\gre@changeonedimenfactor{spacelinestext}{#1}{#2}%
\fi%
\ifgre@scale@spacebeneathtext%
\gre@changeonedimenfactor{spacebeneathtext}{#1}{#2}%
\fi%
\ifgre@scale@abovelinestextraise%
\gre@changeonedimenfactor{abovelinestextraise}{#1}{#2}%
\fi%
\ifgre@scale@abovelinestextheight%
\gre@changeonedimenfactor{abovelinestextheight}{#1}{#2}%
\fi%
\ifgre@scale@braceshift%
\gre@changeonedimenfactor{braceshift}{#1}{#2}%
\fi%
\ifgre@scale@curlybraceaccentusshift%
\gre@changeonedimenfactor{curlybraceaccentusshift}{#1}{#2}%
\fi%
\ifgre@scale@maxbaroffsettextright%
\gre@changeonedimenfactor{maxbaroffsettextright}{#1}{#2}%
\fi%
\ifgre@scale@maxbaroffsettextleft%
\gre@changeonedimenfactor{maxbaroffsettextleft}{#1}{#2}%
\fi%
\ifgre@scale@maxbaroffsettextright@nobar%
\gre@changeonedimenfactor{maxbaroffsettextright@nobar}{#1}{#2}%
\fi%
\ifgre@scale@maxbaroffsettextleft@nobar%
\gre@changeonedimenfactor{maxbaroffsettextleft@nobar}{#1}{#2}%
\fi%
\ifgre@scale@maxbaroffsettextleft@eol%
\gre@changeonedimenfactor{maxbaroffsettextleft@eol}{#1}{#2}%
\fi%
\ifgre@scale@maxbaroffsettextright@eol%
\gre@changeonedimenfactor{maxbaroffsettextright@eol}{#1}{#2}%
\fi%
\ifgre@scale@bar@rubber%
\gre@changeonedimenfactor{bar@rubber}{#1}{#2}%
\fi%
\ifgre@scale@divisiofinalissep%
\gre@changeonedimenfactor{divisiofinalissep}{#1}{#2}%
\fi%
\ifgre@scale@stafflinefactor%
\gre@count@temp@two = \numexpr((\gre@stafflinefactor * #2) / #1)\relax%
\xdef\gre@stafflinefactor{\the\gre@count@temp@two}%
\fi%
\relax %
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Some Macros for changing the spacing around the initial
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Seeing as these are the distances that people will want to change the most often,
%we give them their own set of macros to make that easier.
% To change the spacing between annotations.
%First argument is distance, second is whether it should scale when \gre@factor changes.
\def\setaboveinitialseparation#1#2{%OBSOLETE
\gre@obsolete{\protect\setaboveinitialseparation}{\protect\grechangedim\{annotationseparation\}}%
}%
%To change the space after the initial
%First argument is distance, second is whether it should scale when \gre@factor changes.
\def\setspaceafterinitial#1#2{%OBSOLETE
\gre@obsolete{\protect\setspaceafterinitial}{\protect\grechangedim{afterinitialshift}}%
}
%To change the space before the initial
%First argument is distance, second is whether it should scale when \gre@factor changes.
\def\setspacebeforeinitial#1#2{%OBSOLETE
\gre@obsolete{\protect\setspacebeforeinitial}{\protect\grechangedim{beforeinitialshift}}%
}%
%To change all the distances associated with the initial.
%First three arguments are distances, last is whether they should scale when \gre@factor changes.
\def\setinitialspacing#1#2#3#4{%OBSOLETE
\gre@obsolete{\protect\setinitialspacing}{\protect\grechangedim{beforeinitialshift}, \protect\grechangedim{manualinitialwidth}, and \protect\grechangedim{afterinitialshift}}%
}%
|