-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathtikzducks-doc-settings.sty
More file actions
237 lines (220 loc) · 7.64 KB
/
tikzducks-doc-settings.sty
File metadata and controls
237 lines (220 loc) · 7.64 KB
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Personal helper theme for package documentations
% Copyright samcarter
%
% This file may be distributed and/or modified
% under the LaTeX Project Public License 1.3c or later
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Usage:
% ln ~/Life/latex/beamertheme-sam/themesam.sty package-doc-settings.sty
% \usepackage[
% themecolor=samdblue
% ]{\jobname-settings}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Colours
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{xcolor}
\definecolor{samyellow}{RGB}{246,193,65}
\definecolor{samorange}{RGB}{241,147,45}
\definecolor{samred}{RGB}{191,26,46}
\definecolor{sammagenta}{RGB}{170,42,104}
\definecolor{samviolet}{RGB}{136,46,114}
\definecolor{samlila}{RGB}{101,67,159}
\definecolor{samdblue}{RGB}{38,38,139}
\definecolor{samlblue}{RGB}{22,89,155}
\definecolor{samteal}{RGB}{25,143,157}
\definecolor{samlgreen}{RGB}{68,170,153}
\definecolor{samdgreen}{RGB}{78,178,125}
\definecolor{samlgray}{RGB}{160,160,185}
\definecolor{samdgray}{RGB}{60,60,85}
\newcommand{\samcolours}{
\foreach \sam@col/\sam@pkg in {
samyellow/???,
samorange/Pgfplots,
samred/TikZbricks,
sammagenta/TikZmarmots,
samviolet/TikZlings,
samlila/Rainbow,
samdblue/Spectrum,
samlblue/TikZducks,
samteal/Tcolorbox,
samlgreen/Jigsaw,
samdgreen/???,
samlgray/Cistercian,
samdgray/Panda%
}{
\begingroup
\color{\sam@col}%
\makebox[0cm][l]{\rule[-0.9cm]{2.5cm}{2cm}}%
\endgroup
\parbox[c][2cm]{2.5cm}{\bfseries\color{white}\centering \sam@col\\\sam@pkg}%
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Package options
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{xkeyval}
\DeclareOptionX{themecolor}[samdblue]{\colorlet{themecolor}{#1}}
\DeclareOptionX{listingcolor}[samlblue]{\colorlet{listingcolor}{#1}}
\ExecuteOptionsX{themecolor,listingcolor}
\ProcessOptionsX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Packages
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\@ifclassloaded{scrartcl}{%
\RequirePackage[english]{babel}
\RequirePackage[paper=a4paper,margin=2.9cm]{geometry}
\RequirePackage{scrlayer-scrpage}
\let\hrulefillx\hrulefill
\RequirePackage[bitstream-charter]{mathdesign}
\let\hrulefill\hrulefillx
\RequirePackage[hang,flushmargin,bottom]{footmisc}
\RequirePackage{footnotehyper}
\makesavenoteenv{tcolorbox}
\RequirePackage[all]{nowidow}
\RequirePackage[hyphens]{url}
\RequirePackage[colorlinks=true,breaklinks=true,allcolors=themecolor,hyperfootnotes=false]{hyperref}
}{}
\RequirePackage[T1]{fontenc}
\RequirePackage{xspace}
\RequirePackage{inconsolata}% mono font with bold, but italic is missing
\@ifclassloaded{scrartcl}{%
\RequirePackage[scale=0.85]{cascadia-code}
% \AddToHook{cmd/ttfamily/before}{\fontseries{sl}}
}{}
\RequirePackage{synthslant}% to fake slanted comments in inconsolata
\RequirePackage{metalogox}% should be loaded after the fonts
\@ifclassloaded{scrartcl}{}{%
\RequirePackage{lmodern}
\renewcommand{\ttdefault}{lmtt}
\graphicspath{{./include}}
}
\RequirePackage{iftex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Listings
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage[cachedir=./.minted]{minted}
\AddToHook{env/MintedVerbatim/before}{%
% optional arguments
\@namedef{PYG@tok@na}{\def\PYG@tc##1{\textcolor{black}{##1}}}%
% macros
\@namedef{PYG@tok@k}{\def\PYG@tc##1{\textcolor{listingcolor}{\bfseries ##1}}}%
% curly brackets
\@namedef{PYG@tok@nb}{\def\PYG@tc##1{\textcolor{listingcolor}{\bfseries ##1}}}%
% comments (italics won't work with the inconsolata font)
\@namedef{PYG@tok@c}{\def\PYG@tc##1{\textcolor{gray}{\textsynthslant{##1}}}}%
}
\usemintedstyle{default}
\setminted{
breaksymbolleft={},
tabsize=2,
breaklines=true,
}
\newminted[samcode]{latex}{}
\newmintinline[saminline]{latex}{}
% use non-bold and all coloured for inline code in articles
\@ifclassloaded{scrartcl}{%
\patchcmd{\minted@inputpyg@inline}{\minted@input}{\color{listingcolor}\renewcommand\textcolor[3][]{##3}\renewcommand\bfseries{}\minted@input}{}{}
}{}
\RequirePackage[most]{tcolorbox}
\tcbuselibrary{minted}
\newcommand{\prefix}{./include}
\tcbset{%
colframe=themecolor,
fonttitle=\bfseries,
sidebyside,
center lower,
righthand width=5.7cm,
bottom=2pt,
top=2pt,
left=3pt,
right=3pt,
sidebyside gap=10pt,
lower separated=false,
listing engine=minted,
minted language=latex,
colback=themecolor!10,
sharp corners,
boxrule=0pt,
before title={\strut},
compilable listing/.style={listing file={\prefix/\jobname-listing-\thetcblistingcount.tex}},
compilable listing sam/.style={
listing and comment,
pdf comment,
freeze pdf,
compilable listing,
run latexmk={-g- -pdf -cd},
comment style={raster columns=1},
},
}
\@ifclassloaded{scrartcl}{% for package documentations
% avoid page breaks right in front of the tcolorbox
\tcbuselibrary{hooks}
\tcbset{before pre={\nopagebreak[4]}}
}{% for presentations, either beamer or ltx-talk
\tcbset{
righthand width=.47\linewidth,
flushleft lower,
listing outside text,
sidebyside gap=1cm,
minted options app={fontsize=\normalsize},
before lower={%
\renewcommand{\documentclass}[2][]{}%
\renewcommand{\usepackage}[2][]{}%
\renewenvironment{document}{}{}%
},
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% document settings
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\@ifclassloaded{scrartcl}{%
\KOMAoptions{parskip=half-}
\addtokomafont{sectioning}{\color{themecolor}}
\addtokomafont{date}{\normalsize}
\addtokomafont{author}{\normalsize}
\setlength{\footnotemargin}{0.7em}
}{}
\ifpdftex
\pdfsuppressptexinfo-1
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Custom macros
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\providecommand*{\CTAN}{\textsc{CTAN}\xspace}
\providecommand*{\TikZ}{Ti\emph{k}Z\xspace}
\providecommand*{\miktex}{MiK\TeX\xspace}
\providecommand*{\texlive}{\TeX{}Live\xspace}
\providecommand*{\tikzbrick}{Ti\emph{k}Zbrick\xspace}
\providecommand*{\tikzducks}{Ti\emph{k}Zducks\xspace}
\providecommand*{\tikzlings}{Ti\emph{k}Zlings\xspace}
\providecommand*{\tikzmarmots}{Ti\emph{k}Zmarmots\xspace}
\providecommand*{\ConTeXt}{C\kern-.0333emon\-\kern-.0667em\TeX\kern-.0333emt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Doc blurb
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\packagename}[1]{\def\@packagename{#1}}
\NewDocumentCommand\blurb{s}{%
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.
\IfBooleanF#1{%
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}.
}%
If you seek any other assistance (not bug reports/feature requests), I suggest asking at \url{https://topanswers.xyz/tex}.
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}.
}