-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathelsarticlepreamble.sty
187 lines (159 loc) · 4.51 KB
/
elsarticlepreamble.sty
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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{elsarticlepreamble}
%% Fonts
\RequirePackage{fontspec,microtype}
\defaultfontfeatures{Ligatures=TeX}
\RequirePackage{microtype}
%% Localization
\RequirePackage[english]{babel}
%% Text highlighting
\RequirePackage{soul}
%% Glossaries
\RequirePackage[acronym]{glossaries}
%% Programming facilities
\RequirePackage{etoolbox}
%% Line numbers
\RequirePackage[modulo]{lineno}
\setlength\linenumbersep{5pt}
%% Math
\RequirePackage{amsmath,amssymb,amstext,bm,upgreek,mathtools}
% Fixes for line numbers in math environments
% https://tex.stackexchange.com/questions/436011/linenomath-printing-extra-numbers-on-last-line-of-multline-align-flalign-envir
% https://tex.stackexchange.com/questions/461186/how-to-use-lineno-with-amsmath-align
% Disable line numbering in measurement phase for multline
\makeatletter
\patchcmd{\mmeasure@}{\measuring@true}{
\measuring@true
\ifnum-\linenopenaltypar>\interdisplaylinepenalty
\advance\interdisplaylinepenalty-\linenopenalty
\fi
}{}{}
\makeatother
% Patch 'normal' math environments
\newcommand*\linenomathpatch[1]{%
\cspreto{#1}{\linenomath}%
\cspreto{#1*}{\linenomath}%
\cspreto{end#1}{\endlinenomath}%
\cspreto{end#1*}{\endlinenomath}%
}
% Patch AMS math environments
\newcommand*\linenomathpatchAMS[1]{%
\cspreto{#1}{\linenomathAMS}%
\cspreto{#1*}{\linenomathAMS}%
\csappto{end#1}{\endlinenomath}%
\csappto{end#1*}{\endlinenomath}%
}
% Definition of \linenomathAMS depends on whether the mathlines option is provided
\expandafter\ifx\linenomath\linenomathWithnumbers
\let\linenomathAMS\linenomathWithnumbers
% The following line gets rid of an extra line number at the bottom
\patchcmd\linenomathAMS{\advance\postdisplaypenalty\linenopenalty}{}{}{}
\else
\let\linenomathAMS\linenomathNonumbers
\fi
\linenomathpatch{equation}
\linenomathpatchAMS{gather}
\linenomathpatchAMS{multline}
\linenomathpatchAMS{align}
\linenomathpatchAMS{alignat}
\linenomathpatchAMS{flalign}
%% Missing commands
\providecommand{\abs}[1]{\left\lvert#1\right\rvert} % |.|
\providecommand{\br}[1]{\left(#1\right)} % (.)
\providecommand{\sbr}[1]{\left[#1\right]} % [.]
\providecommand{\ddfrac}[2]{\frac{\displaystyle #1}{\displaystyle #2}} % ./.
\newcommand\AR{\text{\itshape\clipbox{0pt 0pt .32em 0pt}\AE\kern-.30emR}} % AR (Aspect ratio)
% \newcommand\AR{\clipbox{0pt 0pt .32em 0pt}\AE\kern-.30emR} % AR (Aspect ratio)
\newcommand\na{{---}} % N/A
\newcommand*\conj[1]{{#1}^*} % Conjugate
\newcommand*\mean[1]{\bar{#1}} % Mean
%% Missing environments
\newenvironment{wrappedfigure}[1]
{
\vspace{\baselineskip}
\noindent
\begin{minipage}{#1}
\captionsetup{type=figure}
}
{
\end{minipage}
\vspace{\baselineskip}
\noindent
}
\newenvironment{wrappedtable}[1]
{
\vspace{\baselineskip}
\noindent
\begin{minipage}{#1}
\captionsetup{type=table}
}
{
\end{minipage}
\vspace{\baselineskip}
\noindent
}
% \renewenvironment{abstract}
% {
% \small
% \begin{center}
% \bfseries \abstractname\vspace{-.5em}\vspace{0pt}
% \end{center}
% }{}
%% Units
\RequirePackage{siunitx}
% Missing units
\DeclareSIUnit\strain{\hspace{0em}} % Strain
\NewDocumentCommand{\angsi}{omom}{\ang[#1]{#2}\,\si[#3]{#4}} % Redefined \ang with optional unit
%% Listings
\RequirePackage{listings}
% C++11/20 keywords and identifiers
\lstset{
language = [11]C++,
basicstyle = \ttfamily,
keywordstyle = \color{blue},
columns = flexible
% breaklines=true,
% postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{red}\hookrightarrow\space}},
% numbers=left,
% numbersep=5pt,
% numberstyle=\tiny\color{gray},
% basicstyle=\footnotesize\ttfamily
}
\lstset{
morekeywords = {[11]
% C++11
final,
override,
% C++20
char8_t,
concept,
co_await,
co_return,
co_yield,
requires
}
}
\lstset{
emph = {[11]
% C++11
final,
override,
% C++20
import,
module
}
}
% Multicolumn
\RequirePackage{multicol}
%% Tables
\RequirePackage{booktabs,multirow,array,tabularx}
\setlength{\tabcolsep}{3pt} % Table column spacing, default: 6pt
%% Captions
\RequirePackage{caption,subcaption}
%% Lists
\RequirePackage{enumitem}
%% Graphics
\RequirePackage{tikz,graphicx}
%% References and citations
\RequirePackage[colorlinks=true,allcolors=blue]{hyperref}
\RequirePackage{cleveref}