|
171 | 171 | %-
|
172 | 172 | \ProcessOptions\relax%
|
173 | 173 | %---------------------------------------------------------------------------%
|
| 174 | +%->> Detect class and counter |
| 175 | +%---------------------------------------------------------------------------% |
| 176 | +\newcommand*{\ifcounter}[1]{% check if counter exists |
| 177 | + \ifcsname c@#1\endcsname% |
| 178 | + \expandafter\@firstoftwo% |
| 179 | + \else% |
| 180 | + \expandafter\@secondoftwo% |
| 181 | + \fi |
| 182 | +} |
| 183 | +\ifcounter{chapter}{\def\maincounter{chapter}}{\def\maincounter{section}} |
| 184 | +%---------------------------------------------------------------------------% |
174 | 185 | %->> Required packages
|
175 | 186 | %---------------------------------------------------------------------------%
|
176 | 187 | %-
|
177 | 188 | %-> Math packages
|
178 | 189 | %-
|
179 |
| -\RequirePackage{amsmath,amsthm,amssymb}% math packages |
| 190 | +\RequirePackage{amsmath,amsthm,amssymb}% math structures, theorems, and extended symbols |
180 | 191 | \theoremstyle{plain}% for theorems, lemmas, propositions, etc
|
181 | 192 | \providecommand{\theoremname}{Theorem}%
|
182 |
| -\newtheorem{theorem}{\theoremname}[chapter] |
| 193 | +\newtheorem{theorem}{\theoremname}[\maincounter] |
183 | 194 | \providecommand{\axiomname}{Axiom}%
|
184 | 195 | \newtheorem{axiom}[theorem]{\axiomname}
|
185 | 196 | \providecommand{\lemmaname}{Lemma}%
|
|
194 | 205 | \newtheorem{conjecture}[theorem]{\conjecturename}
|
195 | 206 | \theoremstyle{definition}% for definitions and examples
|
196 | 207 | \providecommand{\definitionname}{Definition}%
|
197 |
| -\newtheorem{definition}{\definitionname}[chapter] |
| 208 | +\newtheorem{definition}{\definitionname}[\maincounter] |
198 | 209 | \providecommand{\examplename}{Example}%
|
199 |
| -\newtheorem{example}{\examplename}[chapter] |
| 210 | +\newtheorem{example}{\examplename}[\maincounter] |
200 | 211 | \theoremstyle{remark}% for remarks and notes
|
201 | 212 | \providecommand{\remarkname}{Remark}%
|
202 | 213 | \newtheorem*{remark}{\remarkname}
|
203 | 214 |
|
204 | 215 | \ifartx@math% extra math packages
|
205 |
| - \RequirePackage{mathtools}% |
| 216 | + \RequirePackage{mathtools}% extension to amsmath |
206 | 217 | \fi
|
207 | 218 | %-
|
208 | 219 | %-> Language settings
|
209 | 220 | %-
|
210 | 221 | \ifartx@pdftex% <pdflatex> call font packages
|
211 | 222 | \RequirePackage[utf8]{inputenc}% set input encoding, document must use utf-8 encoding
|
212 | 223 | \RequirePackage[T1]{fontenc}% set font encoding to enable modern font encoding
|
213 |
| - %- Call font package options: |
214 |
| - %- Text + Math: Times Roman |
215 |
| - \RequirePackage{newtxtext}% |
216 |
| - \RequirePackage[cmintegrals]{newtxmath}% load after math packages |
217 |
| - %- Text + Math: Palatino |
218 |
| - %\RequirePackage{palatino}% |
| 224 | + %- Text font: Chinese |
| 225 | + %\RequirePackage{zhmCJK}% support calling system fonts |
| 226 | + %\ifartx@windows% |
| 227 | + % \setCJKmainfont[AutoFakeBold,ItalicFont=simkai.ttf]{simsun.ttc}% |
| 228 | + % \setCJKsansfont[AutoFakeBold]{simhei.ttf}% |
| 229 | + % \setCJKmonofont{simfang.ttf}% |
| 230 | + %\fi |
| 231 | + %- Text font: English <default: computer modern|others: font packages> |
| 232 | + \RequirePackage{newtxtext}% main font, <times font: newtxtext|others: palatino> |
| 233 | + %- Math font: <default: computer modern|others: font packages> |
| 234 | + \RequirePackage[cmintegrals]{newtxmath}% times font, load after amsmath and newtxtext packages |
| 235 | + \RequirePackage{mathrsfs}% enable \mathscr for script alphabet |
| 236 | + \RequirePackage[cal=cm]{mathalfa}% map styles for calligraphic \mathcal and script \mathscr alphabet |
219 | 237 | \else% <xelatex> or <lualatex> call system fonts
|
220 |
| - \RequirePackage[cmintegrals]{newtxmath}% math symbol font, load after math but before fontspec packages |
221 | 238 | \RequirePackage{fontspec}% support calling system fonts
|
222 | 239 | %- Font properties: <family> + <weight> + <shape> + <size>
|
223 | 240 | %- Specify the three default TeX font families: <main>, <sans>, <mono>
|
|
237 | 254 | %- examples: Rockwell, Andale Mono, Courier
|
238 | 255 | %\setmonofont{Rockwell}% font switches: {\ttfamily, ...}, \texttt{...}
|
239 | 256 | %- Specify user-defined font families and font switches
|
| 257 | + %- without NFSSFamily option, a font family is defined only if adding a new font name |
240 | 258 | %\newfontfamily\<font-switch>{<font>}[<font features>]%
|
241 | 259 | %\newcommand{\text<font-switch>}[1]{{\<font-switch> #1}}%
|
242 |
| - % without NFSSFamily option, a font family is defined only when the added font name |
243 |
| - % is a new one. mathrm and mathsf can be set by \setmathrm and \setmathsf |
244 |
| - %\RequirePackage{unicode-math}% another math symbol font configuration |
245 |
| - %\setmathfont{XITS Math}% a complete symbol set for STIX math fonts |
| 260 | + %- Text font: Chinese |
246 | 261 | \ifartx@windows%
|
247 | 262 | \setCJKmainfont[AutoFakeBold,ItalicFont=KaiTi]{SimSun}%
|
248 | 263 | \setCJKsansfont[AutoFakeBold]{SimHei}%
|
|
256 | 271 | \setCJKsansfont[AutoFakeBold]{AdobeHeitiStd-Regular}%
|
257 | 272 | \setCJKmonofont{AdobeFangsongStd-Regular}%
|
258 | 273 | \fi\fi\fi
|
| 274 | + %- Text font: English <default: computer modern|fontspec: system fonts|others: font packages> |
259 | 275 | \ifartx@times%
|
260 | 276 | \setmainfont[NFSSFamily=entextrm]{Times New Roman}%
|
261 | 277 | \setsansfont[NFSSFamily=entextsf]{Times New Roman}%
|
| 278 | + %\setmonofont[NFSSFamily=entexttt]{Courier New}% |
262 | 279 | \else
|
263 | 280 | \setmainfont[NFSSFamily=entextrm]{FreeSerif}%
|
264 | 281 | \setsansfont[NFSSFamily=entextsf]{FreeSerif}%
|
| 282 | + %\setmonofont[NFSSFamily=entexttt]{FreeMono}% |
265 | 283 | \fi
|
| 284 | + %\RequirePackage{newtxtext}% main font |
| 285 | + %- Math font: <default: computer modern|others: font packages <newtxmath|unicode-math>> |
| 286 | + \RequirePackage[cmintegrals]{newtxmath}% times font, load after amsmath and newtxtext packages |
| 287 | + \DeclareSymbolFont{operators}{OT1}{ntxtlf}{m}{n}% fix numbers by setting operator font to newtx-family |
| 288 | + \SetSymbolFont{operators}{bold}{OT1}{ntxtlf}{b}{n}% fix numbers by setting operator font to newtx-family |
| 289 | + \AtBeginDocument{% |
| 290 | + \DeclareMathSymbol{0}{\mathalpha}{operators}{`0}% |
| 291 | + \DeclareMathSymbol{1}{\mathalpha}{operators}{`1}% |
| 292 | + \DeclareMathSymbol{2}{\mathalpha}{operators}{`2}% |
| 293 | + \DeclareMathSymbol{3}{\mathalpha}{operators}{`3}% |
| 294 | + \DeclareMathSymbol{4}{\mathalpha}{operators}{`4}% |
| 295 | + \DeclareMathSymbol{5}{\mathalpha}{operators}{`5}% |
| 296 | + \DeclareMathSymbol{6}{\mathalpha}{operators}{`6}% |
| 297 | + \DeclareMathSymbol{7}{\mathalpha}{operators}{`7}% |
| 298 | + \DeclareMathSymbol{8}{\mathalpha}{operators}{`8}% |
| 299 | + \DeclareMathSymbol{9}{\mathalpha}{operators}{`9}% |
| 300 | + } |
| 301 | + \RequirePackage{mathrsfs}% enable \mathscr for script alphabet |
| 302 | + \RequirePackage[cal=cm]{mathalfa}% map styles for calligraphic \mathcal and script \mathscr alphabet |
| 303 | + %\RequirePackage{unicode-math}% another math font configuration |
| 304 | + %\setmathfont{XITS Math}% a complete symbol set for STIX math fonts |
| 305 | + %- mathrm and mathsf can be set by \setmathrm and \setmathsf |
266 | 306 | \fi
|
267 | 307 | %-
|
268 | 308 | %-> Bibliography processor and package
|
|
467 | 507 | %-
|
468 | 508 | %-> Macro for adding content link to the table of content and bookmark
|
469 | 509 | %-
|
470 |
| -\providecommand{\intotoc}[2][chapter]{% |
| 510 | +\providecommand{\intotoc}[2][\maincounter]{% |
471 | 511 | \cleardoublepage% ensure correct page reference
|
472 | 512 | \markboth{\MakeUppercase{#2}}{}% set the leftmark
|
473 | 513 | \phantomsection% create link in bookmarks
|
|
0 commit comments