-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathastrobookshelf.cls
135 lines (119 loc) · 4.07 KB
/
astrobookshelf.cls
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% astro-bookshelf.cls
%
% Formating class for notes posted on Open-Astrophysics-Bookshelf.
%
% Edward Brown
% Michigan State University
%
\def\fileversion{1.0}
\def\filedate{2015/5/27}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{astro-bookshelf}[\filedate, \fileversion]
\RequirePackage{ifxetex}
\RequirePackage{xifthen}
\typeout{%
Document Class: `astro-bookshelf' v\fileversion \space <\filedate>}
% Flag to indicate we are making a handout
\newboolean{@handout}
\setboolean{@handout}{false}
\DeclareOption{handout}{\setboolean{@handout}{true}}
% Define fonts. The option profonts specifies the use of Chapparal Pro, Raleway Medium,
% and Source Code Pro for the serif, san serif, and fixed width fonts.
\newboolean{@profonts}
\setboolean{@profonts}{false}
\DeclareOption{profonts}{\setboolean{@profonts}{true}}
\newboolean{@stix}
\setboolean{@stix}{false}
\DeclareOption{stix}{\setboolean{@stix}{true}}
\ProcessOptions
\ifthenelse{\boolean{@handout}}
{
\LoadClass{tufte-handout}
% \DeclareOption*{\PassOptionsToClass{\CurrentOption}{tufte-handout}}
}
{
\LoadClass{tufte-book}
% \DeclareOption*{\PassOptionsToClass{\CurrentOption}{tufte-book}}
}
\RequirePackage{natbib}
\RequirePackage{amssymb}
\ifxetex
\RequirePackage{mathspec}
\fi
\RequirePackage{graphicx}
\RequirePackage{wallpaper}
\RequirePackage{ccicons}
\RequirePackage{fancyvrb}
\ifxetex
\defaultfontfeatures{Scale=MatchLowercase}
\renewcommand{\allcapsspacing}[1]{{\addfontfeature{LetterSpace=20.0}#1}}
\renewcommand{\smallcapsspacing}[1]{{\addfontfeature{LetterSpace=5.0}#1}}
\renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{#1}}}
\renewcommand{\smallcaps}[1]{\smallcapsspacing{\scshape\MakeTextLowercase{#1}}}
\ifthenelse{\boolean{@profonts}}
{
\typeout{loading Chaparral Pro, Source Code Pro, and Raleway Medium}
\setmainfont[Mapping=tex-text]{Chaparral Pro}
\setmonofont[Mapping=tex-text]{Source Code Pro}
\setsansfont[Mapping=tex-text]{Raleway Medium}
\setmathsfont(Digits,Latin)[Numbers={Lining,Proportional}, Scale=MatchLowercase, Mapping=tex-text]{Chaparral Pro}
\setmathrm{Chaparral Pro}
}{
\typeout{loading Palatino, Courier, and Helvetica}
\setmainfont[Mapping=tex-text]{TeX Gyre Pagella}
\setmonofont[Mapping=tex-text]{TeX Gyre Cursor}
\setsansfont[Mapping=tex-text]{TeX Gyre Heros}
\setmathsfont(Digits,Latin)[Numbers={Lining,Proportional}, Scale=MatchLowercase, Mapping=tex-text]{TeX Gyre Pagella}
\setmathrm{TeX Gyre Pagella}
}
\ifthenelse{\boolean{@stix}}
{
\setmathsfont(Greek)[Scale=MatchLowercase,Mapping=tex-text]{STIXGeneral}
% for bold Greeks
\fontspec{STIXGeneral}
\SetSymbolFont{Greek:m:n}{bold}{TU}{\zf@family}{bx}{n}
\SetSymbolFont{Greek:m:it}{bold}{TU}{\zf@family}{bx}{it}
}{}
\fi
% for having inline author citations
\newcommand{\citetalt}[1]{\citeauthor{#1}\cite{#1}}
% for code listings
\fvset{numbers=left}
% Offset box for inline exercises
\ifthenelse{\boolean{@handout}}
{
\newcounter{exercise}
}
{
\newcounter{exercise}[chapter]
\renewcommand{\theexercise}{\thechapter.\arabic{exercise}}
}
\newcommand{\listexercisename}{List of Exercises}
\newcommand\listofexercises{%
\ifthenelse{\equal{\@tufte@class}{book}}%
{\chapter*{\listexercisename}}%
{\section*{\listexercisename}}%
\@starttoc{loe}%
}
% \newlistof[chapter]{exercise}{loe}{\listofexercises}
\newcommand{\exercisedescription}[1]{%
\addcontentsline{loe}{exercise}{\protect\numberline{\theexercise}{\ignorespaces #1}}
}
\newenvironment{exercisebox}[1][]{%
\vspace{\baselineskip}
\noindent\begin{minipage}{\linewidth}\small\raggedright
\refstepcounter{exercise}
\ifnum\value{exercise} = 1%
\addtocontents{loe}{\protect\addvspace{10\p@}}%
\fi
\noindent\rule[0.6ex]{\linewidth}{0.5pt}
\allcaps{exercise \theexercise---}
\exercisedescription{#1}}
{\noindent\rule[0.6ex]{\linewidth}{0.5pt}
\end{minipage}
}
\let\l@exercise\l@figure