You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MRTalone.cls 8.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. \newcommand*\MRTalone@version{0.0.3}
  2. \newcommand*\MRTalone@date{2018-11-08}
  3. \NeedsTeXFormat{LaTeX2e}
  4. \RequirePackage{expl3,xparse}
  5. \ProvidesExplClass
  6. {MRTalone} {\MRTalone@date}
  7. {\MRTalone@version} {standalone matching MRTthesis}
  8. %% variants of external macros >>>
  9. %%=============================================================================
  10. \cs_generate_variant:Nn \keys_set:nn { nV }
  11. %%==========================================================================<<<
  12. %% variables >>>
  13. %%=============================================================================
  14. % l3 variables >>>
  15. % bool >>>
  16. \bool_new:N \l_MRTalone_minimal_bool
  17. \bool_new:N \l_MRTalone_mathsizes_bool
  18. \bool_new:N \l_MRTalone_british_bool
  19. \bool_new:N \l_MRTalone_sfacc_height_bool
  20. % <<<
  21. % <<<
  22. %%==========================================================================<<<
  23. %% constants >>>
  24. %%=============================================================================
  25. \bool_const:Nn \c_MRTalone_xetex_or_luatex_bool
  26. { \sys_if_engine_luatex_p: || \sys_if_engine_xetex_p: }
  27. %%==========================================================================<<<
  28. %% messages >>>
  29. %%=============================================================================
  30. \msg_new:nnn { MRTalone } { wrong~engine }%>>>
  31. {
  32. The ~ used ~ #1 ~ is ~ not ~ available ~ under ~ \c_sys_engine_str. ~ You ~
  33. have ~ to ~ use ~ #2.
  34. }%<<<
  35. %%==========================================================================<<<
  36. \NewDocumentCommand \MRTaloneSetup { +m }%>>>
  37. {
  38. \keys_set:nn { MRTalone/setup } { #1 }
  39. }%<<<
  40. %% Class options and loading standalone >>>
  41. %%=============================================================================
  42. \DeclareOption{longtable}{\PassOptionsToPackage{longtable}{MRTtab}}
  43. \DeclareOption{mathsizes}{\bool_set_true:N \l_MRTalone_mathsizes_bool}
  44. \DeclareOption{minimal}{\bool_set_true:N \l_MRTalone_minimal_bool}
  45. \DeclareOption{no mathsizes}{\bool_set_false:N \l_MRTalone_mathsizes_bool}
  46. \DeclareOption{tikzunderline}{\PassOptionsToPackage{tUline}{MRTwuline}}
  47. \DeclareOption{tUline}{\ExecuteOptions{tikzunderline}}
  48. \DeclareOption{british}{\bool_set_true:N \l_MRTalone_british_bool}
  49. \DeclareOption{UKenglish}{\ExecuteOptions{british}}
  50. \DeclareOption{english}{\ExecuteOptions{british}}
  51. %% Additional KV-options >>>
  52. \keys_define:nn { MRTalone / loadtime }%>>>
  53. {
  54. sfacc .choice:
  55. ,sfacc / height .code:n = { \bool_set_true:N \l_MRTalone_sfacc_height_bool}
  56. ,sfacc / list .code:n = { \bool_set_false:N \l_MRTalone_sfacc_height_bool }
  57. ,unknown .code:n = { \PassOptionsToClass { \CurrentOption } { standalone } }
  58. }%<<<
  59. \bool_if:NTF \c_MRTalone_xetex_or_luatex_bool
  60. {%>>>
  61. \keys_define:nn { MRTalone / loadtime }
  62. {
  63. font .tl_set:N = \l_MRTalone_font_tl
  64. ,serif~font .tl_set:N = \l_MRTalone_serif_font_tl
  65. ,mono~font .tl_set:N = \l_MRTalone_mono_font_tl
  66. }
  67. }%<<<
  68. {%>>>
  69. \clist_map_inline:nn { font, serif~font, mono~font }
  70. {
  71. \keys_define:nn { MRTalone / loadtime }
  72. {
  73. #1 .code:n =
  74. {
  75. \msg_error:nnnn { MRTalone } { wrong~engine } { key ~ `#1` }
  76. { xetex ~ or ~ luatex }
  77. }
  78. }
  79. }
  80. }%<<<
  81. %% <<<
  82. \DeclareOption* { \keys_set:nV { MRTalone / loadtime } \CurrentOption }
  83. \ExecuteOptions{mathsizes}
  84. \PassOptionsToClass{11pt}{standalone}
  85. \ProcessOptions\relax
  86. \LoadClass{standalone}
  87. %%==========================================================================<<<
  88. %% additional packages to achieve template formatting >>>
  89. %%=============================================================================
  90. \RequirePackage{MRTtab,MRTwuline}
  91. \bool_if:NTF \c_MRTalone_xetex_or_luatex_bool
  92. {% true >>>
  93. \RequirePackage[no-math]{fontspec}
  94. \defaultfontfeatures{Ligatures=TeX}
  95. \tl_if_empty:NTF \l_MRTalone_font_tl
  96. {
  97. \msg_new:nnn { MRTalone } { no~font }
  98. {
  99. You ~ did ~ not ~ specify ~ any ~ sans ~ font ~ using ~ the ~
  100. `font` ~ key. ~ I'll ~ use ~ the ~ default ~ font ~ but ~ you ~
  101. should ~ use ~ a ~ system ~ font ~ looking ~ like ~ Arial ~ or ~
  102. Helvetica.
  103. }
  104. \msg_warning:nn { MRTalone } { no~font }
  105. }
  106. { \exp_args:NV \setsansfont \l_MRTalone_font_tl }
  107. \tl_if_empty:NF \l_MRTalone_serif_font_tl
  108. { \exp_args:NV \setmainfont \l_MRTalone_serif_font_tl }
  109. \tl_if_empty:NF \l_MRTalone_mono_font_tl
  110. { \exp_args:NV \setmonofont \l_MRTalone_mono_font_tl }
  111. }% <<<
  112. {% false >>>
  113. \RequirePackage[T1]{fontenc}
  114. \RequirePackage[utf8]{inputenc}
  115. \RequirePackage{lmodern}
  116. \RequirePackage{helvet}
  117. }%<<<
  118. \renewcommand\familydefault{\sfdefault}
  119. \bool_if:NTF \l_MRTalone_british_bool
  120. {% true >>>
  121. \RequirePackage[main=british,ngerman]{babel}
  122. }% <<<
  123. {% false >>>
  124. \RequirePackage[ngerman]{babel}
  125. }% <<<
  126. \RequirePackage{setspace}
  127. \RequirePackage{enumitem}
  128. \RequirePackage[fleqn]{mathtools}
  129. % bad math fonts
  130. \RequirePackage[italic,defaultmathsizes]{mathastext}
  131. \RequirePackage{isomath}
  132. \bool_if:NTF \l_MRTalone_sfacc_height_bool
  133. {
  134. \RequirePackage[height]{MRTsfacc}
  135. }
  136. {
  137. \RequirePackage[list]{MRTsfacc}
  138. \MRTsfaccLoadShiftList{helvet}
  139. }
  140. \bool_if:NT \l_MRTalone_mathsizes_bool%>>>
  141. {
  142. \DeclareMathSizes{10.95pt}{10.95pt}{9pt}{7pt}
  143. }%<<<
  144. \bool_if:NF \l_MRTalone_minimal_bool%>>>
  145. {
  146. \cs_new:Nn \MRTalone_range_phrase:n
  147. {
  148. \mode_if_math:TF { \text { ~#1~ } } { ~#1~ }
  149. }
  150. \RequirePackage{siunitx}
  151. \sisetup{% set options of the siunitx package
  152. ,detect-all%
  153. ,per-mode=reciprocal-positive-first%
  154. }%
  155. \addto\extrasngerman
  156. { \sisetup{ locale=DE, range-phrase=\MRTalone_range_phrase:n { bis } } }
  157. \addto\extrasbritish
  158. { \sisetup{ locale=UK, range-phrase=\MRTalone_range_phrase:n { to } } }
  159. }%<<<
  160. %%==========================================================================<<<
  161. %% setup options >>>
  162. %%=============================================================================
  163. \keys_define:nn { MRTalone/setup }% >>>
  164. {
  165. ,caption~above .code:n = { \MRTtabSetup { caption~above } }
  166. ,caption~above .value_forbidden:n = true
  167. ,caption~below .code:n = { \MRTtabSetup { caption~below } }
  168. ,caption~below .value_forbidden:n = true
  169. ,stretch~caption .code:n = {}
  170. %{% >>>
  171. %\setkomafont { caption } { \setstretch { #1 } \normalfont }
  172. %\setkomafont { captionlabel } { \setstretch { #1 } \normalfont }
  173. %}% <<<
  174. ,stretch~cap .meta:n = { stretch~caption={#1} }
  175. ,stretch~tabular .code:n = { \MRTtabSetup { stretch~tab={#1} } }
  176. ,stretch~tab .meta:n = { stretch~tabular={#1} }
  177. ,stretch~text .code:n = { \setstretch { #1 } }
  178. ,stretches .meta:n =
  179. { stretch~cap={#1}, stretch~tab={#1}, stretch~text={#1} }
  180. ,table~spacing .bool_set:N = \l_MRTalone_table_spacing_bool
  181. ,table~spacing .default:n = { true }
  182. ,tab~spacing .meta:n = { table~spacing={#1} }
  183. ,tab~spacing .default:n = { true }
  184. }% <<<
  185. % defaults >>>
  186. \keys_set:nn { MRTalone/setup }% >>>
  187. {
  188. ,caption~below
  189. ,stretches = 1.408
  190. ,tab~spacing
  191. }% <<<
  192. % <<<
  193. %%==========================================================================<<<
  194. %% lengths >>>
  195. %%=============================================================================
  196. \setlength{\arrayrulewidth}{0.6pt}
  197. \setlength{\parindent}{13pt} % default 15pt
  198. \setlength{\parskip}{6pt plus 6pt minus 1pt}
  199. \setlength{\mathindent}{10.45mm}
  200. \AtBeginDocument
  201. {
  202. \setlength{\abovedisplayskip}{4.2pt plus .2pt minus .1pt}
  203. \setlength{\belowdisplayskip}{4.2pt plus .2pt minus .1pt}
  204. \setlength{\abovedisplayshortskip}{4.2pt plus .2pt minus .1pt}
  205. \setlength{\belowdisplayshortskip}{4.2pt plus .2pt minus .1pt}
  206. }
  207. \setlist[itemize]{itemsep=-0pt, parsep=2pt plus .2pt minus .1pt}
  208. \setlist[enumerate]{itemsep=-0pt, parsep=2pt plus .2pt minus .1pt}
  209. %%==========================================================================<<<
  210. % Setting up MRTtab to work in standalone by default
  211. \MRTtabSetup{in~text~sep=\c_zero_skip,no~float}