| 1 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 2 |
% |
| 3 |
% Personal helper theme for package documentations |
| 4 |
% Copyright samcarter |
| 5 |
% |
| 6 |
% This file may be distributed and/or modified |
| 7 |
% under the LaTeX Project Public License 1.3c or later |
| 8 |
% |
| 9 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 10 |
|
| 11 |
% Usage: |
| 12 |
% ln ~/Life/latex/beamertheme-sam/themesam.sty package-doc-settings.sty |
| 13 |
% \usepackage[ |
| 14 |
% themecolor=samdblue |
| 15 |
% ]{\jobname-settings} |
| 16 |
|
| 17 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 18 |
% |
| 19 |
% Colours |
| 20 |
% |
| 21 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 22 |
\RequirePackage{xcolor} |
| 23 |
\definecolor{samyellow}{RGB}{246,193,65} |
| 24 |
\definecolor{samorange}{RGB}{241,147,45}% pgfplotsthemebeamer |
| 25 |
\definecolor{samred}{RGB}{191,26,46}% TikZbricks |
| 26 |
\definecolor{sammagenta}{RGB}{170,42,104}% TikZmarmots |
| 27 |
\definecolor{samviolet}{RGB}{136,46,114}% TikZlings |
| 28 |
\definecolor{samlila}{RGB}{101,67,159}% Rainbow beamer theme |
| 29 |
\definecolor{samdblue}{RGB}{0,51,134}% beamer theme |
| 30 |
\definecolor{samlblue}{RGB}{22,89,155}% TikZducks |
| 31 |
\definecolor{samteal}{RGB}{25,143,157}% Tcolorbox beamer theme |
| 32 |
\definecolor{samlgreen}{RGB}{68,170,153}% Jigsaw |
| 33 |
\definecolor{samdgreen}{RGB}{78,178,125} |
| 34 |
\definecolor{samlgray}{RGB}{160,160,185} |
| 35 |
\definecolor{samdgray}{RGB}{60,60,85} |
| 36 |
|
| 37 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 38 |
% |
| 39 |
% Package options |
| 40 |
% |
| 41 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 42 |
\RequirePackage{xkeyval} |
| 43 |
\DeclareOptionX{themecolor}[samdblue]{\colorlet{themecolor}{#1}} |
| 44 |
\DeclareOptionX{listingcolor}[samlblue]{\colorlet{listingcolor}{#1}} |
| 45 |
\ExecuteOptionsX{themecolor,listingcolor} |
| 46 |
\ProcessOptionsX |
| 47 |
|
| 48 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 49 |
% |
| 50 |
% Packages |
| 51 |
% |
| 52 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 53 |
\@ifclassloaded{beamer}{}{% |
| 54 |
\RequirePackage[english]{babel} |
| 55 |
\RequirePackage[paper=a4paper,margin=2.9cm]{geometry} |
| 56 |
\RequirePackage{scrlayer-scrpage} |
| 57 |
\let\hrulefillx\hrulefill |
| 58 |
\RequirePackage[bitstream-charter]{mathdesign} |
| 59 |
\let\hrulefill\hrulefillx |
| 60 |
\RequirePackage[hang,flushmargin,bottom]{footmisc} |
| 61 |
\RequirePackage{footnotehyper} |
| 62 |
\makesavenoteenv{tcolorbox} |
| 63 |
\RequirePackage[all]{nowidow} |
| 64 |
\RequirePackage[colorlinks=true,breaklinks=true,allcolors=themecolor,hyperfootnotes=false]{hyperref} |
| 65 |
} |
| 66 |
\RequirePackage[T1]{fontenc} |
| 67 |
\RequirePackage{xspace} |
| 68 |
\RequirePackage{inconsolata}% mono font with bold, but italic is missing |
| 69 |
% \RequirePackage[scale=0.85]{cascadia-code} |
| 70 |
% \AddToHook{cmd/ttfamily/before}{\fontseries{sl}} |
| 71 |
\usepackage{synthslant}% to fake slented comments in inconsolata |
| 72 |
|
| 73 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 74 |
% |
| 75 |
% Listings |
| 76 |
% |
| 77 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 78 |
\RequirePackage[cachedir=./.minted]{minted} |
| 79 |
|
| 80 |
\AddToHook{env/MintedVerbatim/before}{% |
| 81 |
% optional arguments |
| 82 |
\@namedef{PYG@tok@na}{\def\PYG@tc##1{\textcolor{black}{##1}}}% |
| 83 |
% macros |
| 84 |
\@namedef{PYG@tok@k}{\def\PYG@tc##1{\textcolor{listingcolor}{\bfseries ##1}}}% |
| 85 |
% curly brakets |
| 86 |
\@namedef{PYG@tok@nb}{\def\PYG@tc##1{\textcolor{listingcolor}{\bfseries ##1}}}% |
| 87 |
% comments (italics won't work with the inconsolata font) |
| 88 |
\@namedef{PYG@tok@c}{\def\PYG@tc##1{\textcolor{gray}{\textsynthslant{##1}}}}% |
| 89 |
} |
| 90 |
|
| 91 |
\usemintedstyle{default} |
| 92 |
\setminted{ |
| 93 |
breaksymbolleft={}, |
| 94 |
tabsize=2, |
| 95 |
breaklines=true, |
| 96 |
} |
| 97 |
\newminted[samcode]{latex}{} |
| 98 |
\newmintinline[saminline]{latex}{} |
| 99 |
|
| 100 |
% use non-bold and all coloured for inline code in articles |
| 101 |
\ifdefined\insertaspectratio\else |
| 102 |
\patchcmd{\minted@inputpyg@inline}{\minted@input}{\color{listingcolor}\renewcommand\textcolor[3][]{##3}\renewcommand\bfseries{}\minted@input}{}{} |
| 103 |
\fi |
| 104 |
|
| 105 |
\RequirePackage[most]{tcolorbox} |
| 106 |
\tcbuselibrary{minted} |
| 107 |
\tcbset{% |
| 108 |
colframe=themecolor, |
| 109 |
fonttitle=\bfseries, |
| 110 |
sidebyside, |
| 111 |
center lower, |
| 112 |
righthand width=5.7cm, |
| 113 |
bottom=2pt, |
| 114 |
top=2pt, |
| 115 |
left=3pt, |
| 116 |
right=3pt, |
| 117 |
sidebyside gap=10pt, |
| 118 |
lower separated=false, |
| 119 |
listing engine=minted, |
| 120 |
minted language=latex, |
| 121 |
colback=themecolor!10, |
| 122 |
sharp corners, |
| 123 |
boxrule=0pt, |
| 124 |
before title={\strut} |
| 125 |
} |
| 126 |
|
| 127 |
% avoid page breaks right in front of the tcolorbox |
| 128 |
\@ifclassloaded{beamer}{}{ |
| 129 |
\tcbuselibrary{hooks} |
| 130 |
\tcbset{before pre={\nopagebreak[4]}} |
| 131 |
} |
| 132 |
|
| 133 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 134 |
% |
| 135 |
% document settings |
| 136 |
% |
| 137 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 138 |
\@ifclassloaded{scrartcl}{% |
| 139 |
\KOMAoptions{parskip=half} |
| 140 |
\addtokomafont{sectioning}{\color{themecolor}} |
| 141 |
\addtokomafont{date}{\normalsize} |
| 142 |
\addtokomafont{author}{\normalsize} |
| 143 |
\setlength{\footnotemargin}{0.7em} |
| 144 |
}{} |
| 145 |
|
| 146 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 147 |
% |
| 148 |
% Custom macros |
| 149 |
% |
| 150 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 151 |
\providecommand*{\CTAN}{\textsc{CTAN}\xspace} |
| 152 |
\providecommand*{\TikZ}{Ti\emph{k}Z\xspace} |
| 153 |
\providecommand*{\miktex}{MiK\TeX\xspace} |
| 154 |
\providecommand*{\texlive}{\TeX{}Live\xspace} |
| 155 |
\providecommand*{\tikzbrick}{Ti\emph{k}Zbrick\xspace} |
| 156 |
\providecommand*{\tikzducks}{Ti\emph{k}Zducks\xspace} |
| 157 |
\providecommand*{\tikzlings}{Ti\emph{k}Zlings\xspace} |
| 158 |
\providecommand*{\tikzmarmots}{Ti\emph{k}Zmarmots\xspace} |
| 159 |
\providecommand*{\ConTeXt}{C\kern-.0333emon\-\kern-.0667em\TeX\kern-.0333emt} |