Skip to content

Commit ccc942c

Browse files
committed
perf(all): use more primitive command definitions
When possible, use more primitive command definitions using \newcommand and friends, instead of \NewDocumentCommand and friends. Provides a small performance improvement. Signed-off-by: Jonas Dujava <[email protected]>
1 parent 8819911 commit ccc942c

21 files changed

Lines changed: 81 additions & 81 deletions

File tree

frontmatter/title.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
\vspace{1em}
2222

2323
%% if `\ThesisTitleFront` is not defined, use `\ThesisTitle`
24-
\ProvideExpandableDocumentCommand{\ThesisTitleFront}{}{\ThesisTitle}
24+
\providecommand*{\ThesisTitleFront}{\ThesisTitle}
2525
% {\Huge \bfseries \ThesisTitleFront \par}
2626
{\fontsize{30pt}{36pt}\selectfont \bfseries
2727
\ThesisTitleFront \par}

preamble/data.tex

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,63 @@
11
%% Thesis type: bachelor, master, doctoral
2-
\NewExpandableDocumentCommand{\ThesisType}{}{master}
2+
\newcommand*{\ThesisType}{master}
33

44
%% Thesis title (exactly as in the formal assignment)
5-
\NewExpandableDocumentCommand{\ThesisTitle}{}{\TeXtured{} Manual}
5+
\newcommand*{\ThesisTitle}{\TeXtured{} Manual}
66
%% Plaintext version for PDF metadata, uncomment if needed (defauls to \ThesisTitle)
7-
\NewExpandableDocumentCommand{\ThesisTitlePlaintext}{}{TeXtured Manual \TeXturedVERSION}
7+
\newcommand*{\ThesisTitlePlaintext}{TeXtured Manual \TeXturedVERSION}
88
%% Thesis title (if custom formatting is needed for the title page, defauls to \ThesisTitle)
9-
\NewExpandableDocumentCommand{\ThesisTitleFront}{}{
9+
\newcommand*{\ThesisTitleFront}{
1010
\ThesisTitle\\
1111
{\Huge\color{gray}\TeXturedVERSION}
1212
}
1313

1414
%% Author of the thesis
15-
\NewExpandableDocumentCommand{\ThesisAuthor}{}{\textcolor{red}{Author's Name}}
15+
\newcommand*{\ThesisAuthor}{\textcolor{red}{Author's Name}}
1616
%% Plaintext version for PDF metadata, uncomment if needed (defauls to \ThesisAuthor)
17-
\NewExpandableDocumentCommand{\ThesisAuthorPlaintext}{}{Author's Name}
17+
\newcommand*{\ThesisAuthorPlaintext}{Author's Name}
1818

1919
%% Year when the thesis is submitted
20-
\NewDocumentCommand{\YearSubmitted}{}{2025}
20+
\newcommand*{\YearSubmitted}{2025}
2121
%% Year of the last revision, uncomment if it is different from \YearSubmitted
22-
% \NewDocumentCommand{\YearRevision}{}{2025}
22+
% \newcommand*{\YearRevision}{2025}
2323

2424
%% University
25-
\NewDocumentCommand{\University}{}{Charles University}
25+
\newcommand*{\University}{Charles University}
2626

2727
%% Name of the department or institute, where the work was officially assigned
2828
%% (according to the Organizational Structure of MFF UK in English,
2929
%% or a full name of a department outside MFF)
30-
\NewDocumentCommand{\Department}{}{\textcolor{red}{Name of the Department/Institute}}
30+
\newcommand*{\Department}{\textcolor{red}{Name of the Department/Institute}}
3131

3232
%% Is it a Department (katedra), or an Institute (ústav)?
33-
\NewDocumentCommand{\DeptType}{}{Institute}
33+
\newcommand*{\DeptType}{Institute}
3434

3535
%% Thesis supervisor: name, surname and titles
36-
\NewDocumentCommand{\Supervisor}{}{\textcolor{red}{Name, Surname, and Titles}}
36+
\newcommand*{\Supervisor}{\textcolor{red}{Name, Surname, and Titles}}
3737
%% Thesis co-supervisor: name, surname and titles (uncomment if applicable)
38-
% \NewDocumentCommand{\CoSupervisor}{}{Name, Surname, and Titles}
38+
% \newcommand*{\CoSupervisor}{Name, Surname, and Titles}
3939

4040
%% Supervisor's department/institute (again according to Organizational structure of MFF)
41-
\NewDocumentCommand{\SupervisorsDepartment}{}{\textcolor{red}{Supervisor's Department/Institute}}
41+
\newcommand*{\SupervisorsDepartment}{\textcolor{red}{Supervisor's Department/Institute}}
4242

4343
%% Study programme and specialization
44-
\NewDocumentCommand{\StudyProgramme}{}{\textcolor{red}{Study Programme}}
44+
\newcommand*{\StudyProgramme}{\textcolor{red}{Study Programme}}
4545

4646
%% Abstract (recommended length around 80-200 words; this is not a copy of your thesis assignment!)
47-
\NewDocumentCommand{\Abstract}{}{%
47+
\newcommand*{\Abstract}{%
4848
\textcolor{red}{Write abstract here.}
4949
}
5050

5151
%% Subject (short description for PDF metadata)
52-
\NewExpandableDocumentCommand{\Subject}{}{%
52+
\newcommand*{\Subject}{%
5353
Write subject here.
5454
}
5555

5656
%% Keywords (about 3-7)
57-
\NewExpandableDocumentCommand{\Keywords}{}{%
57+
\newcommand*{\Keywords}{%
5858
\textcolor{red}{Manual, Demo, Draft, WIP}
5959
}
6060
%% Plaintext version for PDF metadata, uncomment if needed (defauls to \Keywords)
61-
\NewExpandableDocumentCommand{\KeywordsPlaintext}{}{%
61+
\newcommand*{\KeywordsPlaintext}{%
6262
Manual, Demo, Draft, WIP
6363
}

preamble/environments/init.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
\IfBooleanT{#1}{\def\qedshift{1.5ex}}% if starred, set shift corresponding to big operators (\sum, ...)
3838
\IfValueT{#2}{\def\qedshift{#2}}% % if optional argument is passed, set shift to the custom value
3939
\NewCommandCopy{\oldqed}{\qedsymbol}%
40-
\RenewDocumentCommand{\qedsymbol}{}{\raisebox{-\qedshift}{\oldqed}}%
40+
\renewcommand*{\qedsymbol}{\raisebox{-\qedshift}{\oldqed}}%
4141
\oldqedhere%
4242
}
4343

preamble/environments/remark-like.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
%% `\strut` to ensure consistent height of the final line
33
%% `\hspace{-0.9em}` to enable longer last line in remark-like environments,
44
%% otherwise the line is breaking earlier then necesarry
5-
\NewDocumentCommand{\remarkqed}{}{\hspace{-0.9em}\textcolor{black!60}{\(\lrcorner\)}\strut}
5+
\newcommand*{\remarkqed}{\hspace{-0.9em}\textcolor{black!60}{\(\lrcorner\)}\strut}
66

77
%% Factory for new remark-like environments
88
\NewDocumentCommand{\NewRemarkLike}{O{qed=\remarkqed} m}{
@@ -39,7 +39,7 @@
3939
%% Proof QED symbol
4040
%% `\hspace{-1em}` to enable longer last line in the proof environment,
4141
%% otherwise the line is breaking earlier then necesarry
42-
\NewDocumentCommand{\proofqed}{}{
42+
\newcommand*{\proofqed}{
4343
\color{black!60}% lighter color for the smaller square QED symbol
4444
\hspace{-1em}\raisebox{-0.01em}{\(\square[0.4em][aligntableaux=bottom]\mspace{1mu}\)}% tweak positioning
4545
\strut% ensure consistent height of the final line

preamble/environments/theorem-like.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
%% Ensure consistent height of the final line with `\strut`
22
%% `\hspace{-1.␣␣em}` to enable longer last line in theorem-like environments,
33
%% otherwise the line is breaking earlier then necesarry
4-
\NewDocumentCommand{\theoremqed}{}{\hspace{-1.195em}\strut}
4+
\newcommand*{\theoremqed}{\hspace{-1.195em}\strut}
55

66
%% Factory for new theorem-like environments
77
\NewDocumentCommand{\NewTheoremLike}{O{qed=\theoremqed} m}{

preamble/general/floats.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
\ExplSyntaxOn
1818
\NewDocumentCommand{\appendtographicspath}{m}{
1919
\tl_if_exist:cF { Ginput@path } { \tl_new:c { Ginput@path } }
20-
\tl_gput_right:cn {Ginput@path} { #1 }
20+
\tl_gput_right:cn { Ginput@path } { #1 }
2121
}
2222
\ExplSyntaxOff
2323

preamble/general/hyperref.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
}
1212

1313
%% Fallbacks for PDF metadata commands
14-
\ProvideExpandableDocumentCommand{\ThesisAuthorPlaintext}{}{\ThesisAuthor}
15-
\ProvideExpandableDocumentCommand{\ThesisTitlePlaintext}{}{\ThesisTitle}
16-
\ProvideExpandableDocumentCommand{\KeywordsPlaintext}{}{\Keywords}
14+
\providecommand*{\ThesisAuthorPlaintext}{\ThesisAuthor}
15+
\providecommand*{\ThesisTitlePlaintext}{\ThesisTitle}
16+
\providecommand*{\KeywordsPlaintext}{\Keywords}
1717

1818
\hypersetup{
1919
linktoc = all, % whole entry in TOC is clickable link

preamble/general/typesetting.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
%% - `sbc` - sans bold condensed
1414
%% - `sfe` - sans serif extended (font family `lmssq` for "Latin Modern Sans Serif Quotation")
1515
%% https://www.tug.org/pracjourn/2006-1/robertson/robertson.pdf
16-
\NewDocumentCommand{\sbcseries}{}{\sffamily\fontseries{sbc}\selectfont}
17-
\NewDocumentCommand{\sfefamily}{}{\fontfamily{lmssq}\selectfont}
16+
\newcommand*{\sbcseries}{\sffamily\fontseries{sbc}\selectfont}
17+
\newcommand*{\sfefamily}{\fontfamily{lmssq}\selectfont}
1818
\DeclareTextFontCommand{\textsbc}{\sbcseries}
1919
\DeclareTextFontCommand{\textsfe}{\sfefamily}
2020

preamble/hacks/fix-qed.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
%% I dont entirely know what I am doing here, but seems to work
33
%% -> changed from /usr/share/texmf-dist/tex/latex/amscls/amsthm.sty
44
\makeatletter
5-
\RenewDocumentCommand{\equation@qed}{}{%
5+
\renewcommand*{\equation@qed}{%
66
\iftagsleft@
77
\hbox{\phantom{\quad\qedsymbol}}%
88
\gdef\alt@tag{%

preamble/hacks/floatrow-parskip.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
%% However, I am not entirely sure why this works..
88

99
\makeatletter
10-
\NewDocumentCommand{\redefineparboxrestore}{}{%
10+
\newcommand*{\redefineparboxrestore}{%
1111
\def\@arrayparboxrestore{%
1212
\let\if@nobreak\iffalse
1313
\let\if@noskipsec\iffalse

0 commit comments

Comments
 (0)