| 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} |
| 25 |
\definecolor{samred}{RGB}{191,26,46} |
| 26 |
\definecolor{sammagenta}{RGB}{170,42,104} |
| 27 |
\definecolor{samviolet}{RGB}{136,46,114} |
| 28 |
\definecolor{samlila}{RGB}{101,67,159} |
| 29 |
\definecolor{samdblue}{RGB}{38,38,139} |
| 30 |
\definecolor{samlblue}{RGB}{22,89,155} |
| 31 |
\definecolor{samteal}{RGB}{25,143,157} |
| 32 |
\definecolor{samlgreen}{RGB}{68,170,153} |
| 33 |
\definecolor{samdgreen}{RGB}{78,178,125} |
| 34 |
\definecolor{samlgray}{RGB}{160,160,185} |
| 35 |
\definecolor{samdgray}{RGB}{60,60,85} |
| 36 |
|
| 37 |
\newcommand{\samcolours}{ |
| 38 |
\foreach \sam@col/\sam@pkg in { |
| 39 |
samyellow/???, |
| 40 |
samorange/Pgfplots, |
| 41 |
samred/TikZbricks, |
| 42 |
sammagenta/TikZmarmots, |
| 43 |
samviolet/TikZlings, |
| 44 |
samlila/Rainbow, |
| 45 |
samdblue/Spectrum, |
| 46 |
samlblue/TikZducks, |
| 47 |
samteal/Tcolorbox, |
| 48 |
samlgreen/Jigsaw, |
| 49 |
samdgreen/???, |
| 50 |
samlgray/Cistercian, |
| 51 |
samdgray/Panda% |
| 52 |
}{ |
| 53 |
\begingroup |
| 54 |
\color{\sam@col}% |
| 55 |
\makebox[0cm][l]{\rule[-0.9cm]{2.5cm}{2cm}}% |
| 56 |
\endgroup |
| 57 |
\parbox[c][2cm]{2.5cm}{\bfseries\color{white}\centering \sam@col\\\sam@pkg}% |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 62 |
% |
| 63 |
% Package options |
| 64 |
% |
| 65 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 66 |
\RequirePackage{xkeyval} |
| 67 |
\DeclareOptionX{themecolor}[samdblue]{\colorlet{themecolor}{#1}} |
| 68 |
\DeclareOptionX{listingcolor}[samlblue]{\colorlet{listingcolor}{#1}} |
| 69 |
\ExecuteOptionsX{themecolor,listingcolor} |
| 70 |
\ProcessOptionsX |
| 71 |
|
| 72 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 73 |
% |
| 74 |
% Packages |
| 75 |
% |
| 76 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 77 |
\@ifclassloaded{scrartcl}{% |
| 78 |
\RequirePackage[english]{babel} |
| 79 |
\RequirePackage[paper=a4paper,margin=2.9cm]{geometry} |
| 80 |
\RequirePackage{scrlayer-scrpage} |
| 81 |
\let\hrulefillx\hrulefill |
| 82 |
\RequirePackage[bitstream-charter]{mathdesign} |
| 83 |
\let\hrulefill\hrulefillx |
| 84 |
\RequirePackage[hang,flushmargin,bottom]{footmisc} |
| 85 |
\RequirePackage{footnotehyper} |
| 86 |
\makesavenoteenv{tcolorbox} |
| 87 |
\RequirePackage[all]{nowidow} |
| 88 |
\RequirePackage[hyphens]{url} |
| 89 |
\RequirePackage[colorlinks=true,breaklinks=true,allcolors=themecolor,hyperfootnotes=false]{hyperref} |
| 90 |
}{} |
| 91 |
\RequirePackage[T1]{fontenc} |
| 92 |
\RequirePackage{xspace} |
| 93 |
\RequirePackage{inconsolata}% mono font with bold, but italic is missing |
| 94 |
\@ifclassloaded{scrartcl}{% |
| 95 |
\RequirePackage[scale=0.85]{cascadia-code} |
| 96 |
% \AddToHook{cmd/ttfamily/before}{\fontseries{sl}} |
| 97 |
}{} |
| 98 |
\RequirePackage{synthslant}% to fake slanted comments in inconsolata |
| 99 |
\RequirePackage{metalogox}% should be loaded after the fonts |
| 100 |
\@ifclassloaded{scrartcl}{}{% |
| 101 |
\RequirePackage{lmodern} |
| 102 |
\renewcommand{\ttdefault}{lmtt} |
| 103 |
\graphicspath{{./include}} |
| 104 |
} |
| 105 |
\RequirePackage{iftex} |
| 106 |
|
| 107 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 108 |
% |
| 109 |
% Listings |
| 110 |
% |
| 111 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 112 |
\RequirePackage[cachedir=./.minted]{minted} |
| 113 |
|
| 114 |
\AddToHook{env/MintedVerbatim/before}{% |
| 115 |
% optional arguments |
| 116 |
\@namedef{PYG@tok@na}{\def\PYG@tc##1{\textcolor{black}{##1}}}% |
| 117 |
% macros |
| 118 |
\@namedef{PYG@tok@k}{\def\PYG@tc##1{\textcolor{listingcolor}{\bfseries ##1}}}% |
| 119 |
% curly brackets |
| 120 |
\@namedef{PYG@tok@nb}{\def\PYG@tc##1{\textcolor{listingcolor}{\bfseries ##1}}}% |
| 121 |
% comments (italics won't work with the inconsolata font) |
| 122 |
\@namedef{PYG@tok@c}{\def\PYG@tc##1{\textcolor{gray}{\textsynthslant{##1}}}}% |
| 123 |
} |
| 124 |
|
| 125 |
\usemintedstyle{default} |
| 126 |
\setminted{ |
| 127 |
breaksymbolleft={}, |
| 128 |
tabsize=2, |
| 129 |
breaklines=true, |
| 130 |
} |
| 131 |
\newminted[samcode]{latex}{} |
| 132 |
\newmintinline[saminline]{latex}{} |
| 133 |
|
| 134 |
% use non-bold and all coloured for inline code in articles |
| 135 |
\@ifclassloaded{scrartcl}{% |
| 136 |
\patchcmd{\minted@inputpyg@inline}{\minted@input}{\color{listingcolor}\renewcommand\textcolor[3][]{##3}\renewcommand\bfseries{}\minted@input}{}{} |
| 137 |
}{} |
| 138 |
|
| 139 |
\RequirePackage[most]{tcolorbox} |
| 140 |
\tcbuselibrary{minted} |
| 141 |
\newcommand{\prefix}{./include} |
| 142 |
\tcbset{% |
| 143 |
colframe=themecolor, |
| 144 |
fonttitle=\bfseries, |
| 145 |
sidebyside, |
| 146 |
center lower, |
| 147 |
righthand width=5.7cm, |
| 148 |
bottom=2pt, |
| 149 |
top=2pt, |
| 150 |
left=3pt, |
| 151 |
right=3pt, |
| 152 |
sidebyside gap=10pt, |
| 153 |
lower separated=false, |
| 154 |
listing engine=minted, |
| 155 |
minted language=latex, |
| 156 |
colback=themecolor!10, |
| 157 |
sharp corners, |
| 158 |
boxrule=0pt, |
| 159 |
before title={\strut}, |
| 160 |
compilable listing/.style={listing file={\prefix/\jobname-listing-\thetcblistingcount.tex}}, |
| 161 |
compilable listing sam/.style={ |
| 162 |
listing and comment, |
| 163 |
pdf comment, |
| 164 |
freeze pdf, |
| 165 |
compilable listing, |
| 166 |
run latexmk={-g- -pdf -cd}, |
| 167 |
comment style={raster columns=1}, |
| 168 |
}, |
| 169 |
} |
| 170 |
|
| 171 |
% avoid page breaks right in front of the tcolorbox |
| 172 |
\@ifclassloaded{beamer}{}{ |
| 173 |
\tcbuselibrary{hooks} |
| 174 |
\tcbset{before pre={\nopagebreak[4]}} |
| 175 |
} |
| 176 |
|
| 177 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 178 |
% |
| 179 |
% document settings |
| 180 |
% |
| 181 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 182 |
\@ifclassloaded{scrartcl}{% |
| 183 |
\KOMAoptions{parskip=half-} |
| 184 |
\addtokomafont{sectioning}{\color{themecolor}} |
| 185 |
\addtokomafont{date}{\normalsize} |
| 186 |
\addtokomafont{author}{\normalsize} |
| 187 |
\setlength{\footnotemargin}{0.7em} |
| 188 |
}{} |
| 189 |
|
| 190 |
\ifpdftex |
| 191 |
\pdfsuppressptexinfo-1 |
| 192 |
\fi |
| 193 |
|
| 194 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 195 |
% |
| 196 |
% Custom macros |
| 197 |
% |
| 198 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 199 |
\providecommand*{\CTAN}{\textsc{CTAN}\xspace} |
| 200 |
\providecommand*{\TikZ}{Ti\emph{k}Z\xspace} |
| 201 |
\providecommand*{\miktex}{MiK\TeX\xspace} |
| 202 |
\providecommand*{\texlive}{\TeX{}Live\xspace} |
| 203 |
\providecommand*{\tikzbrick}{Ti\emph{k}Zbrick\xspace} |
| 204 |
\providecommand*{\tikzducks}{Ti\emph{k}Zducks\xspace} |
| 205 |
\providecommand*{\tikzlings}{Ti\emph{k}Zlings\xspace} |
| 206 |
\providecommand*{\tikzmarmots}{Ti\emph{k}Zmarmots\xspace} |
| 207 |
\providecommand*{\ConTeXt}{C\kern-.0333emon\-\kern-.0667em\TeX\kern-.0333emt} |
| 208 |
|
| 209 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 210 |
% |
| 211 |
% Doc blurb |
| 212 |
% |
| 213 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 214 |
\newcommand{\packagename}[1]{\def\@packagename{#1}} |
| 215 |
|
| 216 |
\NewDocumentCommand\blurb{s}{% |
| 217 |
This package is work in progress, therefore I would be happy to hear your feedback and ideas how to improve the package. The development version of the source code can be found at \url{https://github.com/samcarter/\@packagename}, including an issue tracker. |
| 218 |
\IfBooleanF#1{% |
| 219 |
A more stable version of the package can be found on \CTAN (\url{https://ctan.org/pkg/\@packagename}) and is included in both \texlive and \miktex as \texttt{\@packagename}. |
| 220 |
}% |
| 221 |
If you seek any other assistance (not bug reports/feature requests), I suggest asking at \url{https://topanswers.xyz/tex}. |
| 222 |
|
| 223 |
Copyright {\footnotesize\textcopyright} \texttt{samcarter}. Permission is granted to copy, distribute and\slash or modify this software under the terms of the LaTeX project public licence, version 1.3c or later \url{https://www.latex-project.org/lppl.txt}. |
| 224 |
} |