Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.44 KB | None | 0 0
  1. \NeedsTeXFormat{LaTeX2e}
  2. \ProvidesClass{classwork}[2018/11/28 Kogasa's Classwork Class]
  3.  
  4. \LoadClass{article}
  5.  
  6. %Margins
  7. %\usepackage[margin=1in]{geometry}
  8. \usepackage[DIV=10,BCOR=2mm,headinclude=true,footinclude=false]{typearea}
  9.  
  10. %Typical packages
  11. \usepackage{amsmath,amsthm,amssymb,amsfonts,multicol,afterpage,fancyhdr,environ,enumerate,turnstile,titling,xparse}
  12.  
  13. %FONTS
  14. %-------------------------
  15. %https://tex.stackexchange.com/questions/82001/microtype-settings-for-dummies
  16. %http://www.khirevich.com/latex/microtype/
  17. \usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true, factor=1100,stretch=10,shrink=10]{microtype}
  18. \usepackage[T1]{fontenc}
  19.  
  20. %Prevents odd spacing message
  21. \microtypecontext{spacing=nonfrench}
  22.  
  23. \SetProtrusion{encoding={*},family={*}, series={*},size={6,7}}
  24. {1={ ,750},2={ ,500},3={ ,500},4={ ,500},5={ ,500},
  25. 6={ ,500},7={ ,600},8={ ,500},9={ ,500},0={ ,500}}
  26.  
  27. \SetExtraKerning[unit=space]
  28. {encoding={*}, family={*}, series={*}, size={footnotesize,small,normalsize}}
  29. {\textendash={400,400}, % en-dash, add more space around it
  30. "28={ ,150}, % left bracket, add space from right
  31. "29={150, }, % right bracket, add space from left
  32. \textquotedblleft={ ,150}, % left quotation mark, space from right
  33. \textquotedblright={150, }} % right quotation mark, space from left
  34.  
  35. \SetExtraKerning[unit=space]
  36. {encoding={*}, family={*}, series={b}, size={large,Large}}
  37. {1={-200,-200},
  38. \textendash={400,400}}
  39. \SetTracking{encoding={*}, shape=sc}{40}
  40.  
  41. \makeatletter
  42. \def\@maketitle{%
  43. \newpage
  44. \null
  45. \vskip 2em%
  46. \begin{center}%
  47. \let \footnote \thanks
  48. {\LARGE \bfseries \fontfamily{qhv}\selectfont \@title \par}%
  49. \vskip 1.5em%
  50. {\large
  51. \lineskip .5em%
  52. \begin{tabular}[t]{c}%
  53. \fontfamily{qhv}\selectfont \@author
  54. \end{tabular}\par}%
  55. \vskip 1em%
  56. {\large \fontfamily{qhv}\selectfont \@date}
  57. \end{center}%
  58. \par
  59. \vskip 1.5em}
  60. \makeatother
  61.  
  62. \usepackage{titlesec,tocloft}
  63.  
  64. \titleformat{\section}[hang]{
  65. \usefont{T1}{qhv}{b}{n}\selectfont} % "qhv" - TeX Gyre Heros, "b" - bold
  66. {}
  67. {0em}
  68. {\hspace{-0.4pt}\Large \thesection\hspace{0.6em}}
  69.  
  70. \titleformat{\subsection}{
  71. \usefont{T1}{qhv}{b}{n}\selectfont} % "qhv" - TeX Gyre Heros, "b" - bold
  72. {}
  73. {0em}
  74. {\hspace{-0.4pt}\large \thesubsection\hspace{0.6em}}
  75.  
  76. \titleformat{\subsubsection}{
  77. \usefont{T1}{qhv}{b}{n}\selectfont} % "qhv" - TeX Gyre Heros, "b" - bold
  78. {}
  79. {0em}
  80. {\thesubsubsection\hspace{0.6em}}
  81.  
  82. \renewcommand{\cfttoctitlefont} % ToC title
  83. {\usefont{T1}{qhv}{b}{n}\selectfont\huge}
  84. \renewcommand{\cftsecfont} % section titles
  85. {\usefont{T1}{bch}{b}{n}\selectfont}
  86. \renewcommand{\cftsubsecfont} % subsection titles
  87. {\usefont{T1}{bch}{m}{n}\selectfont}
  88. \renewcommand{\cftsecpagefont} % section page numbers
  89. {\cftsecfont}
  90. \renewcommand{\cftsubsecpagefont} % subsection page numbers
  91. {\cftsubsecfont}
  92. \setcounter{tocdepth}{2}
  93.  
  94. %Font Families -- https://math.ucsd.edu/~msharpe/RcntFnts.pdf
  95. \usepackage{textcomp}
  96. \usepackage{charter}
  97. %\usepackage[sb]{libertine}
  98. \usepackage[varqu,varl]{zi4}% inconsolata
  99. \usepackage[charter,vvarbb,scaled=1.05]{newtxmath} % bb from STIX
  100. %\usepackage[cal=boondoxo]{mathalfa} % mathcal
  101. %\useosf % osf for text, not math
  102. %\usepackage[supstfm=libertinesups,%
  103. %supscaled=1.2,%
  104. %raised=-.13em]{superiors}
  105.  
  106. % Allows fonts to be rescaled arbitrarily without error messages
  107. \usepackage{type1ec}
  108.  
  109. \renewcommand\epsilon{\varepsilon}
  110. %-----------------------
  111.  
  112.  
  113. % Useful math shorthand
  114. \newcommand{\N}{\mathbb{N}}
  115. \newcommand{\Z}{\mathbb{Z}}
  116. \newcommand{\R}{\mathbb{R}}
  117. \newcommand{\Q}{\mathbb{Q}}
  118. \newcommand{\C}{\mathbb{C}}
  119. \newcommand{\e}{\mathrm{e}}
  120. \newcommand{\T}{\mathcal{T}}
  121. \newcommand{\B}{\mathcal{B}}
  122. \newcommand{\normal}{\trianglelefteq}
  123.  
  124. \DeclareMathOperator{\aut}{Aut}
  125. \DeclareMathOperator{\im}{im}
  126. \let\ker\relax
  127. \DeclareMathOperator{\ker}{ker}
  128. \DeclareMathOperator{\lcm}{lcm}
  129.  
  130.  
  131. \newcommand\blankpage{%
  132. \null
  133. \thispagestyle{empty}%
  134. \addtocounter{page}{-1}%
  135. \newpage}
  136.  
  137. %CODE WILL NOT EXECUTE - OLD ENVIRONMENTS
  138. \iffalse
  139. \ExplSyntaxOn
  140. \NewDocumentEnvironment{definition} { o }
  141. { \begin{trivlist}
  142. \item \IfNoValueTF{#1} {{\fontfamily{qhv}\selectfont\textbf{\small Definition.}}\hskip
  143. \labelsep}{{\fontfamily{qhv}\selectfont\textbf{\small Definition~(#1).}}\hskip
  144. \labelsep}
  145. \ignorespaces
  146. }
  147. {\end{trivlist}}
  148. \ExplSyntaxOff
  149.  
  150. \newenvironment{definition}[2][Definition]{\begin{trivlist}
  151. \item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries (#2).}]}{\end{trivlist}}
  152. \newenvironment{theorem}[2][Theorem]{\begin{trivlist}
  153. \item[\hskip \labelsep {{\fontfamily{qhv}\selectfont \small \bfseries #1}}\hskip \labelsep
  154. {{\fontfamily{qhv}\selectfont \small \bfseries #2.}}]\itshape}{\end{trivlist}}
  155. \newenvironment{corollary}[2][Corollary]{\begin{trivlist}
  156. \item[\hskip \labelsep {{\fontfamily{qhv}\selectfont \small \bfseries #1}}\hskip \labelsep
  157. {{\fontfamily{qhv}\selectfont \small \bfseries #2.}}]\itshape}{\end{trivlist}}
  158. \newenvironment{lemma}[2][Lemma]{\begin{trivlist}
  159. \item[\hskip \labelsep {{\fontfamily{qhv}\selectfont \small \bfseries #1}}\hskip \labelsep
  160. {{\fontfamily{qhv}\selectfont \small \bfseries #2.}}] \itshape}{\end{trivlist}}
  161. \newenvironment{remark}[1][Remark]{\begin{trivlist}
  162. \item[\hskip \labelsep {{\fontfamily{qhv}\selectfont \small \itshape #1.}}]}{\end{trivlist}}
  163. \newenvironment{prop}[2][Proposition]{\begin{trivlist}
  164. \item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
  165. \newenvironment{exercise}[2][Exercise]{\begin{trivlist}
  166. \item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
  167. \newenvironment{problem}[2][Problem]{\begin{trivlist}
  168. \item[\hskip \labelsep {{\fontfamily{qhv}\selectfont\small\bfseries #1}}\hskip \labelsep
  169. {{\fontfamily{qhv}\selectfont\small\bfseries #2.}}]}{\medskip \end{trivlist}}
  170. \newenvironment{question}[2][Question]{\begin{trivlist}
  171. \item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
  172. \newenvironment{solution}[1][Solution.]{\begin{trivlist}
  173. \item[\hskip \labelsep {\fontfamily{qhv}\selectfont \small {\bfseries #1}}]}{\qed \end{trivlist}}
  174. \fi
  175. %%
  176.  
  177. \newtheoremstyle{plainqhv}%
  178. {}% space above
  179. {}% space below
  180. {\itshape}% body font
  181. {}% indent amount
  182. {\fontfamily{qhv}\bfseries\small}% theorem head font
  183. {.}% punctuation after theorem head
  184. {.5em}% space after theorem head
  185. {\thmname{#1}\thmnumber{ #2}\thmnote{\normalfont\normalsize\ (#3)}}% theorem head spec (can be left empty, meaning 'normal')
  186.  
  187. \newtheoremstyle{definitionqhv}%
  188. {}% space above
  189. {}% space below
  190. {}% body font
  191. {}% indent amount
  192. {\fontfamily{qhv}\bfseries\small}% theorem head font
  193. {.}% punctuation after theorem head
  194. {.5em}% space after theorem head
  195. {\thmname{#1}\thmnumber{ #2}\thmnote{\normalfont\normalsize\ (#3)}}% theorem head spec (can be left empty, meaning 'normal')
  196.  
  197. \newtheoremstyle{remarkqhv}%
  198. {}% space above
  199. {}% space below
  200. {}% body font
  201. {}% indent amount
  202. {\itshape}% theorem head font
  203. {.}% punctuation after theorem head
  204. {.5em}% space after theorem head
  205. {\thmname{#1}\thmnumber{ #2}\thmnote{ #3}}% theorem head spec (can be left empty, meaning 'normal')
  206.  
  207. \theoremstyle{plainqhv}
  208. \newtheorem{theorem}{Theorem}[section]
  209. \newtheorem{lemma}[theorem]{Lemma}
  210. \newtheorem{corollary}[theorem]{Corollary}
  211. \newtheorem{proposition}[theorem]{Proposition}
  212.  
  213. \theoremstyle{definitionqhv}
  214. \newtheorem{definition}[theorem]{Definition}
  215. \newtheorem{problem}{Problem}
  216. \newtheorem{example}[theorem]{Example}
  217. \newtheorem*{observation}{Observation}
  218.  
  219. \theoremstyle{remarkqhv}
  220. \newtheorem*{remark}{Remark}
  221. \newtheorem*{note}{Note}
  222. \newtheorem*{case}{Case}
  223. \newtheorem{Claim}{Claim}[problem]
  224. \newtheorem{ClaimI}{Claim}[Claim]
  225. \newtheorem{ClaimII}{Claim}[ClaimI]
  226. \newtheorem{ClaimIII}{Claim}[ClaimII]
  227. \newcounter{claimlevel}[theorem]
  228.  
  229. % nested claims --
  230. % https://tex.stackexchange.com/questions/306016/theorem-and-subtheorem-hierarchical-numbering
  231. \ExplSyntaxOn
  232. \NewDocumentEnvironment{claim}{O{=}}
  233. {
  234. \str_case:nn { #1 }
  235. {
  236. {=} { }
  237. {+} { \stepcounter{claimlevel} }
  238. {-} { \addtocounter{claimlevel}{-1} }
  239. {--} { \addtocounter{claimlevel}{-2} }
  240. {---}{ \addtocounter{claimlevel}{-3} }
  241. }
  242. \begin{ Claim \int_to_Roman:n { \value{claimlevel} } }
  243. }
  244. {
  245. \end{ Claim \int_to_Roman:n { \value{claimlevel} } }
  246. }
  247. \ExplSyntaxOff
  248.  
  249. % Sensible theorem numbering according to chapter/section/subsection.
  250. \renewcommand{\thetheorem}{%
  251. \ifnum\value{section}=0
  252. \thechapter% "no section"
  253. \else
  254. \ifnum\value{subsection}=0
  255. \thesection{.}% "no subsection"
  256. \else
  257. \thesubsection{.}% "within a subsection"
  258. \fi
  259. \fi%
  260. \arabic{theorem}}
  261.  
  262. %Define solution and proof environments.
  263. \makeatletter
  264. \newenvironment{solution}{\par
  265. \pushQED{\qed}%
  266. \normalfont \topsep6\p@\@plus6\p@\relax
  267. \trivlist
  268. \item\relax
  269. {\fontfamily{qhv}\small\textbf
  270. {Solution}\@addpunct{.}}\hspace\labelsep\ignorespaces
  271. }{%
  272. \popQED\endtrivlist\@endpefalse
  273. }
  274. \renewenvironment{proof}[1][\proofname]{\par
  275. \renewcommand\qedsymbol{$\blacksquare$}
  276. \pushQED{\qed}%
  277. \normalfont \topsep6\p@\@plus6\p@\relax
  278. \trivlist
  279. \item\relax
  280. {\itshape
  281. #1\@addpunct{.}}\hspace\labelsep\ignorespaces
  282. }{%
  283. \popQED\endtrivlist\@endpefalse
  284. }
  285. \makeatother
  286.  
  287. % Giles Castel Inkscape Figure Manager
  288. % https://castel.dev/post/lecture-notes-2/
  289. \usepackage{import}
  290. \usepackage{pdfpages}
  291. \usepackage{transparent}
  292. \usepackage{xcolor}
  293. \usepackage{xifthen}
  294.  
  295. \newcommand{\incfig}[1]{%
  296. \def\svgwidth{\columnwidth}
  297. \import{./figures/}{#1.pdf_tex}
  298. }
  299. \pdfsuppresswarningpagegroup=1
  300.  
  301. \newcommand{\homework}[3]{%
  302. \author{Kogasa}
  303. \date{#2}
  304. \title{\vspace{-3em}#3\\Homework #1}
  305. \lhead{#3}
  306. \chead{Homework #1}
  307. \rhead{\theauthor}
  308. \pagestyle{fancy}
  309. }
  310.  
  311. \usepackage{xifthen}
  312. \def\testdateparts#1{\dateparts#1\relax}
  313. \def\dateparts#1 #2 #3 #4 #5\relax{
  314. \marginpar{\small\textsf{\mbox{#1 #2 #3 #5}}}
  315. }
  316.  
  317. \def\@lecture{}%
  318. \newcommand{\lecture}[3]{
  319. \ifthenelse{\isempty{#3}}{%
  320. \def\@lecture{Lecture #1}%
  321. }{%
  322. \def\@lecture{Lecture #1: #3}%
  323. }%
  324. \subsection*{\@lecture}
  325. \marginpar{\small\textsf{\mbox{#2}}}
  326. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement