Debian Codegraph @

texmf-dist/doc/latex/mitthesis/examples/design_examples/latex_sources/mydesign_libertinus_headings.tex

raw
1 % !TEX TS-program = LuaLaTeX
2 % From mitthesis package
3 % Documentation: https://ctan.org/pkg/mitthesis
4
5 \ProvidesFile{mydesign_libertinus_headings.tex}[2026/01/27 v1.01]
6
7 % ==> you can change this however you want. The content below is just for illustration. <==
8
9 % This illustration assumes that the fontset=libertinus is selected under >> lualatex <<.
10 % Chapter and section headings are use additional font features (historical ligatures and stylistic alternates)
11 % Caption labels are set in a boldface font.
12 %
13 % To avoid distracting typographic design, you may want to limit the additional font features to the chapter headings only.
14 %
15 % See: https://github.com/alerque/libertinus/blob/a6487570b8fdcfa69557744f5e5c5d044de0a9db/documentation/Opentype-Features.pdf
16
17
18 %%%%%%%%% Issue error if running pdftex %%%%%%%%%%%%%%%%%%%
19
20 % Expl Syntax are already on at this point in mitthesis.cls
21 \sys_if_engine_pdftex:T
22 {
23 \msg_new:nnn { \ClassName } { wrong_engine } { Run~lualatex,~not~pdftex,\iow_newline: with~mydesign_libertinus_headings!}
24 \msg_error:nn { \ClassName } { wrong_engine }
25 }
26 % Note: when expl syntax are in effect, spaces are ignored (if you need text use ~ separator as above.)
27
28
29 %%%%%%%%%% Color support %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
30
31 %% Color package: xcolor.
32 %% Change this if you prefer something else
33
34 \usepackage[dvipsnames,svgnames,x11names]{xcolor}
35
36 %% can add option [table] to xcolor to use color in tables (see xcolor documentation)
37
38
39 %%%%%%%%%% Hyperlink and line number colors %%%%%%%%%%%%%%
40
41 \AtBeginDocument{
42 % Using color names from xcolor package
43 \hypersetup{
44 linkcolor=Blue3,
45 citecolor=Blue3,
46 urlcolor=violet,
47 filecolor=red,
48 % anchorcolor=yellow,% not all pdf viewers recognize this field (although Firefox does): hyperref issues a warning, which can be ignored
49 }
50 %
51 \ifmit@lineno
52 \renewcommand{\linenumberfont}{\sffamily\mdseries\tiny\color{violet}}% line numbers will be sans-serif, medium weight, tiny, and violet
53 \fi
54 }
55
56 %%%%%%%%% Caption support %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 %
58 \IfFormatAtLeastTF{2025/11/01}
59 {
60 %% If your latex format is at least 2025/11/01, you should use this approach:
61 \NewSocketPlug{caption/label}{plug-A}{{\textbf{ #1}\quad}} % This strictly addresses the caption label, not caption text.
62 \AssignSocketPlug{caption/label}{plug-A}
63 %
64 % \AddToHook{cmd/@makecaption/before}{\relax} % Contents of second argument would style the entire caption, but label socket above can override it in the label.
65 %
66 % These commands make caption label bold, with a space of one quad separating label from text; the hook command is empty.
67 }{
68 %% For older formats, use the following. See documentation of caption package for details.
69 \RequirePackage{caption}
70 %% This sets caption labels in bold face type.
71 \DeclareCaptionLabelFormat{boldlabel}{\textbf{{#1\ #2}}}
72 \captionsetup[figure]{labelformat=boldlabel,labelsep=quad}% change to boldface label with separation of one \quad
73 \captionsetup[table]{labelformat=boldlabel,labelsep=quad} % change to boldface label with separation of one \quad
74 }
75
76 %%%%%%%%% Customize titles and section headings %%%%%%%%%%
77
78 \ifpdftex\providecommand*{\addfontfeatures}[1]{\relax}\fi
79
80 %% This forces the fontset to libertinus.
81 % Expl Syntax are already on at this point in mitthesis.cls
82 \str_if_eq:VnF \mit@fontset {libertinus}
83 {
84 \str_gset:Nn \mit@fontset {libertinus}
85 }
86 % Expl Syntax are on at this point in mitthesis.cls. Don't turn them off!!
87
88 %% See: https://github.com/alerque/libertinus/blob/a6487570b8fdcfa69557744f5e5c5d044de0a9db/documentation/Opentype-Features.pdf
89
90 %% Adds some font features to numbered chapter heading: special versions of J, K, R (ss02); two "historical" ligatures (hlig); stylistic alternate characters (salt).
91 \patchcmd{\@makechapterhead}{\Huge}{\addfontfeatures{RawFeature={+hlig,+ss02,+salt}}\Huge}{}{}
92 \patchcmd{\@makechapterhead}{\huge}{\addfontfeatures{RawFeature={+hlig,+ss02,+salt}}\huge}{}{}
93
94 %% Adds some font features to UNnumbered chapter names: special versions of J, K, R (ss02); two "historical" ligatures (hlig); stylistic alternate characters (salt).
95 \patchcmd{\@makeschapterhead}{\Huge}{\addfontfeatures{RawFeature={+hlig,+ss02,+salt}}\Huge}{}{}
96
97
98 % To directly modify section headings as follows, see https://latexref.xyz/dev/latex2e.html#g_t_005c_0040startsection
99 % This adds the same fontfeatures section, subsection, and subsubsection headings (compare to report.cls)
100 % Note - libertinus-math has bold characters, but not a boldface math font (so don't use \mathversion{bold})
101 \renewcommand\section{\@startsection {section}{1}{\z@}%
102 {-3.5ex \@plus -1ex \@minus -.2ex}%
103 {2.3ex \@plus.2ex}%
104 {\addfontfeatures{RawFeature={+hlig,+ss02,+salt}}\Large\bfseries\raggedright}}
105 \renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
106 {-3.25ex\@plus -1ex \@minus -.2ex}%
107 {1.5ex \@plus .2ex}%
108 {\addfontfeatures{RawFeature={+hlig,+ss02,+salt}}\large\bfseries\raggedright}}
109 \renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
110 {-3.25ex\@plus -1ex \@minus -.2ex}%
111 {1.5ex \@plus .2ex}%
112 {\addfontfeatures{RawFeature={+hlig,+ss02,+salt}}\normalsize\bfseries}}
113
114
115 %%%%%%%%% Change page margins %%%%%%%%%%%%%%%%%%%%%%%%%%%%
116 %
117 % The default thesis margin is 1 inch all around. You may want different margins (e.g., to add a gutter for binding),
118 % in which case you can use the \newgeometry command from the geometry package. Refer to the package documentation
119 % for details.
120 %
121 % mitthesis defaults: [top=1in,bottom=1in,left=1in,right=1in,marginparwidth=50pt,headsep=12pt,footskip=0.5in]
122 %
123 % The following tells the geometry package to use a two-sided layout with a 1 cm binding offset on the inside
124 % and 1 inch margins all around, reducing textwidth slightly (by 0.7 cm). See geometry documentation, Section 8.2.
125 %
126 %\newgeometry{twoside, bindingoffset=1cm,margin=1in,marginparwidth=50pt,headsep=12pt,footskip=0.5in}