-
Notifications
You must be signed in to change notification settings - Fork 91
/
Copy pathevan.sty
831 lines (773 loc) · 29.3 KB
/
evan.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
% https://github.com/vEnhance/dotfiles/blob/main/texmf/tex/latex/evan/evan.sty %
% %
% | \ %
% ______ __ __ ______ _______ _______ _| ▓▓_ __ __ %
% / \| \ / \| \| \ / \ ▓▓ \ | \ | \ %
% | ▓▓▓▓▓▓\\▓▓\ / ▓▓ \▓▓▓▓▓▓\ ▓▓▓▓▓▓▓\ | ▓▓▓▓▓▓▓\▓▓▓▓▓▓ | ▓▓ | ▓▓ %
% | ▓▓ ▓▓ \▓▓\ ▓▓ / ▓▓ ▓▓ | ▓▓ \▓▓ \ | ▓▓ __| ▓▓ | ▓▓ %
% | ▓▓▓▓▓▓▓▓ \▓▓ ▓▓ | ▓▓▓▓▓▓▓ ▓▓ | ▓▓__ _\▓▓▓▓▓▓\ | ▓▓| \ ▓▓__/ ▓▓ %
% \▓▓ \ \▓▓▓ \▓▓ ▓▓ ▓▓ | ▓▓ \ ▓▓ \▓▓ ▓▓\▓▓ ▓▓ %
% \▓▓▓▓▓▓▓ \▓ \▓▓▓▓▓▓▓\▓▓ \▓▓\▓▓\▓▓▓▓▓▓▓ \▓▓▓▓ _\▓▓▓▓▓▓▓ %
% | \__| ▓▓ %
% \▓▓ ▓▓ %
% \▓▓▓▓▓▓ %
% %
% https://github.com/vEnhance/dotfiles/blob/main/texmf/tex/latex/evan/evan.sty %
% ░█▄█░▄▀▄░█░░▒█░░░▀█▀░▄▀▄░░░█▒█░▄▀▀▒██▀
% ▒█▒█░▀▄▀░▀▄▀▄▀▒░░▒█▒░▀▄▀▒░░▀▄█▒▄██░█▄▄
%
% If you don't know how to use this file, read:
% +--------------------------------------------+
% | https://web.evanchen.cc/faq-latex.html#L-4 |
% +--------------------------------------------+
%
% TL;DR of the Boost license conditions are as follows:
%
% 1. Any SOURCE VERSIONS must cite evan.sty and the Boost license below.
% 2. For COMPILED PDF OUTPUT, attribution of evan.sty is OPTIONAL (but nice).
% 3. NO OTHER REQUIREMENTS; you may modify, redistribute, sell freely.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% BOOST SOFTWARE LICENSE - VERSION 1.0 - 17 AUGUST 2003
%
% Copyright (c) 2025 Evan Chen [evan at evanchen.cc]
% https://web.evanchen.cc/ || github.com/vEnhance
%
% Available for download at:
% https://github.com/vEnhance/dotfiles/blob/main/texmf/tex/latex/evan/evan.sty
%
% Permission is hereby granted, free of charge, to any person or organization
% obtaining a copy of the software and accompanying documentation covered by
% this license (the "Software") to use, reproduce, display, distribute,
% execute, and transmit the Software, and to prepare derivative works of the
% Software, and to permit third-parties to whom the Software is furnished to
% do so, all subject to the following:
%
% The copyright notices in the Software and this entire statement, including
% the above license grant, this restriction and the following disclaimer,
% must be included in all copies of the Software, in whole or in part, and
% all derivative works of the Software, unless such copies or derivative
% works are solely in the form of machine-executable object code generated by
% a source language processor.
%
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
% FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
% SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
% FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
% ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
% DEALINGS IN THE SOFTWARE.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ProvidesPackage{evan}
%%fakesection Argument processing
% Default Arguments
% We include "Evan" in all of these to make sure
% that they don't collide with anything in external packages
\newif\ifevanfancy\evanfancytrue
\newif\ifevanhdr\evanhdrtrue
\newif\ifevanhref\evanhreftrue
\newif\ifevansetup\evansetuptrue
\newif\ifevanthm\evanthmtrue
\newif\ifevansecthm\evansecthmfalse
\newif\ifevanpkg\evanpkgtrue
\newif\ifevanpdf\evanpdftrue
\newif\ifevanauthor\evanauthortrue
\newif\ifevanchinese\evanchinesefalse
\newif\ifevanmdthm\evanmdthmfalse
\newif\ifevanpatchasy\evanpatchasyfalse
\newif\ifevanhints\evanhintsfalse
\newif\ifevanasy\evanasytrue
\newif\ifevancolorsec\evancolorsecfalse
\newif\ifevantitlemark\evantitlemarktrue
\newif\ifevanvonenabled\evanvonenabledfalse
\newif\ifevanbritish\evanbritishtrue
\newif\ifevanbib\evanbibfalse
%Receive Arguments
\DeclareOption{chinese}{\evanchinesetrue} % Chinese support
% allow href to override this one
\DeclareOption{sexy}{\evansecthmtrue\evanmdthmtrue\evancolorsectrue} % long docs
\DeclareOption{fancy}{\evanfancytrue}
\DeclareOption{nofancy}{\evanfancyfalse}
\DeclareOption{hdr}{\evanhdrtrue}
\DeclareOption{nohdr}{\evanhdrfalse}
\DeclareOption{href}{\evanhreftrue}
\DeclareOption{nohref}{\evanhreffalse}
\DeclareOption{nosetup}{\evansetupfalse}
\DeclareOption{thm}{\evanthmtrue}
\DeclareOption{nothm}{\evanthmfalse}
\DeclareOption{secthm}{\evansecthmtrue}
\DeclareOption{nosecthm}{\evansecthmfalse}
\DeclareOption{nopdf}{\evanpdffalse}
\DeclareOption{nopkg}{\evanpkgfalse}
\DeclareOption{noauthor}{\evanauthorfalse}
\DeclareOption{titlemark}{\evantitlemarktrue} % Sets title in ohead, not \rightmark
\DeclareOption{sectionmark}{\evantitlemarkfalse} % Uses \rightmark not title in ohead
\DeclareOption{mdthm}{\evanmdthmtrue}
\DeclareOption{nomdthm}{\evanmdthmfalse}
\DeclareOption{colorsec}{\evancolorsectrue}
\DeclareOption{nocolorsec}{\evancolorsecfalse}
\DeclareOption{patchasy}{\evanpatchasytrue}
\DeclareOption{noasy}{\evanasyfalse}
\DeclareOption{hints}{\evanhintstrue}
\DeclareOption{von}{\evanvonenabledtrue}
\DeclareOption{british}{\evanbritishtrue}
\DeclareOption{american}{\evanbritishfalse}
\DeclareOption{bib}{\evanbibtrue}
% legacy diagrams option, for backwards compatibility
\DeclareOption{diagrams}{}
\DeclareOption{nodiagrams}{}
\ProcessOptions\relax
% if packages not loaded, turn off mdthm and asy
\ifevanpkg\else\evanmdthmfalse\fi
\ifevanpkg\else\evanasyfalse\fi
% If no setup, turn off theorems
\ifevansetup\else\evanthmfalse\fi
%%fakesection Some macros
%Small commands
\usepackage{amsmath,amssymb}
\usepackage{iftex}
\ifevanpkg
\usepackage[minimal]{yhmath}
\usepackage{derivative}
\fi
\newcommand{\cbrt}[1]{\sqrt[3]{#1}}
\newcommand{\floor}[1]{\left\lfloor #1 \right\rfloor}
\newcommand{\ceiling}[1]{\left\lceil #1 \right\rceil}
\newcommand{\mailto}[1]{\href{mailto:#1}{\texttt{#1}}}
\newcommand{\ol}{\overline}
\newcommand{\ul}{\underline}
\newcommand{\wt}{\widetilde}
\newcommand{\wh}{\widehat}
\newcommand{\eps}{\varepsilon}
\newcommand{\vocab}[1]{\textbf{\color{blue}\sffamily #1}}
\providecommand{\alert}{\vocab}
\providecommand{\half}{\frac{1}{2}}
\newcommand{\catname}{\mathsf}
\newcommand{\hrulebar}{
\par\hspace{\fill}\rule{0.95\linewidth}{.7pt}\hspace{\fill}
\par\nointerlineskip \vspace{\baselineskip}
}
\providecommand{\arc}[1]{\wideparen{#1}}
%For use in author command
\newcommand{\plusemail}[1]{\\ \normalfont \texttt{\mailto{#1}}}
%More commands and math operators
\DeclareMathOperator{\cis}{cis}
\DeclareMathOperator*{\lcm}{lcm}
\DeclareMathOperator*{\argmin}{arg min}
\DeclareMathOperator*{\argmax}{arg max}
%Convenient Environments
\newenvironment{soln}{\begin{proof}[Solution]}{\end{proof}}
\newenvironment{parlist}{\begin{inparaenum}[(i)]}{\end{inparaenum}}
\newenvironment{gobble}{\setbox\z@\vbox\bgroup}{\egroup}
%Inequalities
\newcommand{\cycsum}{\sum_{\mathrm{cyc}}}
\newcommand{\symsum}{\sum_{\mathrm{sym}}}
\newcommand{\cycprod}{\prod_{\mathrm{cyc}}}
\newcommand{\symprod}{\prod_{\mathrm{sym}}}
%From H113 "Introduction to Abstract Algebra" at UC Berkeley
\newcommand{\CC}{\mathbb C}
\newcommand{\FF}{\mathbb F}
\newcommand{\NN}{\mathbb N}
\newcommand{\QQ}{\mathbb Q}
\newcommand{\RR}{\mathbb R}
\newcommand{\ZZ}{\mathbb Z}
\newcommand{\charin}{\text{ char }}
\DeclareMathOperator{\sign}{sign}
\DeclareMathOperator{\Aut}{Aut}
\DeclareMathOperator{\Inn}{Inn}
\DeclareMathOperator{\Syl}{Syl}
\DeclareMathOperator{\Gal}{Gal}
\DeclareMathOperator{\GL}{GL} % General linear group
\DeclareMathOperator{\SL}{SL} % Special linear group
\DeclareMathOperator{\Vol}{Vol} % Special linear group
%From Kiran Kedlaya's "Geometry Unbound"
\newcommand{\abs}[1]{\left\lvert #1 \right\rvert}
\newcommand{\norm}[1]{\left\lVert #1 \right\rVert}
\newcommand{\dang}{\measuredangle} %% Directed angle
\newcommand{\ray}[1]{\overrightarrow{#1}}
\newcommand{\seg}[1]{\overline{#1}}
%From M275 "Topology" at SJSU
\DeclareMathOperator{\id}{id}
\newcommand{\taking}[1]{\xrightarrow{#1}}
\newcommand{\inv}{^{-1}}
%From M170 "Introduction to Graph Theory" at SJSU
\DeclareMathOperator{\diam}{diam}
\DeclareMathOperator{\ord}{ord}
\newcommand{\defeq}{\overset{\mathrm{def}}{=}}
%From the USAMO .tex files
\newcommand{\ts}{\textsuperscript}
\newcommand{\dg}{^\circ}
\newcommand{\ii}{\item}
% From Math 55 and Math 145 at Harvard
\newenvironment{subproof}[1][Proof]{%
\begin{proof}[#1] \renewcommand{\qedsymbol}{$\blacksquare$}}%
{\end{proof}}
\newcommand{\liff}{\leftrightarrow}
\newcommand{\lthen}{\rightarrow}
\newcommand{\opname}{\operatorname}
\newcommand{\surjto}{\twoheadrightarrow}
\newcommand{\injto}{\hookrightarrow}
\newcommand{\On}{\mathrm{On}} % ordinals
\DeclareMathOperator{\img}{im} % Image
\DeclareMathOperator{\Img}{Im} % Image
\DeclareMathOperator{\coker}{coker} % Cokernel
\DeclareMathOperator{\Coker}{Coker} % Cokernel
\DeclareMathOperator{\Ker}{Ker} % Kernel
\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\Spec}{Spec} % spectrum
\DeclareMathOperator{\Tr}{Tr} % trace
\DeclareMathOperator{\pr}{pr} % projection
\DeclareMathOperator{\ext}{ext} % extension
\DeclareMathOperator{\pred}{pred} % predecessor
\DeclareMathOperator{\dom}{dom} % domain
\DeclareMathOperator{\ran}{ran} % range
\DeclareMathOperator{\Hom}{Hom} % homomorphism
\DeclareMathOperator{\Mor}{Mor} % morphisms
\DeclareMathOperator{\End}{End} % endomorphism
% Things Lie
\newcommand{\kb}{\mathfrak b}
\newcommand{\kg}{\mathfrak g}
\newcommand{\kh}{\mathfrak h}
\newcommand{\kn}{\mathfrak n}
\newcommand{\ku}{\mathfrak u}
\newcommand{\kz}{\mathfrak z}
\DeclareMathOperator{\Ext}{Ext} % Ext functor
\DeclareMathOperator{\Tor}{Tor} % Tor functor
\newcommand{\gl}{\opname{\mathfrak{gl}}} % frak gl group
\def\sl{\opname{\mathfrak{sl}}} % frak sl group chktex 6
% More script letters etc.
\newcommand{\SA}{\mathcal A}
\newcommand{\SB}{\mathcal B}
\newcommand{\SC}{\mathcal C}
\newcommand{\SF}{\mathcal F}
\newcommand{\SG}{\mathcal G}
\newcommand{\SH}{\mathcal H}
\newcommand{\OO}{\mathcal O}
\newcommand{\SCA}{\mathscr A}
\newcommand{\SCB}{\mathscr B}
\newcommand{\SCC}{\mathscr C}
\newcommand{\SCD}{\mathscr D}
\newcommand{\SCE}{\mathscr E}
\newcommand{\SCF}{\mathscr F}
\newcommand{\SCG}{\mathscr G}
\newcommand{\SCH}{\mathscr H}
% Mathfrak primes
\newcommand{\km}{\mathfrak m}
\newcommand{\kp}{\mathfrak p}
\newcommand{\kq}{\mathfrak q}
%%fakesection Asymptote setup
\ifevanasy
\ifevanpatchasy
\usepackage{patchasy}
\else
\usepackage{asymptote}
\fi
\begin{asydef}
defaultpen(fontsize(10pt));
size(8cm); // set a reasonable default
usepackage("amsmath");
usepackage("amssymb");
settings.tex="pdflatex";
settings.outformat="pdf";
// Replacement for olympiad+cse5 which is not standard
import geometry;
// recalibrate fill and filldraw for conics
void filldraw(picture pic = currentpicture, conic g, pen fillpen=defaultpen, pen drawpen=defaultpen)
{ filldraw(pic, (path) g, fillpen, drawpen); }
void fill(picture pic = currentpicture, conic g, pen p=defaultpen)
{ filldraw(pic, (path) g, p); }
// some geometry
pair foot(pair P, pair A, pair B) { return foot(triangle(A,B,P).VC); }
pair centroid(pair A, pair B, pair C) { return (A+B+C)/3; }
// cse5 abbreviations
path CP(pair P, pair A) { return circle(P, abs(A-P)); }
path CR(pair P, real r) { return circle(P, r); }
pair IP(path p, path q) { return intersectionpoints(p,q)[0]; }
pair OP(path p, path q) { return intersectionpoints(p,q)[1]; }
path Line(pair A, pair B, real a=0.6, real b=a) { return (a*(A-B)+A)--(b*(B-A)+B); }
// cse5 more useful functions
picture CC() {
picture p=rotate(0)*currentpicture;
currentpicture.erase();
return p;
}
pair MP(Label s, pair A, pair B = plain.S, pen p = defaultpen) {
Label L = s;
L.s = "$"+s.s+"$";
label(L, A, B, p);
return A;
}
pair Drawing(Label s = "", pair A, pair B = plain.S, pen p = defaultpen) {
dot(MP(s, A, B, p), p);
return A;
}
path Drawing(path g, pen p = defaultpen, arrowbar ar = None) {
draw(g, p, ar);
return g;
}
\end{asydef}
\fi
%%fakesection BEGIN MAIN SETUP
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifevansetup
%%fakesection Set up author and date
\ifevanauthor
\title{} % empty title to avoid crashes
\ifluatex
\author{Evan Chen《陳誼廷》}
\else
\author{Evan Chen}
\fi
\date{\today}
\fi
%%fakesection Hyperref
\ifevanpkg
\PassOptionsToPackage{svgnames,dvipsnames,table}{xcolor}
\usepackage{xcolor}
\ifevanbib
\usepackage[backend=biber,backref=true,style=alphabetic]{biblatex}
\DeclareFieldFormat{labelalpha}{\textbf{\small #1}} % citation ID's in small-bold
\DefineBibliographyStrings{english}{%
backrefpage = {cited p.}, % for single page number
backrefpages = {cited pp.} % for multiple page numbers
}
\DeclareFieldFormat{journaltitle}{\mkbibemph{#1},} % italic journal title with comma
\DeclareFieldFormat[inbook,thesis]{title}{\mkbibemph{#1}\addperiod} % italic title with period
\DeclareFieldFormat[article]{title}{#1} % title of journal article is printed as normal text
\DeclareFieldFormat[article]{volume}{\textbf{#1}\addcolon\space} % bold volume numbers
% Separate ISBN-13 field
\DeclareSourcemap{\maps[datatype=bibtex]{\map{\step[fieldsource=ISBN-13,fieldtarget=ISBN]}}}
% Evan likes small caps for bibliography author names
\renewcommand{\mkbibnamegiven}[1]{\textsc{#1}}
\renewcommand{\mkbibnamefamily}[1]{\textsc{#1}}
\renewcommand{\mkbibnameprefix}[1]{\textsc{#1}}
\renewcommand{\mkbibnamesuffix}[1]{\textsc{#1}}
% Drop trailing punctuation in bibliography names
\renewcommand{\finentrypunct}{}
\fi
\ifevanhref
\usepackage[colorlinks=true,pdfusetitle]{hyperref}
\hypersetup{pdfkeywords={evan.sty},pdfsubject={web.evanchen.cc}}
\hypersetup{urlcolor=RubineRed,linkcolor=RoyalBlue,citecolor=ForestGreen}
\fi
\usepackage[nameinlink]{cleveref}
\fi
%%fakesection New theorem styles
\ifevanthm
\usepackage{amsthm}
\usepackage{thmtools}
\fi
\ifevanmdthm
\ifevanthm
%% theorem packages loaded already
\else
\usepackage{amsthm}
\usepackage{thmtools}
\fi
\usepackage[framemethod=TikZ]{mdframed}
\usetikzlibrary{shadows}
% https://tex.stackexchange.com/a/292090/76888
% https://github.com/marcodaniel/mdframed/issues/12
\usepackage{xpatch}
\xpatchcmd{\endmdframed}
{\aftergroup\endmdf@trivlist\color@endgroup}
{\endmdf@trivlist\color@endgroup\@doendpe}
{}{}
\mdfdefinestyle{mdbluebox}{%
roundcorner=10pt,
linewidth=1pt,
skipabove=12pt,
innerbottommargin=9pt,
skipbelow=2pt,
linecolor=blue,
nobreak=true,
backgroundcolor=TealBlue!5,
}
\declaretheoremstyle[
headfont=\sffamily\bfseries\color{MidnightBlue},
mdframed={style=mdbluebox},
headpunct={\\[3pt]},
postheadspace={0pt}
]{thmbluebox}
\mdfdefinestyle{mdredbox}{%
linewidth=0.5pt,
skipabove=12pt,
frametitleaboveskip=5pt,
frametitlebelowskip=0pt,
skipbelow=2pt,
frametitlefont=\bfseries,
innertopmargin=4pt,
innerbottommargin=8pt,
nobreak=true,
backgroundcolor=Salmon!5,
linecolor=RawSienna,
}
\declaretheoremstyle[
headfont=\bfseries\color{RawSienna},
mdframed={style=mdredbox},
headpunct={\\[3pt]},
postheadspace={0pt},
]{thmredbox}
\mdfdefinestyle{mdgreenbox}{%
skipabove=8pt,
skipbelow=0pt,
linewidth=2pt,
rightline=false,
leftline=true,
topline=false,
bottomline=false,
linecolor=ForestGreen,
backgroundcolor=ForestGreen!5,
}
\declaretheoremstyle[
headfont=\bfseries\sffamily\color{ForestGreen!70!black},
bodyfont=\normalfont,
spaceabove=2pt,
spacebelow=1pt,
mdframed={style=mdgreenbox},
headpunct={ --- },
]{thmgreenbox}
\mdfdefinestyle{mdblackbox}{%
skipabove=8pt,
linewidth=3pt,
rightline=false,
leftline=true,
topline=false,
bottomline=false,
linecolor=black,
backgroundcolor=RedViolet!5!gray!5,
}
\declaretheoremstyle[
headfont=\bfseries,
bodyfont=\normalfont\small,
spaceabove=0pt,
spacebelow=0pt,
mdframed={style=mdblackbox}
]{thmblackbox}
\mdfdefinestyle{mdpurplebox}{%
roundcorner=10pt,
linewidth=1pt,
skipabove=12pt,
skipbelow=12pt,
innertopmargin=9pt,
innerbottommargin=9pt,
linecolor=black,
nobreak=true,
backgroundcolor=Orchid!10,
shadow=true,
shadowsize=6pt,
shadowcolor=black!30,
frametitleaboveskip=8pt,
frametitlebelowskip=8pt,
frametitlebackgroundcolor=Violet!50!black,
frametitlefont=\bfseries\sffamily\color{white},
frametitlerule=true,
}
\newcommand{\listhack}{$\empty$\vspace{-2em}}
\fi
%%fakesection Theorem setup
\ifevanthm
\theoremstyle{definition}
%Branching here: the option secthm changes theorems to be labelled by section
\ifevanmdthm
\ifevansecthm
\declaretheorem[style=thmbluebox,name=Theorem,numberwithin=section]{theorem}
\else
\declaretheorem[style=thmbluebox,name=Theorem]{theorem}
\fi
\declaretheorem[style=thmbluebox,name=Lemma,sibling=theorem]{lemma}
\declaretheorem[style=thmbluebox,name=Proposition,sibling=theorem]{proposition}
\declaretheorem[style=thmbluebox,name=Corollary,sibling=theorem]{corollary}
\declaretheorem[style=thmbluebox,name=Assumption,sibling=theorem]{assume}
\declaretheorem[style=thmbluebox,name=Theorem,numbered=no]{theorem*}
\declaretheorem[style=thmbluebox,name=Lemma,numbered=no]{lemma*}
\declaretheorem[style=thmbluebox,name=Proposition,numbered=no]{proposition*}
\declaretheorem[style=thmbluebox,name=Corollary,numbered=no]{corollary*}
\declaretheorem[style=thmbluebox,name=Assumption,numbered=no]{assume*}
\else
\ifevansecthm
\declaretheorem[name=Theorem,numberwithin=section]{theorem}
\else
\declaretheorem[name=Theorem]{theorem}
\fi
\declaretheorem[name=Lemma,sibling=theorem]{lemma}
\declaretheorem[name=Proposition,sibling=theorem]{proposition}
\declaretheorem[name=Corollary,sibling=theorem]{corollary}
\declaretheorem[name=Assumption,sibling=theorem]{assume}
\declaretheorem[name=Theorem,numbered=no]{theorem*}
\declaretheorem[name=Lemma,numbered=no]{lemma*}
\declaretheorem[name=Proposition,numbered=no]{proposition*}
\declaretheorem[name=Corollary,numbered=no]{corollary*}
\declaretheorem[name=Assumption,numbered=no]{assume*}
\fi
\ifevanmdthm
\declaretheorem[style=thmgreenbox,name=Algorithm,sibling=theorem]{algorithm}
\declaretheorem[style=thmgreenbox,name=Algorithm,numbered=no]{algorithm*}
\declaretheorem[style=thmgreenbox,name=Claim,sibling=theorem]{claim}
\declaretheorem[style=thmgreenbox,name=Claim,numbered=no]{claim*}
\else
\declaretheorem[name=Algorithm,sibling=theorem]{algorithm}
\declaretheorem[name=Algorithm,numbered=no]{algorithm*}
\declaretheorem[name=Claim,sibling=theorem]{claim}
\declaretheorem[name=Claim,numbered=no]{claim*}
\fi
\ifevanmdthm
\declaretheorem[style=thmredbox,name=Example,sibling=theorem]{example}
\declaretheorem[style=thmredbox,name=Example,numbered=no]{example*}
\else
\declaretheorem[name=Example,sibling=theorem]{example}
\declaretheorem[name=Example,numbered=no]{example*}
\fi
% Remark-style theorems
\ifevanmdthm
\declaretheorem[style=thmblackbox,name=Remark,sibling=theorem]{remark}
\declaretheorem[style=thmblackbox,name=Remark,numbered=no]{remark*}
\else
\declaretheorem[name=Remark,sibling=theorem]{remark}
\declaretheorem[name=Remark,numbered=no]{remark*}
\fi
\ifevanmdthm
\declaretheoremstyle[
headfont=\color{blue!40!black}\normalfont\bfseries,
spaceabove=8pt,
spacebelow=8pt,
bodyfont=\normalfont
]{basehead}
\else
\declaretheoremstyle[spaceabove=6pt,spacebelow=6pt]{basehead}
\fi
\declaretheorem[style=basehead,name=Answer,sibling=theorem]{answer}
\declaretheorem[style=basehead,name=Answer,numbered=no]{answer*}
\declaretheorem[style=basehead,name=Conjecture,sibling=theorem]{conjecture}
\declaretheorem[style=basehead,name=Conjecture,numbered=no]{conjecture*}
\declaretheorem[style=basehead,name=Definition,sibling=theorem]{definition}
\declaretheorem[style=basehead,name=Definition,numbered=no]{definition*}
\declaretheorem[style=basehead,name=Exercise,sibling=theorem]{exercise}
\declaretheorem[style=basehead,name=Exercise,numbered=no]{exercise*}
\declaretheorem[style=basehead,name=Fact,sibling=theorem]{fact}
\declaretheorem[style=basehead,name=Fact,numbered=no]{fact*}
\declaretheorem[style=basehead,name=Problem,sibling=theorem]{problem}
\declaretheorem[style=basehead,name=Problem,numbered=no]{problem*}
\declaretheorem[style=basehead,name=Question,sibling=theorem]{ques}
\declaretheorem[style=basehead,name=Question,numbered=no]{ques*}
\ifevanpkg
\Crefname{answer}{Answer}{Answers}
\Crefname{assume}{Assumption}{Assumptions}
\Crefname{claim}{Claim}{Claims}
\Crefname{conjecture}{Conjecture}{Conjectures}
\Crefname{exercise}{Exercise}{Exercises}
\Crefname{fact}{Fact}{Facts}
\Crefname{problem}{Problem}{Problems}
\Crefname{ques}{Question}{Questions}
\fi
\fi
%%fakesection Fancy section and chapter heads
\ifevancolorsec
\@ifundefined{KOMAClassName}{}{
\@ifundefined{chapter}{}{
\addtokomafont{partprefix}{\rmfamily}
\renewcommand*{\partformat}{\color{purple}
\scalebox{2.5}{\thepart}\enlargethispage{2em}}
\addtokomafont{chapterprefix}{\raggedleft}
\RedeclareSectionCommand[beforeskip=0.5em]{chapter}
\renewcommand*{\chapterformat}{\mbox{%
\scalebox{1.5}{\chapappifchapterprefix{\nobreakspace}}%
\scalebox{2.718}{\color{purple}\thechapter}\enskip}}
}
\renewcommand*{\sectionformat}%
{\color{purple}\S\thesection\enskip}
\renewcommand*{\subsectionformat}%
{\color{purple}\S\thesubsection\enskip}
\renewcommand*{\subsubsectionformat}%
{\color{purple}\S\thesubsubsection\enskip}
\addtokomafont{paragraph}{\color{orange!35!black}\P\ }
\KOMAoptions{numbers=noenddot}
%\usetocstyle{KOMAlike}
}
\fi
%%fakesection Loads a bunch of useful packages (but allow disabling)
\ifevanpkg
\ifevanvonenabled
\IfFileExists{von.sty}{\usepackage{von}}{}
\fi
\usepackage{listings}
\usepackage{mathrsfs}
\usepackage{textcomp}
\lstset{basicstyle=\ttfamily\small,
backgroundcolor=\color{yellow!3!white},
breakatwhitespace=true,
breaklines=true,
columns=fullflexible,
commentstyle=\color{red!70!black},
frame=shadowbox,
frame=single,
framerule=1pt,
identifierstyle=\color{green!40!black},
keywordstyle=\bfseries,
keywordstyle=\bfseries\color{blue!80!black},
numbers=left,
numbersep=8pt,
numberstyle=\scriptsize\sffamily\itshape\color{black!80},
rulecolor=\color{blue!70!black},
rulesepcolor=\color{blue!30!black},
showstringspaces=false,
stringstyle=\color{orange},
tabsize=4,
xleftmargin=15pt,
xrightmargin=15pt,
resetmargins=true,
} % chktex 6
\lstdefinelanguage{gitcommit}{
alsoletter={:},
morecomment=[l]{|},
morekeywords={commit,Author:,Date:,chore,doc,edit,feat,fix,polish,style,tests,},
sensitive=true,
}
\lstdefinelanguage{gitlog}{
morekeywords={chore,doc,edit,feat,fix,polish,style,tests,},
morecomment=[s]{[}{]}, % chktex 9
sensitive=true,
}
\usepackage[shortlabels]{enumitem}
\usepackage[obeyFinal,textsize=scriptsize,shadow,loadshadowlibrary]{todonotes}
\usepackage{multirow}
\usepackage{ellipsis} % don't use ugly unicode ellipsis
\usepackage{epigraph}
\renewcommand{\epigraphsize}{\scriptsize}
\renewcommand{\epigraphwidth}{60ex}
% Tiny optimizations:
\usepackage{mathtools}
\usepackage{microtype}
\usepackage{xstring}
\usepackage{wrapfig}
\ifevanbritish\usepackage[cleanlook,british]{isodate}\fi % day-first date
\usepackage{tikz-cd}
\usetikzlibrary{decorations.pathmorphing}
\allowdisplaybreaks
% a list I like for walkthrough's --- Drew-style parts
\newlist{walk}{enumerate}{3}
\setlist[walk]{label=\bfseries (\alph*)}
% list item for MO style rubrics
\newcommand{\worth}[1]{\def\hfill{\hskip 20pt plus 1fill}\dotfill%
\IfEq{#1}{0}{\textbf{0~points}}%
{\textbf{\color{blue}#1~point\IfEndWith{#1}{1}{}{s}}}%
\par}
\newcommand{\subworth}[1]{\def\hfill{\hskip 20pt plus 1fill}\dotfill%
\IfEq{#1}{0}{{\footnotesize0~points}}%
{\textbf{\footnotesize#1~point\IfEndWith{#1}{1}{}{s}}}%
\par}
\newlist{rubric}{enumerate}{2}
\setlist[rubric,1]{label=\Roman*.}
\setlist[rubric,2]{label=(\Roman{rubrici}.\alph*)}
\fi
%%fakesection \maketitle configuration
\@ifundefined{KOMAClassName}%
{} % do nothing outside KOMA class
{% If KOMA exists. . .
\addtokomafont{subtitle}{\Large}
\setkomafont{author}{\Large\scshape}
\setkomafont{date}{\Large\normalsize}
}
\providecommand{\thetitle}{\@title}
\providecommand{\theauthor}{\@author}
\providecommand{\thedate}{\@date}
%%fakesection Page setup
\ifevanfancy
\@ifundefined{KOMAClassName}
{
\usepackage{fancyhdr}
\setlength{\headheight}{0.75in}
\setlength{\oddsidemargin}{0in}
\setlength{\evensidemargin}{0in}
\setlength{\voffset}{-1.0in}
\setlength{\headsep}{10pt}
\setlength{\textwidth}{6.5in}
\setlength{\headwidth}{6.5in}
\setlength{\textheight}{8.75in}
\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
\setlength{\footskip}{0.3in}
\ifevanhdr
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0.0pt}
\pagestyle{fancy}
\lhead{Evan Chen}
\chead{}
\rhead{\nouppercase{\leftmark}}
\lfoot{}
\cfoot{\thepage}
\rfoot{}
\fi
}
{
\usepackage[headsepline]{scrlayer-scrpage}
\renewcommand{\headfont}{}
\addtolength{\textheight}{3.14cm}
\setlength{\footskip}{0.5in}
\setlength{\headsep}{10pt}
\ihead{\footnotesize\textbf{\theauthor} --- \thedate}
\automark{section}
\chead{}
\ohead{\footnotesize\textbf{\thetitle}}
\cfoot{\pagemark}
}
\fi
%%fakesection Unicode
\ifevanpkg
\ifluatex
\ifevanchinese
\usepackage{luatexja-fontspec}
\else
\usepackage{fontspec}
\fi
% https://tex.stackexchange.com/a/572220/76888
\directlua{luaotfload.add_fallback
("evans_fallbacks",
{
"NotoColorEmoji:mode=harf;",
"Source Han Sans TW:style=Regular;",
"Noto Serif CJK SC:style=Regular;",
}
)}
\setmainfont{lmroman10-regular}[
BoldFont=lmroman10-bold,
ItalicFont=lmroman10-italic,
BoldItalicFont=lmroman10-bolditalic,
SlantedFont=lmromanslant10-regular,
BoldSlantedFont=lmromanslant10-bold,
SmallCapsFont=lmromancaps10-regular,
RawFeature={fallback=evans_fallbacks}
]
\setsansfont{lmsans10-regular}[
BoldFont=lmsans10-bold,
ItalicFont=lmsans10-oblique,
BoldItalicFont=lmsans10-boldoblique,
RawFeature={fallback=evans_fallbacks}
]
\ifevanchinese
\setmainjfont{Source Han Sans TW}[RawFeature={fallback=evans_fallbacks}]
\setsansjfont{Source Han Sans TW}[RawFeature={fallback=evans_fallbacks}]
\fi
\else
\ifevanchinese
\usepackage{babel}
\usepackage[encapsulated]{CJK}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\newenvironment{bsmi}{\begin{CJK}{UTF8}{bsmi}}{\end{CJK}}
\newcommand{\cn}[1]{\begin{bsmi}#1\end{bsmi}}
\AtBeginDocument{\begin{CJK}{UTF8}{bsmi}}
\AtEndDocument{\end{CJK}}
\fi
\fi
\fi
%%fakesection Hints
\ifevanhints
\usepackage{answers}
\Newassociation{hint}{hintitem}{hints}
\renewcommand{\solutionextension}{out}
\Opensolutionfile{hints}
\newcommand{\makehints}{\Closesolutionfile{hints}\input{hints.out}} % chktex 27
\fi
%%fakesection END MAIN SETUP
\fi