Debian Codegraph @

texmf-dist/doc/latex/jigsaw/jigsaw-doc-settings.sty

raw
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}% 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
72 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73 %
74 % Listings
75 %
76 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77 \RequirePackage[
78 cachedir=./build/
79 ]{minted}
80
81 % smuggling custom pygmentize style in cache folder
82 % (a real pygmentise style would need installtion in some python folder)
83 \begin{filecontents*}[noheader]{./build/sam.pygstyle}
84 \makeatletter
85 \def\PYG@reset{\let\PYG@it=\relax \let\PYG@bf=\relax%
86 \let\PYG@ul=\relax \let\PYG@tc=\relax%
87 \let\PYG@bc=\relax \let\PYG@ff=\relax}
88 \def\PYG@tok#1{\csname PYG@tok@#1\endcsname}
89 \def\PYG@toks#1+{\ifx\relax#1\empty\else%
90 \PYG@tok{#1}\expandafter\PYG@toks\fi}
91 \def\PYG@do#1{\PYG@bc{\PYG@tc{\PYG@ul{%
92 \PYG@it{\PYG@bf{\PYG@ff{#1}}}}}}}
93 \def\PYG#1#2{\PYG@reset\PYG@toks#1+\relax+\PYG@do{#2}}
94
95 % optional arguments
96 \expandafter\def\csname PYG@tok@na\endcsname{\def\PYG@tc##1{\textcolor{black}{##1}}}
97
98 % macros
99 \expandafter\def\csname PYG@tok@k\endcsname{\def\PYG@tc##1{\textcolor{listingcolor}{\bfseries ##1}}}
100 % curly brakets
101 \expandafter\def\csname PYG@tok@nb\endcsname{\def\PYG@tc##1{\textcolor{listingcolor}{\bfseries ##1}}}
102
103 % comments (italics won't work with the inconsolata font)
104 \expandafter\def\csname PYG@tok@c\endcsname{\def\PYG@tc##1{\textcolor{gray}{##1}}}
105
106 \def\PYGZbs{\char`\\}
107 \def\PYGZus{\char`\_}
108 \def\PYGZob{\char`\{}
109 \def\PYGZcb{\char`\}}
110 \def\PYGZca{\char`\^}
111 \def\PYGZam{\char`\&}
112 \def\PYGZlt{\char`\<}
113 \def\PYGZgt{\char`\>}
114 \def\PYGZsh{\char`\#}
115 \def\PYGZpc{\char`\%}
116 \def\PYGZdl{\char`\$}
117 \def\PYGZhy{\char`\-}
118 \def\PYGZsq{\char`\'}
119 \def\PYGZdq{\char`\"}
120 \def\PYGZti{\char`\~}
121 % for compatibility with earlier versions
122 \def\PYGZat{@}
123 \def\PYGZlb{[}
124 \def\PYGZrb{]}
125 \makeatother
126 \end{filecontents*}
127
128 \usemintedstyle{sam}
129 \setminted{
130 breaksymbolleft={},
131 tabsize=2,
132 breaklines=true,
133 }
134 \newminted[samcode]{latex}{}
135 \newmintinline[saminline]{latex}{}
136
137 % use non-bold and all coloured for inline code in articles
138 \ifdefined\insertaspectratio\else
139 \patchcmd{\minted@inputpyg@inline}{\minted@input}{\color{listingcolor}\renewcommand\textcolor[3][]{##3}\renewcommand\bfseries{}\minted@input}{}{}
140 \fi
141
142 \RequirePackage[most]{tcolorbox}
143 \tcbuselibrary{minted}
144 \tcbset{%
145 colframe=themecolor,
146 fonttitle=\bfseries,
147 sidebyside,
148 center lower,
149 righthand width=5.7cm,
150 bottom=2pt,
151 top=2pt,
152 left=3pt,
153 right=3pt,
154 sidebyside gap=10pt,
155 lower separated=false,
156 listing engine=minted,
157 minted language=latex,
158 colback=themecolor!10,
159 sharp corners,
160 boxrule=0pt,
161 before title={\strut}
162 }
163
164 % avoid page breaks right in front of the tcolorbox
165 \@ifclassloaded{beamer}{}{
166 \tcbuselibrary{hooks}
167 \tcbset{before pre={\nopagebreak[4]}}
168 }
169
170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
171 %
172 % document settings
173 %
174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
175 \@ifclassloaded{scrartcl}{%
176 \KOMAoptions{parskip=half}
177 \addtokomafont{sectioning}{\color{themecolor}}
178 \addtokomafont{date}{\normalsize}
179 \addtokomafont{author}{\normalsize}
180 \setlength{\footnotemargin}{0.7em}
181 }{}
182
183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
184 %
185 % Custom macros
186 %
187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
188 \providecommand*{\CTAN}{\textsc{CTAN}\xspace}
189 \providecommand*{\TikZ}{Ti\emph{k}Z\xspace}
190 \providecommand*{\miktex}{MiK\TeX\xspace}
191 \providecommand*{\texlive}{\TeX{}Live\xspace}
192 \providecommand*{\tikzbrick}{Ti\emph{k}Zbrick\xspace}
193 \providecommand*{\tikzducks}{Ti\emph{k}Zducks\xspace}
194 \providecommand*{\tikzlings}{Ti\emph{k}Zlings\xspace}
195 \providecommand*{\tikzmarmots}{Ti\emph{k}Zmarmots\xspace}
196 \providecommand*{\ConTeXt}{C\kern-.0333emon\-\kern-.0667em\TeX\kern-.0333emt}