forked from joaomlourenco/novathesis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
novathesis.cls
2695 lines (2374 loc) · 91.9 KB
/
novathesis.cls
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
%!TEX root=template.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% novathesis.cls
%% NOVA thesis document class
%%
%% This work is licensed under the
%% The LaTeX project public license (LPPL), version 1.3c
%% To view a copy of this license, visit
%% https://www.latex-project.org/lppl/lppl-1-3c/
%%
%% Version 2023-11-18 [7.1.11]
%% Departamento de Informática (www.di.fct.unl.pt)
%% Faculdade de Ciências e Tecnologia (www.fct.unl.pt)
%% Universidade NOVA de Lisboa (www.unl.pt)
%%
%% BUGS and SUGGESTIONS: please submit an issue at the project web page
%% at: https://github.com/joaomlourenco/novathesis/
%%
%% HELP: please DO NOT SEND ME EMAILS about LaTeX or the NOVAthesis template
%% please ask for help at GitHub Discussions page at
%% https://github.com/joaomlourenco/novathesis/discussions
%% or at the NOVAthesis facebook group at
%% https://www.facebook.com/groups/novathesis
%%
%% AUTHOR @github:
%% - joaomlourenco
%%
%% CONTRIBUTORS @github:
%% https://github.com/joaomlourenco/novathesis/wiki#help-with-the-project-patches-and-new-features
%%
%% DONATIONS:
%% If you think this template really helped you while writing your thesis, then
%% 1. Go to the project web page and giv it a star (on the top-right)
%% 2. Make a small donation using the URL below
%% https://www.paypal.com/donate/?hosted_button_id=8WA8FRVMB78W8
%% We will keep a list thanking to all the identified donors that identify
%% themselves in the “Add special instructions to the seller:” box.
%%
%% CITATION:
%% If you use this template, please be kind and cite it in your bibliography:
%% “João M. Lourenço, The NOVAthesis \LaTeX\ Template User’s Manual,
%% NOVA University Lisbon, 2021,
%% https://github.com/joaomlourenco/novathesis/raw/main/template.pdf.”
%% The BibTeX entry is already in the exxample “bibliography.bib” file:
%% @Manual{novathesis-manual,
%% title ={{The NOVAthesis \LaTeX\ Template User's Manual}},
%% author ={João M. Lourenço},
%% organization={NOVA University Lisbon},
%% year ={2021},
%% url ={https://github.com/joaomlourenco/novathesis/raw/main/template.pdf},
%% }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
%%% WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
%%%
%%% You SHOULD NOT change this file (you are playing with fire!)
%%%
%%% WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
%%% WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ProvidesClass{novathesis}[2023-11-18 novathesis template]
\NeedsTeXFormat{LaTeX2e}[2020-02-02]
%============================================================
% Save these definitions asap, to be used later in the “\annex” command,
% because "\@Roman" and "\Roman" were failing with pdflatex
% when loading the "greek" language (and LGR font encofing)
%============================================================
\let\oldRoman=\Roman
\let\old@Roman=\@Roman
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% MEMOIR CUSTOMIZATION AND LOADING
%% Please open and edit the appropriate
%% configuration file “Config/0_memoir.tex”
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*{\ntmemoirsetup}[1]{\PassOptionsToClass{#1}{memoir}}
\input{Config/0_memoir}
\LoadClass{memoir}
\OnehalfSpacing% One-and-half spacing
\newcolumntype{L}{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}X}
\newcolumntype{C}{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}X}
\newcolumntype{R}{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}X}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% SOME ESSENTIAL PACKAGES
%% Others will be loaded later, in the file “packages.tex”
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage[table,svgnames]{xcolor}%
% \RequirePackage{tabularray}
% \UseTblrLibrary{booktabs}
\ifdefined\NewDocumentCommand\else\RequirePackage{xparse}\fi % load xparse if necessary
\RequirePackage{xfor}
\RequirePackage{iftex}
\RequirePackage{etoolbox}
\RequirePackage{xstring}
\RequirePackage{varwidth}
\RequirePackage{NOVAthesisFiles/memory2}
\RequirePackage{NOVAthesisFiles/nt-version}
%%%%% Configure Graphics
\RequirePackage[nobeamer]{graphbox}% improved version of "graphicx"
\graphicspath{{Chapters/Figures/}}
\DeclareGraphicsExtensions{.pdf,.png,.tif,.jpg}
\providecommand*\appendtographicspath[1]{\xappto\Ginput@path{#1}}
\providecommand*\prependtographicspath[1]{\xpreto\Ginput@path{#1}}
%%%%% Options to sans serif fonts (will be loaded later)
\PassOptionsToPackage{scaled=0.95}{inter}
\PassOptionsToPackage{scaled=0.95}{helvet}
\PassOptionsToPackage{scaled=0.95}{gillius2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Deal with NOVATHESIS options and configuration files
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{NOVAthesisFiles/options2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PACKAGE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\splitbyslash#1/#2\relax#3#4{\edef#3{#1}\edef#4{#2}}
\def\@nt@saveabstractorder{}
\newcommand{\@setabstractorder}{%
% \typeout{SAVEABSORDER=[\@nt@saveabstractorder]}\SAVEABSORDER%
\StrGobbleRight{\@nt@saveabstractorder}{1}[\@nt@saveabstractorder]%
\@for\myi:=\@nt@saveabstractorder\do{%
\StrCut{\myi}{=}\@nt@key\@nt@val%
\IfStrEq{\@nt@val}{}{\edef\@nt@val{\@nt@key}\def\@nt@key{\@LANG@MAIN}}{}%
% \typeout{SETABSORDER (\@nt@key):=[\@nt@val]}\SETABSORDER%
\abstractorder(\@nt@key):={\@nt@val}%
}%
}
% --------------------------------------------------------
% Search if a data/memory is defined and returns value
\def\datamatch#1#2(#3){%
% #1 = macro to set
% #2 = data@memory
% #3 = list of values
% Search and match first value from the list, error if no match is found
\datamatchtf{#1}{#2}(#3){}{\ClassError{novathesis}{Could not find “#2” defined with any of “(#3)”!}{}}%
}
\def\datamatchtf#1#2(#3)#4#5{%
% #1 = macro to set
% #2 = data@memory
% #3 = list of values
% #4 = true branch
% #5 = false branch
% Search and match first value from the list, true (found) and not true (not found) branches
% \typeout{#2(#3)}%
% \ifdatadefinedor{\@match}{#2}(#3)%
% {\protect\gdef#1{\csuse{the#2}(\@match)}#4}%
% {\protect\gdef#1{}#5}%
\ifdatadefinedor{\@match}{#2}(#3)%
{\protect\xdef#1{\expanded{\csuse{the#2}(\@match)}}#4}%
{\protect\xdef#1{}#5}%
}
\newdata{validprocessor}
\validprocessor(uminho):={lua,xe}
% \validprocessor(nova/itqb):={pdf,lua}
\validprocessor(other/esep):={xe,lua}
\newcommand{\@validate@ltx@processor}[3]{%
% 1 = UNIV
% 2 = SCHL
% 3 = DGR
% \typeout{@validate@ltx@processor U=[#1] S=[#2] D=[#3]}\@VALIDATE@PROCESSOR
\newif\ifvalidprocessor%
\validprocessorfalse%
\datamatchtf{\@ltxproc}{processor}({#1/#2/#3},{#1/#2},{#1}){% LISTED
\@validate@ltx@processor@i(\@ltxproc)%
}{% UNLISTED
\validprocessortrue%
}%
% \ifdatadefined{processor}(#1/#2){\@validate@ltx@processor@i{\thevalidprocessor(#1/#2)}}{%
% \ifdatadefined{processor}(#1){\@validate@ltx@processor@i{\thevalidprocessor(#1)}}{%
% \validprocessortrue%
% }}%
\ifvalidprocessor\else\ClassError{novathesis}{\pdfprocessor: Invalid processor for “#1/#2”.}{}\fi%
}
\newcommand{\@validate@ltx@processor@i}[1]{%
% 1 = list of acceptable processors
\@for\myi:=\expanded{#1}\do{%
% \typeout{@validate@ltx@processor@i 1=[\myi]}\@VALIDATE@PROCESSOR@I
\IfStrEqCase{\myi}{%
{pdf}{\ifpdftex\validprocessortrue\fi}%
{lua}{\ifluatex\validprocessortrue\fi}%
{xe}{\ifxetex\validprocessortrue\fi}%
}[\ClassError{novathesis}{Invalid processor type “\myi”}{}]%
}%
}
\newcommand{\pdfprocessor}{%
\ifpdftex pdf(la)tex\fi%
\ifluatex lua(la)tex\fi%
\ifxetex xe(la)tex\fi%
}
\options{/novathesis/.new family,
% DOCUMENT
doctype/.new choice = {phd, phdprop, phdplan, msc, mscplan, bsc, plain},
docstatus/.new choice = {unset, working, provisional, final}, % in not defined by user, unset will be replaced “working”
media/.new choice = {screen, paper},
spine/layout/.new choice = {unset, no, full, trim},
spine/width/.new length = {0pt},
% abstract/deforder/.new choice = {default={\@LANG@MAIN,en}, en={en,pt}},
% abstract/theorder/.new list = {unset},
abstractorder/.new cmd = {\appto\@nt@saveabstractorder{{#1},}},%
% SCHOOL
school/.new cmd = {\StrCut{#1}{/}\@UNIV\@SCHL\StrCut{\@SCHL}{/}\@SCHL\@DEGREEACR%
\@validate@ltx@processor{\@UNIV}{\@SCHL}{\@DEGREEACR}},
school = nova/fct,
% STYLES
style/chapter/.new value = bar,
style/font/.new value = newpx,
style/url/.new cmd = {\AfterPreamble{\urlstyle{#1}}},
color/links/.new cmd = {\@ifpackageloaded{hyperref}%
{\hypersetup{allcolors=#1}}%
{\PassOptionsToPackage{allcolors=#1}{hyperref}}},
% LANGUAGES
lang/extra/.new list = {},
lang/main/.new choice = {en, pt, fr, it, de, es, gr},
lang/cover/.new choice = {en, pt, fr, it, de, es, gr},
lang/copyright/.new choice = {en, pt, fr, it, de, es, gr},
lang/.new cmd = {\optionsalso{/novathesis/lang/main=#1,
/novathesis/lang/cover=#1,
/novathesis/lang/copyright=#1}},
lang = en,
% PRINT ON/OFF
print/committee/.new toggle = false,
print/adviser/.new toggle = true, % fake option - adviser should always be printed
print/frontmatter/.new toggle = true,
print/secondcover/.new toggle = false,
print/copyright/.new toggle = true,
print/timestamp/.new toggle = true,
print/index/.new toggle = false,
print/webography/.new value = {}, % empty means do not make a separate webography
print/statement/.new toggle = false,
% MISC
countsecondcover/.new toggle = false,
numberallpages/.new toggle = false,
gnumberlist/.new toggle = true,
tocintoc/.new toggle = false,
% DEBUG
debug/.new list = {}, % cover, index
% DEGREEACR (for degree-specific configuration files)
% degreeacr/.new value = {},
% degreeacr/phd/.new value = {},
% degreeacr/msc/.new value = {},
% degreeacr/bsc/.new value = {},
% degreeacr/plain/.new value = {},
% SCHOOL specific customization
% NOVA/ITQB
nova/itqb/cover/color/.new choice = {gray, green},
% UMINHO
uminho/copyrightmodifier/.new choice = {by-nc-sa, by-sa, by, by-nc, by-nd, by-nc-nd},
uminho/skipblankcovers/.new toggle = false,
uminho/signatureline/.new toggle = true,
% ULISBOA/FMV
% examdate/year/.new value = {yearX},
% examdate/month/.new value = {monthX},
% examdate/day/.new value = {dayX},
% examdate/.new cmd = {\AtEndPreamble{%
% \@splitdate{#1}{\@exdtYEAR}{\@exdtMONTH}{\@exdtDAY}%
% % \typeout{PROCESSDATE 1=#1 Y=\@exdtYEAR M=\@exdtMONTH D=\@exdtDAY}\PROCESSDATEYMD%
% \options{novathesis/examdate/year=\@exdtYEAR,
% novathesis/examdate/month=\@exdtMONTH,
% novathesis/examdate/day=\@exdtDAY}%
% }},
ulisboa/fmv/scientificarea/.new choice = {C, MF, PASA, SA},
ulisboa/fmv/embargo/period/.new choice = {I, 6, 12},
ulisboa/fmv/embargo/justification/.new value = {Justification for the temporary embargo.},
ulisboa/fmv/reproduction/.new choice = {I, P, N},
}
\newcommand{\@splitdate}[4]{%
% \typeout{PROCESSDATE 1=#1}\PROCESSDATE%
\StrCut{#1}{-}#2\@daterest%
\StrCut{\@daterest}{-}#3#4%
% \typeout{PROCESSDATE 1=#1 Y=#2 M=#3 D=#4}\PROCESSDATEYMD%
}
\newcommand{\printmonth}[1]{%
\IfInteger{#1}{\pgfcalendarmonthname{#1}}{#1}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% GENERAL PURPOSE MACROS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\instring#1#2{TT\fi\begingroup
\edef\x{\endgroup\noexpand\in@{#1}{#2}}\x\ifin@}
% --------------------------------------------------------
% The NOVAthesis logo
\ifdef{\iftutex}{
\newcommand{\novathesis}
{\includegraphics[height=1.1\fontcharht\font`A,vshift=-0.35pt]{NOVAthesisFiles/Images/novathesis-text}}
}{
\newcommand{\novathesis}{\textsl{novathesis}}
}
% --------------------------------------------------------
% Define something (except counters) if undefined
\newcommand*{\defifundef}[2]{\ifundef{#1}{#2{#1}}{}}
% --------------------------------------------------------
% Variant of \@for with an optional final argument, that is
% executed iif the loop is not interrupted
\def\ntforbreak{\@endfortrue}
\long\def\ntfor#1:=#2\do#3{\@ifnextchar[{\ntfor@i#1:=#2\do#3}{\ntfor@i#1:=#2\do#3[]}}
\long\def\ntfor@i#1:=#2\do#3[#4]{%
\@for#1:={#2}\do{\xdef#1{#1}#3}%
\if@endfor\else#4\fi
}
% --------------------------------------------------------
% Print string between <...>
\newcommand*{\embrace}[1]{#1}
% \newcommand*{\embrace}[1]{$\langle$#1$\rangle$}
% --------------------------------------------------------
% Check if a font file exists
\newcommand*{\ntcheckfont}[2]{%
\IfFileExists{NOVAthesisFiles/FontStyles/Fonts/#1}{}%
{\ClassError{novathesis}{Missing font “#1”! Please download from: “#2” and copy it to “NOVAthesisFiles/FontStyles/Fonts/#1”}{Please download from: “#2” and copy it to “NOVAthesisFiles/FontStyles/Fonts/#1”}}%
}
% --------------------------------------------------------
% Load and Helvetica-like font as the default SF font
\newcommand*{\LoadHelveticaLikeFont}{%
\IfFileExists{inter.sty}%
{\RequirePackage{inter}}%
{\IfFileExists{helvet.sty}%
{\RequirePackage{helvet}}%
{\IfFileExists{gillius2.sty}%
{\RequirePackage{gillius2}}%
{\ClassWarning{novathesis}{Could not find a suitable Sans Serif font… using the default!}}}}%
}
% --------------------------------------------------------
% Trim spaces around argument
\ExplSyntaxOn
\cs_new_eq:NN \trimspaces \tl_trim_spaces:n
\cs_new_eq:NN \MyUppercase \text_uppercase:n
\ExplSyntaxOff
% --------------------------------------------------------
% Change main font size on the fly
\newcommand{\setmemoirfontsize}[1]{%
% do something here to change the all the font sizes
% \makeatletter
\input{mem#1.clo} % does not work
% \makeatother
}
% --------------------------------------------------------
% Input the first file from the list (if any)
% #1 = file name
% #2 = list of directories
% #3 = code if succeed [OPTIONAL]
% #4 = code if fails [OPTIONAL]
\def\@nt@InputIfFileExists#1#2{%
% \typeout{IIFE 1=[#1] 2=[#2]}\aaaa
\@ifnextchar[{\@nt@InputIfFileExists@i{#1}#2}{\@nt@InputIfFileExists@i{#1}#2[]}%
}
\def\@nt@InputIfFileExists@i#1#2[#3]{%
% \typeout{INPUTIFFILEEXISTS 1=[#1] 2=[#2] 3=[#3]}\INPUTIFFILEEXISTS
\@ifnextchar[{\@nt@InputIfFileExists@ii{#1}#2[#3]}{\@nt@InputIfFileExists@ii{#1}#2[#3][]}%
}
\def\@nt@InputIfFileExists@ii#1#2[#3][#4]{
% \typeout{IIFE 1=[#1] 2=[#2] 3=[#3] 4=[#4]}\aaaa
\ntfor\dir:=#2\do{\IfFileExists{\dir#1}{\input{\dir#1}#3\ntforbreak}{}}[#4]%
}
\options{/@nt/.new family,
lang/short/.new list={en, pt, fr, it, de, es, gr},
% lang/current/.new choice={en, pt, fr, it, de, es, gr},
lang/loaded/.new list={},
% lang/shorttolong/.new choice={en=english, pt=portuguese, fr=french, it=italian, de=german, es=spanish, gr=greek},
fontenc/.new choice={en=T1, pt=T1, fr=T1, it=T1, de=T1, es=T1, gr=LGR},
}
\newdata{langlong}
\langlong(en):={english}
\langlong(pt):={portuguese}
\langlong(fr):={french}
\langlong(it):={italian}
\langlong(de):={german}
\langlong(es):={spanish}
\langlong(gr):={greek}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% MANAGE FOLDERS PER CLASS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\options{/@nt/folders/.new choice={
bib=Bibliography,
copyright=.,
statement=.,
dedicatory=Chapters,
acknowledgements=Chapters,
quote=Chapters,
abstract=Chapters,
glossaries=Chapters,
chapter=Chapters,
appendix=Chapters,
annex=Chapters,
cover=Chapters,
}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% MANAGE DOCUMENT CLASSES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\options{/@nt/document/.cd,
docclass/.new choice={phd=phd, phdprop=phd, phdplan=phd, msc=msc, mscplan=msc, bsc=bsc, plain=plain},
docmain/.new list={phd, msc, bsc, plain},
}
% --------------------------------------------------------
% Check if the document is of a specific class, i.e., bsc, msc, phd or main
\newcommand{\ifdocclass}[1]{\ifoptionequal{/@nt/document/docclass}{#1}}
\newcommand{\ifmaindoc}{\ifoptioncontains{/@nt/document/docmain}{\@DOCTYPE}}
\newcommand{\ifphddoc}{\ifdocclass{phd}}
\newcommand{\ifmscdoc}{\ifdocclass{msc}}
\newcommand{\ifbscdoc}{\ifdocclass{bsc}}
\newcommand{\ifplaindoc}{\ifdocclass{plain}}
\newcommand{\ifdocstatus}[1]{\ifoptionequal{/novathesis/docstatus}{#1}}
\newcommand{\ifdocfinal}{\ifdocstatus{final}}
\newcommand{\ifdocprovisional}{\ifdocstatus{provisional}}
\newcommand{\ifdocworking}{\ifdocstatus{working}}
\newcommand{\ifdocunset}{\ifdocstatus{unset}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% MANAGE PERSON LISTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\ntaddperson#1(#2,#3)#4{%
% syntax: \ntaddperson{class}[key,gender]{filename}
% #1=adviser | committee
% #2={a,c} {c,r,a,m,g}
% a=adviser c=chair
% c=coadviser r=rapporteur/referee
% a=adviser
% ca=adviser
% m=other members
% g=guests
% #3={m,f}
% #4={person name, position, etc}
% \typeout{NTADDPERSON 1=[#1] 2=[#2] 3=[#3] 4=[#4]}\NTADDPERSON%
\noexpandarg
\StrCut{#4}{,}\@nt@personname\@nt@dummy%was xStrCut
\options{/@nt/#1/#2/name/.expanded/.newpush={\@nt@personname},
/@nt/#1/#2/full/.expanded/.newpush={#4},
/@nt/#1/#2/gender/.newpush={#3}}%
% \typeout{NTADD [/@nt/#1/#2/name=\@nt@personname]}%
\fullexpandarg
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% MANAGE FILE LISTS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*{\ntaddfile}[1]{%
% syntax: \ntaddfile{class}[key]{filename}
% #1=file family (quote, abstract, chapter, etc)
% #2=[file lang] (OPTIONAL)
% #3=filename
\@nt@addtolist{file}{#1}%
}
\newcommand*{\@nt@addtolist}[2]{%
% syntax: \ntaddto{type}{class}[key]{filename}
% #1 ={file, person}
% #2=family {quote, abstract, chapter, etc} or {author, adviser, committee}
% #3=[file lang] (OPTIONAL)
% #4=filename
\@ifnextchar[{\@nt@addtolist@iv[#1]#2}{\@nt@addtolist@iv[#1]#2[\option{/novathesis/doctype}]}%
}
\def\@nt@addtolist@iv[#1]#2[#3]#4{%
% syntax: \@ntaddfile@iii{type}{class}[key]{filename}
% #1 ={file, person}
% #2=file family (quote, abstract, chapter, etc)
% #3=optional file lang
% #4=filename
% \typeout{NT ADDTOLIST [#1] [#2] [#3] [#4]}%
\StrLeft{#4}{1}[\@nt@firstchar]%
\IfStrEqCase{\@nt@firstchar}{%
{/}{\xdef\@nt@filewithpath{#4}}%
{.}{\xdef\@nt@filewithpath{#4}}%
}[%
\options{/@nt/folders=#2}%
\xdef\@nt@filewithpath{\option{/@nt/folders}/#4}%
]%
\@for\myi:=\expanded{#3}\do{%
% \typeout{NT ADDTOLIST [#1] [#2] [#3] [#4]}%
\options{/@nt/#1/#2/\myi/.expanded/.newpush={\@nt@filewithpath}}%
}%
}
\newcommand*{\@nt@foralllist}[3]{%
% #1={file, person}
% #2=file family (quote, abstract, chapter, etc)
% #3=macro to be applied, which will receive the item from the list
\optionlistdo{/@nt/#1/#2}{#3{##1}}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Multilingual support
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*{\ntselectlang}[1]{%
% #1=lang {pt, en, fr, it}
\gdef\@LSHORT{#1}%
\xdef\@LLONG{\thelanglong(#1)}%
% \typeout{NTSELECTLANG [#1 / \@LLONG]}%
\expandnext{\selectlanguage}{\@LLONG}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% ASSOCARRAY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand*{\initmemory}[2][\embrace{\thenotdefined(\@LANG@COVER)}]{%
\optionlistdo{/@nt/lang/short}{\csuse{#2}(##1):={#1}}}
% For PDF bookmakrs
\newdata{bkmstring}
\newdata{notdefined}
\newdata{keywordsenvpre}
\newdata{keywordsenvpost}
\newdata{keywordsblockpre}
\newdata{keywordsblockpost}
\newdata{keywordspre}
\newdata{keywordssep}
% \newdata{keywordsboxlen}
\newdata{keywordsstring}
\newdata{keywordsstringprefix}
\newdata{keywordsstringsuffix}
\newdata{keywordsstringfont}
\keywordsblockpre()={\bigskip\noindent}
\keywordsstringsuffix()={:\enspace}
\keywordsstringfont()={\bfseries}
% \keywordssep()={\ \textbf{\Large\textperiodcentered}\ }
\keywordssep()={, }
% \keywordsboxlen()={\textwidth-\widthof{\usebox{\keywordsstringbox}}}
\newdata{specializationstring}
\newdata{departmentofstring}
\newdata{sponsor}
\newdata{andstring}
\newdata{commastring}
\optionlistdo{/@nt/lang/short}{%
\commastring(#1):={,\ }%
}
\newdata{degreestring}
\newdata{degreestringfont}
\newdata{degreename}
\newdata{degreenamefont}
\newdata{degreenameprefix}
\newdata{degreenameprefixfont}
\newdata{doctypestring}
\newdata{doctypestringfont}
\newdata{adviserstring} % e.g., "Adviser", "Co-adviser"
\newdata{adviserstringfont}
\newdata{adviserstringpre}
\newdata{adviserstringpost}
\newdata{advisernamepre}
\newdata{advisernamepost}
\newdata{advisernamefont}
\newdata{adviserremainderpre}
\newdata{adviserremainderpost}
\newdata{adviserremainderfont}
\adviserremainderfont()={\itshape\scriptsize}
% Committee stuff
\newdata{adviserorder} %e.g., "{a,c}"
\adviserorder():={a,c} % By default print advisers and co-advisers
\newdata{committeeorder} %e.g., "{c,r,a,m,g}"
\newdata{committeetitlestring} %e.g., "Examinaiton Committee"
\newdata{committeetitlestringpre}
\newdata{committeetitlestringpost}
\newdata{committeetitlestringfont}
\newdata{committeestring}
\newdata{committeestringpre}
\newdata{committeestringpost}
\newdata{committeestringfont}
\newdata{committeenamepre}
\newdata{committeenamepost}
\newdata{committeenamefont}
\newdata{committeeremainderpre}
\newdata{committeeremainderpost}
\newdata{committeeremainderfont}
\committeeremainderfont()={\itshape\scriptsize}
\newdata{personpre}
\newdata{personpost}
\newdata{persongrouppre}
\newdata{persongrouppost}
\newdata{dissertationstring}
\newdata{dissertationstringfont}
\newdata{copyrighttextstring}
\newdata{acknowledgmentsstring}
\newdata{majorfield}
\newdata{minorfield}
\newdata{specialization}
\newdata{spine}
\newdata{thesiscover}
\newdata{margin}
\newdata{frontpageimage}
% \newcommand*{\@nt@newmemory}[1]{%
% \newdata{#1}%
% % \initmemory[\embrace{\MakeUppercase{#1}}]{#1}%
% }
% \forcsvlist{\@nt@newmemory}{university,school,department}
\newdata{university}
\newdata{school}
\newdata{department}
\newdata{doctitle}
% For each main language, list which abstracts shall be printed and in which order
% may have more than two (just be sure you include the languages above as well)
\newdata{abstractorder}
% --------------------------------------------------------
% PROCESSING CLASS OPTIONS
\options@ProcessOptions{/novathesis}
% --------------------------------------------------------
% NTSETUP2
\newcommand*{\ntsetup}[2][]{%
% \typeout{NTSETUP [/novathesis/\@UNIV/\@SCHL/#1/#2]}\NTSETUP%
\ntfor\arg:={#2}\do{%
\StrCut{\arg}{=}{\@ntopt}{\@ntval}%
% \typeout{NTSETUP2 [\@ntopt] = [\@ntval]}%
\ifoptiondefined{/novathesis/\@UNIV/\@SCHL/#1/\@ntopt}%
{\options{/novathesis/\@UNIV/\@SCHL/#1/#2}}{%
\ifoptiondefined{/novathesis/#1/\@ntopt}%
{\options{/novathesis/#1/#2}}{%
\ifoptiondefined{/novathesis/\@UNIV/\@SCHL/\@ntopt}%
{\options{/novathesis/\@UNIV/\@SCHL/#2}}{%
\ifoptiondefined{/novathesis/\@UNIV/\@ntopt}%
{\options{/novathesis/\@UNIV/#2}}{%
\ifoptiondefined{/novathesis/\@ntopt}%
{\options{/novathesis/#2}}{%
\ClassError{novathesis}{Invalid class option: \@ntopt}{}{}}}}}}}%
}
\newcommand*{\ntbibsetup}[1]{%
\@ifpackageloaded{biblatex}{\ClassError{novathesis}{Please load biblatex options earlier.}{}}{\PassOptionsToPackage{#1}{biblatex}}%
}
\newcommand*{\NTAddToHook}[2]{\options{/@nt/hook/#1/.newpush={#2}}}
\newcommand*{\NTRunHook}[1]{\optionlistdo{/@nt/hook/#1}{##1}}
% \newcommand*{\NTIfHook}[1]{%
% \ifoptiondefined{/@nt/hook/#1}%
% }
% --------------------------------------------------------
% Pass the remaining options to memoir
% \letoptionlist{/options/remaining}\nt@remaining
% \PassOptionsToClass{\nt@remaining}{memoir}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% LOADING CUSTOMIZATION STUFF - part 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --------------------------------------------------------
% Define DEFAULT corollaryUES for COVER and COPYRIGHT languages
% and HYPERLINK color
\options{/novathesis/lang/cover = \option{/novathesis/lang/main},
/novathesis/lang/copyright = \option{/novathesis/lang/main},
/novathesis/color/links = DarkBlue,
}
% \NTRunHook{memoir}
%============================================================
% TEMPLATE CUSTOMIZATION / OPTIONS
% Please open and edit the appropriate
% configuration file “Config/1_novathesis.tex”
%============================================================
\input{Config/1_novathesis}
\def\@DOCTYPE{\option{/novathesis/doctype}}
\def\@DOCSTATUS{\option{/novathesis/docstatus}}
\options{/@nt/document/docclass=\@DOCTYPE}
\def\@DOCCLASS{\option{/@nt/document/docclass}}
\def\@LANG@COVER{\option{/novathesis/lang/cover}}
\def\@LANG@COPYRIGHT{\option{/novathesis/lang/copyright}}
\def\@LANG@MAIN{\option{/novathesis/lang/main}}
\def\@LANG@MAIN@LONG{\thelanglong(\@LANG@MAIN)}
\@ifmtarg{\@DEGREEACR}{\gdef\@DEGREEACR{\option{/novathesis/degreeacr/\@DOCCLASS}}}{}
\bkmstring(1-1)={\thebkmstring(cover,\@LANG@COVER)}
\bkmstring(2-1)={\thebkmstring(frontpage,\@LANG@COVER)}
\bkmstring(N-2)={\thebkmstring(backcover,\@LANG@COVER)}
\bkmstring(spine)={\thebkmstring(spine,\@LANG@COVER)}
\@setabstractorder
\ifdatadefined{abstractorder}(en){}{%
\abstractorder(en):={en,pt}
}
\ifdatadefined{abstractorder}(\@LANG@MAIN){}{%
\abstractorder(\@LANG@MAIN):={\@LANG@MAIN,en}
}
%============================================================
% BIBLATEX CUSTOMIZATION
% Please open and edit the appropriate
% configuration file “Config/2_biblatex.tex”
%============================================================
\input{Config/2_biblatex}
% \NTRunHook{biblatex}
%============================================================
% LOAD ADDITIONAL PACKAGES
%============================================================
% Load additional symbols
% \RequirePackage[full]{textcomp}
%%%%% Configure multilingual language support
\RequirePackage{csquotes}
\RequirePackage{url}
\RequirePackage{xstring}
\RequirePackage{colortbl}
\definecolor{darkblue}{rgb}{0.0,0.08,0.45}%
\iftoggle{/novathesis/print/index}{
\AtEndPreamble{
\ntaddtoprintorder{mainmatter}{index}
\RequirePackage{imakeidx}
% \makeindex[intoc,columns=2,options=-s myindexstyle]%
\makeindex[intoc,columns=2,options=-s NOVAthesisFiles/ntindexstyle]
}
}{}
% Fixing autoref in yperref
\RequirePackage{NOVAthesisFiles/fix-hyperref}
%--------------------------------
% “biblatex” stuff
% \ntaddfile{bib}{./NOVAthesisFiles/fix-bib.bib}%
% \AtEndDocument{\nocite{novathesis-manual}}%
% \letoptionlist{/@nt/biblatex}\@nt@biblatex@opts%
% \RequirePackage[hyperref=auto,defernumbers=true]{biblatex}%
%--------------------------------
% “hyperref” stuff
\RequirePackage[%
, bookmarksnumbered=true%
, breaklinks=true%
, colorlinks=true%
, pdfdisplaydoctitle=true%
, unicode=true%
]{hyperref}%
\@nt@fixhyperref%
% \pdfstringdefDisableCommands{%
% \def\\{}%
% \def\texttt#1{#1}%
% }%
\RequirePackage{bookmark}%
% \RequirePackage{memhfixc}% Must be used on memoir document class after hyperref
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Include strings for all the languages
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\@LANG@LOADED{}
\def\@langs@loaded@sep{}
\newcommand*{\@nt@loadlang}[1]{%
% \typeout{LL=#1}\LL
\if\instring{,#1,}{,\@LANG@LOADED,}\else%
\InputIfFileExists{NOVAthesisFiles/Strings/strings-#1.ldf}%
{\eappto{\@LANG@LOADED}{\@langs@loaded@sep#1}\def\@langs@loaded@sep{,}}%
{\ClassError{novathesis}{File not found: “NOVAthesisFiles/Strings/strings-#1.ldf” file!}%
{Add a file with the translations for this language.}}%
\fi%
}
\@for\myi:=\expanded{\@LANG@COVER,\@LANG@COPYRIGHT,\@LANG@MAIN,%
\theabstractorder(\@LANG@MAIN)}\do{\@nt@loadlang{\myi}}
\optionlistdo{/novathesis/lang/extra}{\@nt@loadlang{##1}}%
% \letoptionlist{/@nt/lang/loaded}\LANGLOADED
% \typeout{LANGLOADED=\@LANG@LOADED}\LLLLL
\options{/@nt/lang/loaded/.expanded=\@LANG@LOADED}
% \typeout{LANGLOADED=\@LANG@LOADED}\LANG@LOADED
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% CHECK IF USING LUALATEX OR XELATEX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\ifxeorlua}{\ifboolexpr{bool{luatex} or bool{xetex}}}
\newcommand{\ifxetexorluatex}{\iftutex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifxetexorluatex % xelatex or lualatex
\RequirePackage[no-math]{fontspec}%
\defaultfontfeatures{Ligatures=TeX}
\else% pdflatex
\RequirePackage[T1]{fontenc} % Use new T1 fonts
% \RequirePackage[utf8]{inputenc} % Format for the input file(s), see the "enc" option
\fi
% --------------------------------------------------------
% BABEL STUFF
% \options{/@nt/lang/shorttolong=\@LANG@MAIN}%
\PassOptionsToPackage{main=\@LANG@MAIN@LONG}{babel}
\@for\myi:=\expanded{\@LANG@LOADED}\do{%
% \typeout{BABELLANG=\myi \thelanglong(\myi)}\BABELLANG%
% \options{/@nt/lang/shorttolong=\myi}%
\PassOptionsToPackage{\expanded{\thelanglong(\myi)}}{babel}%
\PassOptionsToPackage{\expanded{\thelanglong(\myi)}}{translator}%
}%
% --------------------------------------------------------
% FIX BABEL TRANSLATION
\RequirePackage[english]{babel} % Support for multilingual documents
\RequirePackage{translator} % Support month name translations for pgfcalendar
\input{NOVAthesisFiles/fix-babel.tex}
%--------------------------------
% “glossasries” stuff - after hyperref
\ifoptioncontains{/novathesis/lang/extra}{gr}{%
\PassOptionsToPackage{xindy={language=\@LANG@MAIN@LONG}}{glossaries-extra}
}{}
\RequirePackage[%
% , nonumberlist
translate=babel,
acronym, % add acronyms listing
symbols, % add symbols listing
% sanitizesort=false, % allow \gls inside descriptions
% xindy={language=\@LANG@MAIN@LONG},
nolong,
nosuper,
nolist,
notree,
nostyles,
automake,
]{glossaries-extra}% To create glossaries
\RequirePackage{NOVAthesisFiles/glossary-xltabular}%
\setglossarystyle{xltabular}%
\setabbreviationstyle[acronym]{long-short}%
\GlsXtrEnablePreLocationTag{\emph{(\small p.~}}{\emph{(\small pp.~}}
\patchcmd{\@gls@automake@immediate}{-I xindy}{-q -I xindy}{}{}
% \renewcommand{\gls@automake@makegloss}{makeglossaries -q}%
\renewcommand{\GlsXtrFormatLocationList}[1]{\emph{\small#1)}}
\renewcommand{\glsnamefont}[1]{\textbf{#1}}%
%--------------------------------
% “Process gnumberlist” option - after glossaries
\iftoggle{/novathesis/gnumberlist}{}{\setupglossaries{nonumberlist}}%
\AtEndPreamble{\@loadglossaryfiles\makeglossaries}%
%--------------------------------
% TIKZ
\RequirePackage{tikz}
%%%%% Fine tuning of typesetting
\ifxeorlua{}{% pdflatex
\RequirePackage[%
babel=true,
activate={true,nocompatibility}, % activate={true,nocompatibility} - activate protrusion and expansion
final, % final - enable microtype; use "draft" to disable
tracking=true, % tracking=true - activate this technique
kerning=true, % kerning=true - activate this technique
spacing=true, % spacing=true - activate this technique
factor=1100, % factor=1100 - add 10% to the protrusion amount (default is 1000)
stretch=10, % stretch=10 - reduce stretchability (default is 20)
shrink=10, % shrink=10 - reduce shrinkability (default is 20)
]{microtype}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% DEFINITIONS FOR THE REMINDER OF CUSTOMIZATION STUFF
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% --------------------------------------------------------
% Department
\def\ntdepartment{\@ifstar{\@ntdepartmentifundef}{\@ntdepartment}}
\def\@ntdepartmentifundef(#1)#2{\ifdatadefined{department}(#1){}{\@ntdepartment(#1){#2}}}
\def\@ntdepartment(#1)#2{\department(#1):={#2}}
% --------------------------------------------------------
% Degree
\def\ntmajorfield{\@ifstar{\@ntmajorfieldifundef}{\@ntmajorfield}}
\def\@ntmajorfieldifundef(#1)#2{\ifdatadefined{majorfield}(#1){}{\@ntmajorfield(#1){#2}}}
\def\@ntmajorfield(#1)#2{\majorfield(#1):={#2}}
\def\ntdegreename{\@ifstar{\@ntdegreenameifundef}{\@ntdegreename}}
\def\@ntdegreenameifundef(#1)#2{\ifdatadefined{degreename}(#1){}{\@ntdegreename(#1){#2}}}
\def\@ntdegreename(#1)#2{%
% #1 = ignored
% #1 = lang
% #2 = value
\datamatch{\match}{degreenameprefix}(%
{\@DOCTYPE,\@DEGREEACR,\@LANG@COVER},%
{\@DOCCLASS,\@DEGREEACR,\@LANG@COVER},%
{\@DEGREEACR,\@LANG@COVER},%
{\@DOCTYPE,\@LANG@COVER},%
{\@DOCCLASS,\@LANG@COVER},%
{\@LANG@COVER}%
)%
\ifblank{\match}{\degreename(#1):={#2}}{\degreename(#1):={\match\ #2}}%
\majorfield(#1):={#2}%
}
% --------------------------------------------------------
% Specialization
\def\ntminorfield{\@ifstar{\@ntminorfieldifundef}{\@ntminorfield}}
\def\@ntminorfieldifundef(#1)#2{\ifdatadefined{minorfield}(#1){}{\@ntminorfield(#1){#2}}}
\def\@ntminorfield(#1)#2{\minorfield(#1):={#2}}
\def\ntspecialization{\@ifstar{\@ntspecializationifundef}{\@ntspecialization}}
\def\@ntspecializationifundef(#1)#2{\ifdatadefined{specialization}(#1){}{\@ntspecialization(#1){#2}}}
\def\@ntspecialization(#1)#2{%
\datamatch{\match}{specializationstring}(%
{\@DOCTYPE,\@DEGREEACR,\@LANG@COVER},%
{\@DOCCLASS,\@DEGREEACR,\@LANG@COVER}%
{\@DEGREEACR,\@LANG@COVER},%
{\@DOCTYPE,\@LANG@COVER},%
{\@DOCCLASS,\@LANG@COVER},%
{\@LANG@COVER}%
)%
\ifblank{\match}{\specialization(#1):={#2}}{\specialization(#1):={\match\ #2}}%
\minorfield*(#1):={#2}%
}
% --------------------------------------------------------
% Sponsors
\def\ntsponsors(#1)#2{\sponsor(#1):={#2}}
% --------------------------------------------------------
% Title
\def\nttitle(#1,#2)#3{%
% #1 = type (main, sub, spine) title
% #2 = lang