Browse Source

classes: improved LuaTeX and XeTeX support

master
Jonathan Spratte 1 year ago
parent
commit
5331a3e951

BIN
Doc/doc_MRTbundle.pdf View File


+ 14
- 0
Doc/preamble/doc_macros.tex View File

@@ -32,6 +32,20 @@
32 32
 \newcommand*\sarg[1]{\metaEnclosed<{#1}>}
33 33
 \newcommand*\carg[2]{\texttt{(}\meta{#1},\meta{#2}\texttt{)}}
34 34
 \newcommand*\tfarg{\texttt{\textit{TF}}}
35
+\newcommand*\luaxetex%>>>
36
+  {%
37
+    \luaxe{}%
38
+  }%<<<
39
+\newcommand*\luaxelatex%>>>
40
+  {%
41
+    \luaxe{La}%
42
+  }%<<<
43
+\newcommand*\luaxe[1]%>>>
44
+  {%
45
+    \@ifstar
46
+      {\hologo{Lua#1TeX} and \hologo{Xe#1TeX}}
47
+      {\hologo{Lua#1TeX} or  \hologo{Xe#1TeX}}%
48
+  }%<<<
35 49
 \ExplSyntaxOn
36 50
 \int_new:N \g_docMRTbundle_dsctable_lines_int
37 51
 \int_new:N \l_docMRTbundle_fakeit_level_int

+ 17
- 1
Doc/tex/doc_MRTalone.tex View File

@@ -35,7 +35,23 @@ The class features a few load time options.
35 35
 \begin{describeopt}{sfacc}[\meta{choice}]
36 36
   \meta{choice} must be \opt{height} or \opt{list}. Sets the approach used by
37 37
   \pkg{MRTsfacc} (see \autoref{sec:sfacc}). If it is not specified the
38
-  \opt{list} variant is used.
38
+  \opt{list} variant is used and \bverb|\MRTsfaccLoadShiftList{helvet}| will be
39
+  issued.
40
+\end{describeopt}
41
+\begin{describeopt}{font}[\meta{font}]
42
+  This is only available if you're using \luaxetex. With this you can set the
43
+  used sans serif font, which will be used as the default font. It should be
44
+  a font resembling Helvetica or Arial.
45
+\end{describeopt}
46
+\begin{describeopt}{serif font}[\meta{font}]
47
+  This is only available if you're using \luaxetex. With this you can set the
48
+  used serif font. This isn't too important as the default fonts will suffice.
49
+  You shouldn't have too much text with a Roman font anyway.
50
+\end{describeopt}
51
+\begin{describeopt}{mono font}[\meta{font}]
52
+  This is only available if you're using \luaxetex. With this you can set the
53
+  used mono font. This isn't too important as the default fonts will suffice.
54
+  You shouldn't have too much text with a Roman font anyway.
39 55
 \end{describeopt}
40 56
 
41 57
 \noindent

+ 19
- 3
Doc/tex/doc_MRTbeam.tex View File

@@ -82,13 +82,29 @@ Neither of the footers is restricted in horizontal size. As a result they might
82 82
 overlap if you specify really long contents.
83 83
 
84 84
 \section{Options}
85
-The class passes almost all options given to it on to \cls{beamer}. The one
86
-handled by the class is:
85
+The class passes almost all options given to it on to \cls{beamer}. The few
86
+handled by the class are:
87 87
 
88 88
 \begin{describeopt}{sfacc}[\meta{choice}]
89 89
   \meta{choice} must be \opt{height} or \opt{list}. Sets the approach used by
90 90
   \pkg{MRTsfacc} (see \autoref{sec:sfacc}). If it is not specified the
91
-  \opt{list} variant is used.
91
+  \opt{list} variant is used and \bverb|\MRTsfaccLoadShiftList{helvet}| will be
92
+  issued.
93
+\end{describeopt}
94
+\begin{describeopt}{font}[\meta{font}]
95
+  This is only available if you're using \luaxetex. With this you can set the
96
+  used sans serif font, which will be used as the default font. It should be
97
+  a font resembling Helvetica or Arial.
98
+\end{describeopt}
99
+\begin{describeopt}{serif font}[\meta{font}]
100
+  This is only available if you're using \luaxetex. With this you can set the
101
+  used serif font. This isn't too important as the default fonts will suffice.
102
+  You shouldn't have too much text with a Roman font anyway.
103
+\end{describeopt}
104
+\begin{describeopt}{mono font}[\meta{font}]
105
+  This is only available if you're using \luaxetex. With this you can set the
106
+  used mono font. This isn't too important as the default fonts will suffice.
107
+  You shouldn't have too much text with a Roman font anyway.
92 108
 \end{describeopt}
93 109
 
94 110
 There are still some more class specific options which you can set with some

+ 17
- 1
Doc/tex/doc_MRTthesis.tex View File

@@ -50,7 +50,23 @@ The class features a few load time options.
50 50
 \begin{describeopt}{sfacc}[\meta{choice}]
51 51
   \meta{choice} must be \opt{height} or \opt{list}. Sets the approach used by
52 52
   \pkg{MRTsfacc} (see \autoref{sec:sfacc}). If it is not specified the
53
-  \opt{list} variant is used.
53
+  \opt{list} variant is used and \bverb|\MRTsfaccLoadShiftList{helvet}| will be
54
+  issued.
55
+\end{describeopt}
56
+\begin{describeopt}{font}[\meta{font}]
57
+  This is only available if you're using \luaxetex. With this you can set the
58
+  used sans serif font, which will be used as the default font. It should be
59
+  a font resembling Helvetica or Arial.
60
+\end{describeopt}
61
+\begin{describeopt}{serif font}[\meta{font}]
62
+  This is only available if you're using \luaxetex. With this you can set the
63
+  used serif font. This isn't too important as the default fonts will suffice.
64
+  You shouldn't have too much text with a Roman font anyway.
65
+\end{describeopt}
66
+\begin{describeopt}{mono font}[\meta{font}]
67
+  This is only available if you're using \luaxetex. With this you can set the
68
+  used mono font. This isn't too important as the default fonts will suffice.
69
+  You shouldn't have too much text with a Roman font anyway.
54 70
 \end{describeopt}
55 71
 
56 72
 \noindent

+ 10
- 3
Doc/tex/doc_introduction.tex View File

@@ -1,10 +1,17 @@
1 1
 \chapter{Introduction}
2
-This bundle provides two \LaTeX\ classes, one for theses and one for
2
+This bundle provides three \LaTeX\ classes, one for theses and one for
3 3
 presentations, which both aim to match the corresponding MS Office templates of
4 4
 the Chair of Measurement and Control Engineering (Lehrstuhl für Mess"~~und
5 5
 Regeltechnik; MRT) of the University of Bayreuth, hence the name. Along the two
6
-major classes \cls{MRTthesis} and \cls{MRTbeam} there are minor auxiliary
7
-packages contained in this distribution.
6
+major classes \cls{MRTthesis} and \cls{MRTbeam} there are another class to
7
+create stand alone images and minor auxiliary packages contained in this
8
+distribution.
9
+
10
+The classes are originally created for use with \hologo{pdfLaTeX} and give the
11
+best results with it. This is caused by the available fonts. The classes were
12
+created for use with the \pkg{helvet} font which is not a good choice for
13
+\luaxelatex*. Therefore, if you're using those engines, you'll be encouraged to
14
+choose a system font matching Helvetica or Arial.
8 15
 
9 16
 This bundle makes no claim to be complete, comprehensive, or correct. For
10 17
 formatting errors I don't take any responsibility. Each author takes full

+ 87
- 24
MRTalone/MRTalone.cls View File

@@ -1,5 +1,5 @@
1
-\newcommand*\MRTalone@version{0.0.2}
2
-\newcommand*\MRTalone@date{2018-11-07}
1
+\newcommand*\MRTalone@version{0.0.3}
2
+\newcommand*\MRTalone@date{2018-11-08}
3 3
 
4 4
 \NeedsTeXFormat{LaTeX2e}
5 5
 
@@ -8,18 +8,38 @@
8 8
   {MRTalone}          {\MRTalone@date}
9 9
   {\MRTalone@version} {standalone matching MRTthesis}
10 10
 
11
+%% variants of external macros >>>
12
+%%=============================================================================
13
+\cs_generate_variant:Nn \keys_set:nn { nV }
14
+%%==========================================================================<<<
15
+
11 16
 %% variables >>>
12 17
 %%=============================================================================
13 18
 % l3 variables >>>
14 19
 % bool >>>
15
-\bool_new:N \l_MRTthesis_minimal_bool
16
-\bool_new:N \l_MRTthesis_mathsizes_bool
17
-\bool_new:N \l_MRTthesis_british_bool
18
-\bool_new:N \l_MRTthesis_sfacc_height_bool
20
+\bool_new:N \l_MRTalone_minimal_bool
21
+\bool_new:N \l_MRTalone_mathsizes_bool
22
+\bool_new:N \l_MRTalone_british_bool
23
+\bool_new:N \l_MRTalone_sfacc_height_bool
19 24
 % <<<
20 25
 % <<<
21 26
 %%==========================================================================<<<
22 27
 
28
+%% constants >>>
29
+%%=============================================================================
30
+\bool_const:Nn \c_MRTalone_xetex_or_luatex_bool
31
+  { \sys_if_engine_luatex_p: || \sys_if_engine_xetex_p: }
32
+%%==========================================================================<<<
33
+
34
+%% messages >>>
35
+%%=============================================================================
36
+\msg_new:nnn { MRTalone } { wrong~engine }%>>>
37
+  {
38
+    The ~ used ~ #1 ~ is ~ not ~ available ~ under ~ \c_sys_engine_str. ~ You ~
39
+    have ~ to ~ use ~ #2.
40
+  }%<<<
41
+%%==========================================================================<<<
42
+
23 43
 \NewDocumentCommand \MRTaloneSetup { +m }%>>>
24 44
   {
25 45
     \keys_set:nn { MRTalone/setup } { #1 }
@@ -28,17 +48,46 @@
28 48
 %% Class options and loading standalone >>>
29 49
 %%=============================================================================
30 50
 \DeclareOption{longtable}{\PassOptionsToPackage{longtable}{MRTtab}}
31
-\DeclareOption{mathsizes}{\bool_set_true:N \l_MRTthesis_mathsizes_bool}
32
-\DeclareOption{minimal}{\bool_set_true:N \l_MRTthesis_minimal_bool}
33
-\DeclareOption{no mathsizes}{\bool_set_false:N \l_MRTthesis_mathsizes_bool}
51
+\DeclareOption{mathsizes}{\bool_set_true:N \l_MRTalone_mathsizes_bool}
52
+\DeclareOption{minimal}{\bool_set_true:N \l_MRTalone_minimal_bool}
53
+\DeclareOption{no mathsizes}{\bool_set_false:N \l_MRTalone_mathsizes_bool}
34 54
 \DeclareOption{tikzunderline}{\PassOptionsToPackage{tUline}{MRTwuline}}
35 55
 \DeclareOption{tUline}{\ExecuteOptions{tikzunderline}}
36
-\DeclareOption{british}{\bool_set_true:N \l_MRTthesis_british_bool}
56
+\DeclareOption{british}{\bool_set_true:N \l_MRTalone_british_bool}
37 57
 \DeclareOption{UKenglish}{\ExecuteOptions{british}}
38 58
 \DeclareOption{english}{\ExecuteOptions{british}}
39
-\DeclareOption{sfacc = height}{\bool_set_true:N \l_MRTthesis_sfacc_height_bool}
40
-\DeclareOption{sfacc = list}{\bool_set_false:N \l_MRTthesis_sfacc_height_bool}
41
-\DeclareOption*{\PassOptionsToClass{\CurrentOption}{standalone}}
59
+%% Additional KV-options >>>
60
+\keys_define:nn { MRTalone / loadtime }%>>>
61
+  {
62
+    sfacc .choice:
63
+    ,sfacc / height .code:n = { \bool_set_true:N \l_MRTalone_sfacc_height_bool}
64
+    ,sfacc / list .code:n = { \bool_set_false:N \l_MRTalone_sfacc_height_bool }
65
+    ,unknown .code:n = { \PassOptionsToClass { \CurrentOption } { standalone } }
66
+  }%<<<
67
+\bool_if:NTF \c_MRTalone_xetex_or_luatex_bool
68
+  {%>>>
69
+    \keys_define:nn { MRTalone / loadtime }
70
+      {
71
+         font       .tl_set:N = \l_MRTalone_font_tl
72
+        ,serif~font .tl_set:N = \l_MRTalone_serif_font_tl
73
+        ,mono~font  .tl_set:N = \l_MRTalone_mono_font_tl
74
+      }
75
+  }%<<<
76
+  {%>>>
77
+    \clist_map_inline:nn { font, serif~font, mono~font }
78
+      {
79
+        \keys_define:nn { MRTalone / loadtime }
80
+          {
81
+            #1 .code:n =
82
+              {
83
+                \msg_error:nnnn { MRTalone } { wrong~engine } { key ~ `#1` }
84
+                  { xetex ~ or ~ luatex }
85
+              }
86
+          }
87
+      }
88
+  }%<<<
89
+%% <<<
90
+\DeclareOption* { \keys_set:nV { MRTalone / loadtime } \CurrentOption }
42 91
 \ExecuteOptions{mathsizes}
43 92
 \PassOptionsToClass{11pt}{standalone}
44 93
 \ProcessOptions\relax
@@ -48,26 +97,40 @@
48 97
 %% additional packages to achieve template formatting >>>
49 98
 %%=============================================================================
50 99
 \RequirePackage{MRTtab,MRTwuline}
51
-\bool_if:nTF { \sys_if_engine_luatex_p: || \sys_if_engine_xetex_p: }
100
+\bool_if:NTF \c_MRTalone_xetex_or_luatex_bool
52 101
   {% true >>>
53
-    \RequirePackage{fontspec}
102
+    \RequirePackage[no-math]{fontspec}
54 103
     \defaultfontfeatures{Ligatures=TeX}
104
+    \tl_if_empty:NTF \l_MRTalone_font_tl
105
+      {
106
+        \msg_new:nnn { MRTalone } { no~font }
107
+          {
108
+            You ~ did ~ not ~ specify ~ any ~ sans ~ font ~ using ~ the ~
109
+            `font` ~ key. ~ I'll ~ use ~ the ~ default ~ font ~ but ~ you ~
110
+            should ~ use ~ a ~ system ~ font ~ looking ~ like ~ Arial ~ or ~
111
+            Helvetica.
112
+          }
113
+        \msg_warning:nn { MRTalone } { no~font }
114
+      }
115
+      { \exp_args:NV \setsansfont \l_MRTalone_font_tl }
116
+    \tl_if_empty:NF \l_MRTalone_serif_font_tl
117
+      { \exp_args:NV \setmainfont \l_MRTalone_serif_font_tl }
118
+    \tl_if_empty:NF \l_MRTalone_mono_font_tl
119
+      { \exp_args:NV \setmonofont \l_MRTalone_mono_font_tl }
55 120
   }% <<<
56 121
   {% false >>>
57 122
     \RequirePackage[T1]{fontenc}
58 123
     \RequirePackage[utf8]{inputenc}
124
+    \RequirePackage{lmodern}
125
+    \RequirePackage{helvet}
59 126
   }%<<<
60
-\RequirePackage{lmodern}
61
-\RequirePackage{helvet}
62 127
 \renewcommand\familydefault{\sfdefault}
63
-\bool_if:NTF \l_MRTthesis_british_bool
128
+\bool_if:NTF \l_MRTalone_british_bool
64 129
   {% true >>>
65 130
     \RequirePackage[main=british,ngerman]{babel}
66
-    \tl_set:Nn \l_MRTthesis_titlepage_von_tl { from }
67 131
   }% <<<
68 132
   {% false >>>
69 133
     \RequirePackage[ngerman]{babel}
70
-    \tl_set:Nn \l_MRTthesis_titlepage_von_tl { von }
71 134
   }% <<<
72 135
 \RequirePackage{setspace}
73 136
 \RequirePackage{enumitem}
@@ -75,7 +138,7 @@
75 138
 % bad math fonts 
76 139
 \RequirePackage[italic,defaultmathsizes]{mathastext}
77 140
 \RequirePackage{isomath}
78
-\bool_if:NTF \l_MRTthesis_sfacc_height_bool
141
+\bool_if:NTF \l_MRTalone_sfacc_height_bool
79 142
   {
80 143
     \RequirePackage[height]{MRTsfacc}
81 144
   }
@@ -83,11 +146,11 @@
83 146
     \RequirePackage[list]{MRTsfacc}
84 147
     \MRTsfaccLoadShiftList{helvet}
85 148
   }
86
-\bool_if:NT \l_MRTthesis_mathsizes_bool%>>>
149
+\bool_if:NT \l_MRTalone_mathsizes_bool%>>>
87 150
   {
88 151
     \DeclareMathSizes{10.95pt}{10.95pt}{9pt}{7pt}
89 152
   }%<<<
90
-\bool_if:NF \l_MRTthesis_minimal_bool%>>>
153
+\bool_if:NF \l_MRTalone_minimal_bool%>>>
91 154
   {
92 155
     \cs_new:Nn \MRTalone_range_phrase:n
93 156
       {
@@ -124,7 +187,7 @@
124 187
     ,stretch~text    .code:n     = { \setstretch { #1 } }
125 188
     ,stretches       .meta:n     =
126 189
       { stretch~cap={#1}, stretch~tab={#1}, stretch~text={#1} }
127
-    ,table~spacing   .bool_set:N = \l_MRTthesis_table_spacing_bool
190
+    ,table~spacing   .bool_set:N = \l_MRTalone_table_spacing_bool
128 191
     ,table~spacing   .default:n  = { true }
129 192
     ,tab~spacing     .meta:n     = { table~spacing={#1} }
130 193
     ,tab~spacing     .default:n  = { true }

+ 88
- 11
MRTbeam/MRTbeam.cls View File

@@ -1,24 +1,100 @@
1
-\newcommand*\MRTbeam@version{0.0.2}
2
-\newcommand*\MRTbeam@date{2018-11-07}
1
+\newcommand*\MRTbeam@version{0.0.3}
2
+\newcommand*\MRTbeam@date{2018-11-08}
3 3
 
4 4
 \NeedsTeXFormat{LaTeX2e}
5 5
 
6
+\RequirePackage{expl3,xparse}
7
+
8
+%% options and class loading >>>
9
+%%=============================================================================
6 10
 \newif\if@MRTbeam@sfacc@height@
7
-\DeclareOption{sfacc = height}{\@MRTbeam@sfacc@height@true}
8
-\DeclareOption{sfacc = list}{\@MRTbeam@sfacc@height@false}
9
-\DeclareOption*{\PassOptionsToClass{\CurrentOption}{beamer}}
11
+\ExplSyntaxOn
12
+\bool_const:Nn \c_MRTbeam_xetex_or_luatex_bool%>>>
13
+  { \sys_if_engine_luatex_p: || \sys_if_engine_xetex_p: }%<<<
14
+\msg_new:nnn { MRTbeam } { wrong~engine }%>>>
15
+  {
16
+    The ~ used ~ #1 ~ is ~ not ~ available ~ under ~ \c_sys_engine_str. ~ You ~
17
+    have ~ to ~ use ~ #2.
18
+  }%<<<
19
+%% Additional KV-options >>>
20
+\keys_define:nn { MRTbeam / loadtime }%>>>
21
+  {
22
+    sfacc .choice:
23
+    ,sfacc / height .code:n = { \@MRTbeam@sfacc@height@true }
24
+    ,sfacc / list   .code:n = { \@MRTbeam@sfacc@height@false }
25
+    ,unknown .code:n = { \PassOptionsToClass { \CurrentOption } { beamer } }
26
+  }%<<<
27
+\bool_if:NTF \c_MRTbeam_xetex_or_luatex_bool
28
+  {%>>>
29
+    \keys_define:nn { MRTbeam / loadtime }
30
+      {
31
+         font       .tl_set:N = \l_MRTbeam_font_tl
32
+        ,serif~font .tl_set:N = \l_MRTbeam_serif_font_tl
33
+        ,mono~font  .tl_set:N = \l_MRTbeam_mono_font_tl
34
+      }
35
+  }%<<<
36
+  {%>>>
37
+    \clist_map_inline:nn { font, serif~font, mono~font }
38
+      {
39
+        \keys_define:nn { MRTbeam / loadtime }
40
+          {
41
+            #1 .code:n =
42
+              {
43
+                \msg_error:nnnn { MRTbeam } { wrong~engine } { key ~ `#1` }
44
+                  { xetex ~ or ~ luatex }
45
+              }
46
+          }
47
+      }
48
+  }%<<<
49
+%% <<<
50
+\DeclareOption* { \keys_set:nV { MRTbeam / loadtime } \CurrentOption }
10 51
 \ProcessOptions\relax
11
-\RequirePackage{helvet,expl3,xparse}
52
+\ExplSyntaxOff
53
+\LoadClass{beamer}
54
+%%==========================================================================<<<
55
+
56
+\ProvidesExplClass
57
+  {MRTbeam}          {\MRTbeam@date}
58
+  {\MRTbeam@version} {beamer template for MRT - University of Bayreuth}
59
+
60
+%% font loading >>>
61
+%%=============================================================================
62
+\ExplSyntaxOn
63
+\bool_if:NTF \c_MRTbeam_xetex_or_luatex_bool
64
+  {% true >>>
65
+    \RequirePackage[no-math]{fontspec}
66
+    \defaultfontfeatures{Ligatures=TeX}
67
+    \tl_if_empty:NTF \l_MRTbeam_font_tl
68
+      {
69
+        \msg_new:nnn { MRTbeam } { no~font }
70
+          {
71
+            You ~ did ~ not ~ specify ~ any ~ sans ~ font ~ using ~ the ~
72
+            `font` ~ key. ~ I'll ~ use ~ the ~ default ~ font ~ but ~ you ~
73
+            should ~ use ~ a ~ system ~ font ~ looking ~ like ~ Arial ~ or ~
74
+            Helvetica.
75
+          }
76
+        \msg_warning:nn { MRTbeam } { no~font }
77
+      }
78
+      { \exp_args:NV \setsansfont \l_MRTbeam_font_tl }
79
+    \tl_if_empty:NF \l_MRTbeam_serif_font_tl
80
+      { \exp_args:NV \setmainfont \l_MRTbeam_serif_font_tl }
81
+    \tl_if_empty:NF \l_MRTbeam_mono_font_tl
82
+      { \exp_args:NV \setmonofont \l_MRTbeam_mono_font_tl }
83
+  }% <<<
84
+  {% false >>>
85
+    \RequirePackage[T1]{fontenc}
86
+    \RequirePackage[utf8]{inputenc}
87
+    \RequirePackage{lmodern}
88
+    \RequirePackage{helvet}
89
+  }%<<<
12 90
 \if@MRTbeam@sfacc@height@
13 91
   \RequirePackage[height]{MRTsfacc}
14 92
 \else
15 93
   \RequirePackage[list]{MRTsfacc}
16 94
   \MRTsfaccLoadShiftList{helvet}
17 95
 \fi
18
-\LoadClass{beamer}
19
-\ProvidesExplClass
20
-  {MRTbeam}          {\MRTbeam@date}
21
-  {\MRTbeam@version} {beamer template for MRT - University of Bayreuth}
96
+\ExplSyntaxOff
97
+%%==========================================================================<<<
22 98
 
23 99
 \usetheme{MRTbeam}
24 100
 
@@ -32,9 +108,10 @@
32 108
         { spratte } { \SetProgressBar{c}{\paperwidth}{2pt}{3pt} }
33 109
       }
34 110
       {
35
-        \ClassError{MRTbeam}{The~style~'#1'~is~unknown.}{}
111
+        \ClassError{MRTbeam}{The~style~'\exp_not:n { #1 }'~is~unknown.}{}
36 112
       }
37 113
   }% <<<
114
+
38 115
 \ExplSyntaxOff
39 116
 
40 117
 \endinput

+ 83
- 23
MRTthesis/MRTthesis.cls View File

@@ -1,5 +1,5 @@
1
-\newcommand*\MRTthesis@version{0.0.5}
2
-\newcommand*\MRTthesis@date{2018-11-07}
1
+\newcommand*\MRTthesis@version{0.0.6}
2
+\newcommand*\MRTthesis@date{2018-11-08}
3 3
 
4 4
 \NeedsTeXFormat{LaTeX2e}
5 5
 
@@ -8,6 +8,10 @@
8 8
   {MRTthesis}          {\MRTthesis@date}
9 9
   {\MRTthesis@version} {thesis template for MRT - University of Bayreuth}
10 10
 
11
+%% variants of external macros >>>
12
+%%=============================================================================
13
+\cs_generate_variant:Nn \keys_set:nn { nV }
14
+%%==========================================================================<<<
11 15
 
12 16
 %% variables >>>
13 17
 %%=============================================================================
@@ -60,6 +64,32 @@
60 64
 % <<<
61 65
 %%==========================================================================<<<
62 66
 
67
+%% messages >>>
68
+%%=============================================================================
69
+\msg_new:nnnn { MRTthesis } { afterafterhyperref }%>>>
70
+  {
71
+    \exp_not:N \MRTafterhyperref
72
+    ~used~too~late.~It~has~to~be~used~before~\exp_not:N \begin \{document\}.
73
+  }
74
+  { Seriously,~which~information~do~you~miss~from~the~above? }%<<<
75
+\msg_new:nnn { MRTthesis } { degree~undefined }%>>>
76
+  {
77
+    The~degree~option~wasn't~used~and~guessing~the~degree~from~the~thesis~type~
78
+    failed.
79
+  }%<<<
80
+\msg_new:nnn { MRTthesis } { wrong~engine }%>>>
81
+  {
82
+    The ~ used ~ #1 ~ is ~ not ~ available ~ under ~ \c_sys_engine_str. ~ You ~
83
+    have ~ to ~ use ~ #2.
84
+  }%<<<
85
+%%==========================================================================<<<
86
+
87
+%% constants >>>
88
+%%=============================================================================
89
+\bool_const:Nn \c_MRTthesis_xetex_or_luatex_bool
90
+  { \sys_if_engine_luatex_p: || \sys_if_engine_xetex_p: }
91
+%%==========================================================================<<<
92
+
63 93
 %% Class options and loading scrreprt >>>
64 94
 %%=============================================================================
65 95
 \DeclareOption{longtable}
@@ -78,9 +108,38 @@
78 108
 \DeclareOption{english}{\ExecuteOptions{british}}
79 109
 \DeclareOption{hidelinks}{\bool_set_true:N  \l_MRTthesis_hyper_hidelinks_bool}
80 110
 \DeclareOption{showlinks}{\bool_set_false:N \l_MRTthesis_hyper_hidelinks_bool}
81
-\DeclareOption{sfacc = height}{\bool_set_true:N \l_MRTthesis_sfacc_height_bool}
82
-\DeclareOption{sfacc = list}{\bool_set_false:N \l_MRTthesis_sfacc_height_bool}
83
-\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrreprt}}
111
+%% Additional KV-options >>>
112
+\keys_define:nn { MRTthesis / loadtime }%>>>
113
+  {
114
+    sfacc .choice:
115
+    ,sfacc / height .code:n = { \bool_set_true:N \l_MRTthesis_sfacc_height_bool}
116
+    ,sfacc / list .code:n = { \bool_set_false:N \l_MRTthesis_sfacc_height_bool }
117
+    ,unknown .code:n = { \PassOptionsToClass { \CurrentOption } { scrreprt } }
118
+  }%<<<
119
+\bool_if:NTF \c_MRTthesis_xetex_or_luatex_bool
120
+  {%>>>
121
+    \keys_define:nn { MRTthesis / loadtime }
122
+      {
123
+         font       .tl_set:N = \l_MRTthesis_font_tl
124
+        ,serif~font .tl_set:N = \l_MRTthesis_serif_font_tl
125
+        ,mono~font  .tl_set:N = \l_MRTthesis_mono_font_tl
126
+      }
127
+  }%<<<
128
+  {%>>>
129
+    \clist_map_inline:nn { font, serif~font, mono~font }
130
+      {
131
+        \keys_define:nn { MRTthesis / loadtime }
132
+          {
133
+            #1 .code:n =
134
+              {
135
+                \msg_error:nnnn { MRTthesis } { wrong~engine } { key ~ `#1` }
136
+                  { xetex ~ or ~ luatex }
137
+              }
138
+          }
139
+      }
140
+  }%<<<
141
+%% <<<
142
+\DeclareOption* { \keys_set:nV { MRTthesis / loadtime } \CurrentOption }
84 143
 \ExecuteOptions{mathsizes}
85 144
 \ExecuteOptions{hidelinks}
86 145
 \PassOptionsToClass
@@ -93,17 +152,33 @@
93 152
 %% additional packages to achieve template formatting >>>
94 153
 %%=============================================================================
95 154
 \RequirePackage{MRTtab,MRTwuline}
96
-\bool_if:nTF { \sys_if_engine_luatex_p: || \sys_if_engine_xetex_p: }
155
+\bool_if:NTF \c_MRTthesis_xetex_or_luatex_bool
97 156
   {% true >>>
98 157
     \RequirePackage[no-math]{fontspec}
99 158
     \defaultfontfeatures{Ligatures=TeX}
159
+    \tl_if_empty:NTF \l_MRTthesis_font_tl
160
+      {
161
+        \msg_new:nnn { MRTthesis } { no~font }
162
+          {
163
+            You ~ did ~ not ~ specify ~ any ~ sans ~ font ~ using ~ the ~
164
+            `font` ~ key. ~ I'll ~ use ~ the ~ default ~ font ~ but ~ you ~
165
+            should ~ use ~ a ~ system ~ font ~ looking ~ like ~ Arial ~ or ~
166
+            Helvetica.
167
+          }
168
+        \msg_warning:nn { MRTthesis } { no~font }
169
+      }
170
+      { \exp_args:NV \setsansfont \l_MRTthesis_font_tl }
171
+    \tl_if_empty:NF \l_MRTthesis_serif_font_tl
172
+      { \exp_args:NV \setmainfont \l_MRTthesis_serif_font_tl }
173
+    \tl_if_empty:NF \l_MRTthesis_mono_font_tl
174
+      { \exp_args:NV \setmonofont \l_MRTthesis_mono_font_tl }
100 175
   }% <<<
101 176
   {% false >>>
102 177
     \RequirePackage[T1]{fontenc}
103 178
     \RequirePackage[utf8]{inputenc}
179
+    \RequirePackage{lmodern}
180
+    \RequirePackage{helvet}
104 181
   }%<<<
105
-\RequirePackage{lmodern}
106
-\RequirePackage{helvet}
107 182
 \renewcommand\familydefault{\sfdefault}
108 183
 \bool_if:NTF \l_MRTthesis_british_bool
109 184
   {% true >>>
@@ -358,21 +433,6 @@
358 433
 % <<<
359 434
 %%==========================================================================<<<
360 435
 
361
-%% messages >>>
362
-%%=============================================================================
363
-\msg_new:nnnn { MRTthesis } { afterafterhyperref }%>>>
364
-  {
365
-    \exp_not:N \MRTafterhyperref
366
-    ~used~too~late.~It~has~to~be~used~before~\exp_not:N \begin \{document\}.
367
-  }
368
-  { Seriously,~which~information~do~you~miss~from~the~above? }%<<<
369
-\msg_new:nnn { MRTthesis } { degree~undefined }%>>>
370
-  {
371
-    The~degree~option~wasn't~used~and~guessing~the~degree~from~the~thesis~type~
372
-    failed.
373
-  }%<<<
374
-%%==========================================================================<<<
375
-
376 436
 %% macros >>>
377 437
 %%=============================================================================
378 438
 % auxiliary like>>>

Loading…
Cancel
Save