From 1204f24aa0cc8a8f72ce5ecffa8b1f35480e6e6d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 22 Apr 2020 20:51:16 +0000 Subject: willowtreebook (22apr20) git-svn-id: svn://tug.org/texlive/trunk@54839 c570f23f-e606-0410-a88d-b1316a301751 --- .../tex/latex/willowtreebook/willowtreebook.cls | 618 +++++++++++++++++++++ 1 file changed, 618 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/willowtreebook/willowtreebook.cls (limited to 'Master/texmf-dist/tex/latex/willowtreebook') diff --git a/Master/texmf-dist/tex/latex/willowtreebook/willowtreebook.cls b/Master/texmf-dist/tex/latex/willowtreebook/willowtreebook.cls new file mode 100644 index 00000000000..61964a97fb9 --- /dev/null +++ b/Master/texmf-dist/tex/latex/willowtreebook/willowtreebook.cls @@ -0,0 +1,618 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{willowtreebook}[2020/04/22 Willow Tree book LaTeX class v1.0] +\DeclareOption{ContainsChinese}{\def\ChineseTextInThisDocument{}} +\DeclareOption*{% +\PassOptionsToClass{\CurrentOption}{article}% +} +\ProcessOptions\relax + +\LoadClass{memoir} + +\RequirePackage{xparse} + +\def\emptystring{} + +\edef\mckaybook@title{\emptystring} +\edef\mckaybook@subtitle{\emptystring} +\edef\mckaybook@author{\emptystring} +\edef\mckaybook@bibliography{\emptystring} +\edef\mckaybook@colophon{This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.} + +\NewDocumentCommand\Title{m}{\global\def\mckaybook@title{#1}} +\NewDocumentCommand\Subtitle{m}{\global\def\mckaybook@subtitle{#1}} +\NewDocumentCommand\Author{m}{\global\def\mckaybook@author{#1}} +\NewDocumentCommand\BibliographyFile{m}{\global\def\mckaybook@bibliography{#1}} +\NewDocumentCommand\Colophon{m}{\global\def\mckaybook@colophon{#1}} + +% For handling names like Benjamin McKay, where the letter c should be raised up, type in as Benjamin \scotsMc{}Kay. +\makeatletter +\DeclareRobustCommand{\scotsMc}{\scotsMcx{c}} +\DeclareRobustCommand{\scotsMC}{\scotsMcx{\textsc{c}}} +\DeclareRobustCommand{\scotsMcx}[1]{% + M% + \raisebox{\dimexpr\fontcharht\font`M-\height}{% + \check@mathfonts\fontsize{\sf@size}{0}\selectfont + \kern.3ex\underline{\kern-.3ex #1\kern-.3ex}\kern.3ex + }% +} +\expandafter\def\expandafter\@uclclist\expandafter{% + \@uclclist\scotsMc\scotsMC +} +\makeatother + +\RequirePackage{etex} +\RequirePackage{newunicodechar} +\RequirePackage[utf8]{inputenc} % Default input file encoding +\ifdefined\ChineseTextInThisDocument +\RequirePackage{CJKutf8} +\let\I\relax +\NewDocumentCommand\Chinese{m}{\begin{CJK*}{UTF8}{gbsn}#1\end{CJK*}} +\else +\fi + +\RequirePackage[T1]{fontenc} +\RequirePackage{lmodern} +\RequirePackage{isomath} +\RequirePackage[tt=lining]{cfr-lm} +\RequirePackage[mathscr]{eucal} +\RequirePackage[% +activate={true,nocompatibility},% +final,% +tracking=true,% +kerning=true,% +spacing=true,% +factor=1100,% +stretch=10,% +shrink=10]{microtype} +\microtypecontext{spacing=nonfrench} +\usepackage{embrac} % fixes parentheses and brackets in italic text. +\RequirePackage{amsmath} +\RequirePackage{amsthm} +\RequirePackage{amssymb} +\RequirePackage{braket} +\RequirePackage{mathtools} +\mathtoolsset{showonlyrefs,showmanualtags,centercolon,mathic} + +% If we need more room between rows of matrices and arrays, we can write +% \begin{pmatrix}[1.5] +% instead of +% \begin{pmatrix} +\makeatletter +\RenewDocumentCommand\env@matrix{O{\arraystretch}} +{% +\edef\arraystretch{#1}% + \hskip -\arraycolsep + \let\@ifnextchar\new@ifnextchar + \array{*\c@MaxMatrixCols c} +}% +\makeatother +\NewDocumentCommand\tallmatrix{}{1.5} + +\RequirePackage{varioref} +\RequirePackage{longtable} +\RequirePackage{multicol} +\setmarginnotes{2em}{3cm}{.5cm} + +% Indices +\newcommand{\NotationIndexName}{List of notation} +\makeindex +\makeglossary[not] +\changeglossnum[not]{\thepage} +\changeglossnumformat[not]{|hyperpage} +\renewcommand*{\glossaryname}{\NotationIndexName} +\renewcommand*{\glossarymark}{\markboth{\glossaryname}{}} +\renewcommand{\begintheglossaryhook} +{% +\begin{longtable}[c]{lp{9cm}}% +\endfirsthead% +\endhead% +\endfoot% +\endlastfoot% +}% +\renewcommand{\atendtheglossaryhook} +{% +\end{longtable}% +}% +\renewcommand{\glossitem}[4]{#1 & #2, #4 \\[4pt]} +\renewcommand{\glossaryspace}{} +\newcommand{\paddedpagenumber}% +% Returns the current page number, zero padded, +% so page 3 is 003, page 12 is 012, page 101 is 101 +{%% +\ifnum\value{page}<100 0\fi% +\ifnum\value{page}<10 0\fi% +\arabic{page}% +}%% + +\newcounter{howmany@notation} +\setcounter{howmany@notation}{0} +\newcommand{\Notation}[3]%% +%%use: \Notation{Nonmathmode token for comparing}{math mode expression}{description} +{\glossary[not](\paddedpagenumber){\(#2\)}{#3}% +\stepcounter{howmany@notation}% +} + +\newcounter{howmany@indexentries} +\setcounter{howmany@indexentries}{0} +\newcommand{\SubIndex}[1]% +{% +\stepcounter{howmany@indexentries}% +\index{#1}% +}% +% There is a serious problem with Notation. You can't +% use absolute value signs or floor or ceiling signs anywhere. Replace them +% with the following: +\newcommand{\leftAbs}{\left"|} +\newcommand{\rightAbs}{\right"|} +\newcommand{\leftDoubleAbs}{"| "| } +\newcommand{\rightDoubleAbs}{"| "| } +\newcommand{\normNotation}[1]{\leftDoubleAbs#1\rightDoubleAbs} +\newcommand{\orderForNotationIndex}[1]{\leftAbs{#1}\rightAbs} +\newcommand{\lengthForNotationIndex}[1]{\leftDoubleAbs{#1}\rightDoubleAbs} +\newcommand{\normForNotationIndex}[1]{\leftDoubleAbs{#1}\rightDoubleAbs} +\newcommand{\lcl}{ +\rule[-2.5pt]{.4pt}{1em} +\rule[6.4pt]{2pt}{.4pt} +} +\newcommand{\rcl}{ +\rule[6.4pt]{2pt}{.4pt} +\rule[-2.5pt]{.4pt}{1em} +} +\newcommand{\lflr}{ +\rule[-2.5pt]{.4pt}{1em} +\rule[-2.5pt]{2pt}{.4pt} +} +\newcommand{\rflr}{ +\rule[-2.5pt]{2pt}{.4pt} +\rule[-2.5pt]{.4pt}{1em} +} +\newcommand{\ceilForNotationIndex}[1]{\lcl{#1}\rcl} +\newcommand{\floorForNotationIndex}[1]{\lflr{#1}\rflr} + +% For the subject index: +% Example: +% \define{interest rate} +% puts into the Subject index a reference +% to the current page saying that this is +% where the term ``interest rate'' is defined. +\newcommand{\FancyIndexEntry}[1]{\emph{\textbf{\hyperpage{#1}}}} +\newcommand{\define}[1] +{% +\stepcounter{howmany@indexentries}% +\index{#1|FancyIndexEntry}% +}% +%% PDF Output +\ifpdf + \pdfoutput=1 + \makeatletter + \RequirePackage[plainpages=false, + hyperfigures, + pdftitle={\mckaybook@title}, + pdfauthor={\mckaybook@author}, + colorlinks=true, + pdfpagelabels=true, + bookmarksnumbered, + hidelinks, + pagebackref, + pdftex] + {hyperref} + \makeatother + \RequirePackage{memhfixc} +% Hyperref uses very bright colours to highlight links. Change them: + \RequirePackage[svgnames]{xcolor} + \definecolor{dark-red}{rgb}{0.4,0.15,0.15} + \definecolor{dark-blue}{rgb}{0.15,0.15,0.4} + \definecolor{medium-blue}{rgb}{0,0,0.5} + \hypersetup{ + colorlinks, linkcolor={dark-red}, + citecolor={dark-blue}, urlcolor={medium-blue} + } +\fi + +\newcommand{\idxmark}[1]{#1\markboth{#1}{#1}} +\newcommand{\doidxbookmark}[1]{{\def\@tempa{Symbols}\def\@tempb{#1}% +\ifx\@tempa\@tempb % +Analphabetics +\phantomsection% +\pdfbookmark[0]{Analphabetics}{Analphabetics-idx}% +\else +#1% +\phantomsection% +\pdfbookmark[0]{#1}{#1-idx}% +\fi% +\vskip\onelineskip\par}} + +\newcommand\doglobookmark[1]{% +}% + +%......Figures +\newcommand{\stdFigSize}{1in} +\newsubfloat{figure} % Memoir class, instead of subfigure class. +\let\subfigure\subbottom +\newcommand{\subfigcapskip}{3em} +\setfloatadjustment{figure}{\scriptsize\centering} +\setfloatadjustment{marginfigure}{\scriptsize\centering} +\setmpjustification{\scriptsize\RaggedLeft}{\scriptsize\RaggedRight} +\captionnamefont{\scriptsize} +\captiontitlefont{\scriptsize} +\newcommand{\heading}{\sffamily} + +\newcommand{\chapterSummary}[1]{{\small{#1}}\vspace{0.5cm}\par\noindent} + +\makechapterstyle{bobo}{% +\aliaspagestyle{part}{empty} +\renewcommand{\partnamefont}{\raggedleft\normalfont\huge\heading} +\renewcommand{\partnumfont}{\normalfont\huge\heading} +\renewcommand{\printpartnum}{} +\renewcommand{\partname}{} +\renewcommand*{\parttitlefont}{\huge\heading} +\setlength{\beforechapskip}{0pt} +\renewcommand*{\chapnamefont}{\large\centering} +\renewcommand*{\chapnumfont}{\large} +\renewcommand*{\printchapternonum}{% +\vphantom{\printchaptername}% +\vphantom{\chapnumfont 1}% +\afterchapternum} +\renewcommand*{\chaptitlefont}{\Large\heading} +\renewcommand*{\printchaptertitle}[1]{% +\centering\smallcolouredbox\chaptitlefont ##1}} + +\chapterstyle{bobo} + +\setsecheadstyle{\large\heading\raggedright} +\setsubsecheadstyle{\heading\raggedright} +\setsubsubsecheadstyle{\heading\raggedright} +\setheadfoot{2\onelineskip}{3\onelineskip} + +\newcommand{\optionalSection}[1]% +{%% +\section{#1} +{\small{This section can be omitted without loss of continuity.}}% +\medskip\par\noindent% +}%% + +%......Table of contents +% depth of numbering of sectioning commands: +\setsecnumdepth{chapter} +\maxsecnumdepth{chapter} +%% depth of table of contents: +\setcounter{tocdepth}{0} + +\RenewDocumentCommand\cftpartfont{}{\heading\small} +\RenewDocumentCommand\cftpartpagefont{}{\normalfont\small} + +\RenewDocumentCommand\cftchapterfont{}{\heading\small} +\RenewDocumentCommand\cftchapterpagefont{}{\normalfont\small} + +\setlength{\cftbeforechapterskip}{3pt} +\RenewDocumentCommand\cftchapterleader{}{\quad} +\setpnumwidth{1em} +\RenewDocumentCommand\cftchapterafterpnum{}{\cftparfillskip} + +\setlength{\cftbeforepartskip}{10pt} +\RenewDocumentCommand\cftpartleader{}{\quad} +\setpnumwidth{1em} +\RenewDocumentCommand\cftpartafterpnum{}{\cftparfillskip} + + +%......Title page +\pretitle{\begin{center}\HUGE} +\posttitle{\end{center}} +\preauthor{\vspace{2cm}\begin{center}} +\postauthor{\end{center}} +\predate{\begin{center}} +\postdate{\end{center}} + +\usepackage{tcolorbox} +\tcbuselibrary{breakable} +\tcbuselibrary{skins} + +%......Theorem Styles +%\newtheoremstyle{RegularStyle}% name +% {}% Space above, empty = `usual value' +% {}% Space below +% {\normalfont}% Body font +% {}% Indent amount (empty = no indent, \parindent = para indent) +% {\normalfont\scshape}% Thm head font +% {.}% Punctuation after thm head +% {.5em}% Space after thm head: " " = normal interword space; +% % \newline = linebreak +% {} % {\thmnote{#3}}% Thm head spec +%\theoremstyle{RegularStyle} +%{% +\newtheorem{theorem}{Theorem}[chapter] +\newtheorem{lemma}[theorem]{Lemma} +\newtheorem{corollary}[theorem]{Corollary} +\newtheorem{proposition}[theorem]{Proposition} + +\colorlet{exampleBackgroundColour}{gray!16} + +\newtcolorbox{example}{% +enhanced,% +breakable,% +colback=gray!16,% +colframe=gray!22,% +leftrule=1.4pt,% +toprule=1.4pt,% +bottomrule=1.4pt,% +rightrule=1.4pt,% +arc=3mm,% +before upper={\parindent15pt\noindent}% +} +\newenvironment{exampleAndImage}[1]% +{% +\begin{tcolorbox}[enhanced,% +breakable,% +colback=gray!16,% +colframe=gray!22,% +leftrule=1.4pt,% +toprule=1.4pt,% +bottomrule=1.4pt,% +rightrule=1.4pt,% +arc=3mm,% +sidebyside,% +lower separated=false,% +righthand width=#1,% +before upper={\parindent15pt\noindent}% +]% +}% +{% +\end{tcolorbox}% +}% +\NewDocumentEnvironment{examples}{}{% +\begin{example}% +\begin{itemize}}% +{\end{itemize}% +\end{example}} + +% In the middle of an example, the background color is not white. If you need a white background to put an image on it, it looks best to use an imageborderinexample. +\definecolor{image-border-color}{gray}{.975} +\NewDocumentCommand\imageborderinexample{m}{\begin{center}\tcbox[colframe=image-border-color, colback=white] +{#1}\end{center}} +\NewDocumentCommand\includegraphicsinexample{om}% +{\IfValueTF{#1}{\imageborderinexample{\includegraphics[#1]{#2}}}{\imageborderinexample{\includegraphics{#2}}}} +\NewDocumentCommand\inputinexample{m}{\imageborderinexample{\input{#1}}} + + +%......Problems +% To define a new problem, use: +% \begin{problem}{